From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+9ee5f5dc18673d6b2f37@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [hwmon?] KASAN: slab-out-of-bounds Read in aqc_raw_event
Date: Sat, 22 Aug 2026 15:00:04 +0800 [thread overview]
Message-ID: <tencent_0AF5772967663DAB364096D036F24B307409@qq.com> (raw)
In-Reply-To: <6a891232.91706f20.16b6e3.02b0.GAE@google.com>
#syz test
diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index 1ca70e726298..c4c8e806db95 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -1324,6 +1324,75 @@ static const struct hwmon_chip_info aqc_chip_info = {
.info = aqc_info,
};
+static bool aqc_raw_data_valid(struct aqc_data *priv, int size)
+{
+ int off;
+ char *msg;
+
+ if (!priv)
+ return false;
+
+ off = priv->serial_number_start_offset + SERIAL_PART_OFFSET;
+ if (off >= size) {
+ msg = "serial number start offset";
+ goto invalid;
+ }
+
+ off = priv->firmware_version_offset;
+ if (off >= size) {
+ msg = "firmware version offset";
+ goto invalid;
+ }
+
+ /* Physical temperature sensor readings data size check*/
+ if (priv->num_temp_sensors > 0) {
+ off = priv->temp_sensor_start_offset +
+ (priv->num_temp_sensors - 1) * AQC_SENSOR_SIZE;
+
+ if (off >= size) {
+ msg = "temp sensor start offset";
+ goto invalid;
+ }
+ }
+ /* Virtual temperature sensor readings data size check*/
+ if (priv->num_virtual_temp_sensors > 0) {
+ off = priv->virtual_temp_sensor_start_offset +
+ (priv->num_virtual_temp_sensors - 1) * AQC_SENSOR_SIZE;
+
+ if (off >= size) {
+ msg = "virtual temp sensor start offset";
+ goto invalid;
+ }
+ }
+ /* Fan speed and related readings data size check */
+ if (priv->num_fans > 0) {
+ int fan_off = priv->fan_sensor_offsets[priv->num_fans - 1];
+
+ off = fan_off + priv->fan_structure->power;
+ if (off >= size) {
+ msg = "fan power offset";
+ goto invalid;
+ }
+
+ off = fan_off + priv->fan_structure->voltage;
+ if (off >= size) {
+ msg = "fan voltage offset";
+ goto invalid;
+ }
+
+ off = fan_off + priv->fan_structure->curr;
+ if (off >= size) {
+ msg = "fan curr offset";
+ goto invalid;
+ }
+ }
+
+ return true;
+invalid:
+ pr_debug("data size (%d) is less than the %s, %s\n", size, msg, __func__);
+ return false;
+}
+
static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size)
{
int i, j, sensor_value;
@@ -1334,6 +1403,9 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
priv = hid_get_drvdata(hdev);
+ if (!aqc_raw_data_valid(priv, size))
+ return 0;
+
/* Info provided with every report */
priv->serial_number[0] = get_unaligned_be16(data + priv->serial_number_start_offset);
priv->serial_number[1] = get_unaligned_be16(data + priv->serial_number_start_offset +
next prev parent reply other threads:[~2026-08-22 7:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 3:06 syzbot
2026-08-22 4:02 ` Guenter Roeck
2026-08-22 8:07 ` Aleksa Savic
2026-08-22 14:24 ` Guenter Roeck
2026-08-22 5:07 ` Edward Adam Davis
2026-08-22 5:28 ` syzbot
2026-08-22 5:34 ` [PATCH] hwmon: valid the data size before reading the sensor data Edward Adam Davis
2026-08-22 6:41 ` Guenter Roeck
2026-08-22 7:54 ` Edward Adam Davis
2026-08-22 7:00 ` Edward Adam Davis [this message]
2026-08-22 7:44 ` [syzbot] [hwmon?] KASAN: slab-out-of-bounds Read in aqc_raw_event syzbot
2026-08-22 8:38 ` Edward Adam Davis
2026-08-22 9:03 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_0AF5772967663DAB364096D036F24B307409@qq.com \
--to=eadavis@qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+9ee5f5dc18673d6b2f37@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®