From: sashiko-bot@kernel.org
To: "Edward Adam Davis" <eadavis@qq.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v4] hwmon: (aquacomputer_d5next) valid the data size before reading the sensor data
Date: Sat, 22 Aug 2026 11:47:46 +0000 [thread overview]
Message-ID: <20260822114746.B46471F000E9@smtp.kernel.org> (raw)
In-Reply-To: <tencent_CE16CF998D9A25B20DEF1275DDCEDDB61907@qq.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the patch's attempt to fix the out-of-bounds read is incomplete. The newly added `aqc_raw_data_valid()` deliberately skips bounds checking for special-case sensors (like `leakshield`, `aquastreamult`, and `highflownext`). An attacker can supply a HID report that passes the initial generic length checks, but is too small for the special-case offsets (e.g., `LEAKSHIELD_PRESSURE_ADJUSTED` at offset 285). The switch statement in `aqc_raw_event()` then unconditionally reads these out-of-bounds offsets.
- [High] This problem wasn't introduced by this patch, but a malicious HID device mimicking `aquastreamxt` can trigger a NULL pointer dereference in `aqc_raw_event()`. For `aquastreamxt`, `priv->fan_structure` is deliberately left uninitialized (NULL) during `probe()`. The patch author added `if (!priv->fan_structure) goto flow;` in `aqc_raw_data_valid()` to skip checking it, but missed that the loop in `aqc_raw_event()` will still execute because `priv->num_fans` is 2. The loop unconditionally dereferences `priv->fan_structure->speed`, causing an immediate kernel panic.
- [High] This problem wasn't introduced by this patch, but there is a missing bounds check on `hdev->maxcollection` before accessing `hdev->collection[1]` in `aqc_probe()`. A malicious USB device can present a HID report descriptor that defines 0 or 1 collections, leading to an out-of-bounds array read when the driver checks `hdev->collection[1].type`.
--
--- Patch [1]: [PATCH v4] hwmon: (aquacomputer_d5next) valid the data size before reading the sensor data ---
commit 78df709d4519cd7ca51246e494c81774b1f7c3ae
Author: Edward Adam Davis <eadavis@qq.com>
hwmon: (aquacomputer_d5next) valid the data size before reading the sensor data
The user-forged sensor data is only 65 bytes long; however, aqc_raw_event()
fails to handle cases where the sensor data length is too small when reading
the data, resulting in [1] during the read process.
Add a data size check, if the size is less than that required for the
specific data item to be read, abort the sensor data read operation.
Link: https://syzkaller.appspot.com/bug?extid=9ee5f5dc18673d6b2f37
> diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
> index 1ca70e7262988..89c9fc0c77e52 100644
> --- a/drivers/hwmon/aquacomputer_d5next.c
> +++ b/drivers/hwmon/aquacomputer_d5next.c
> @@ -1324,6 +1324,107 @@ static const struct hwmon_chip_info aqc_chip_info = {
> .info = aqc_info,
> };
>
> +/* aqc_raw_data_valid()
> + * Does not support special-case sensor readings data size check
> + */
[Severity: High]
This problem wasn't introduced by this patch, but the patch's attempt to fix
the out-of-bounds read seems incomplete. The newly added aqc_raw_data_valid()
deliberately skips bounds checking for special-case sensors (like leakshield,
aquastreamult, and highflownext).
Could an attacker supply a HID report that passes the initial generic length
checks, but is too small for the special-case offsets?
For example, LEAKSHIELD_PRESSURE_ADJUSTED is at offset 285. The switch
statement in aqc_raw_event() then unconditionally reads these out-of-bounds
offsets:
case leakshield:
priv->speed_input[0] =
((s16)get_unaligned_be16(data + LEAKSHIELD_PRESSURE_ADJUSTED)) * 100;
> +static bool aqc_raw_data_valid(struct aqc_data *priv, int size)
> +{
[ ... ]
> + /* Fan speed and related readings data size check */
> + if (!priv->fan_structure)
> + goto flow;
[Severity: High]
This isn't a bug introduced by this patch, but could this cause a NULL pointer
dereference?
For aquastreamxt, priv->fan_structure is deliberately left uninitialized
(NULL) during probe(). The check above skips bounds checking when
fan_structure is NULL, but misses that the loop in aqc_raw_event() will still
execute because priv->num_fans is 2.
The loop in aqc_raw_event() unconditionally dereferences priv->fan_structure:
for (i = 0; i < priv->num_fans; i++) {
priv->speed_input[i] =
get_unaligned_be16(data + priv->fan_sensor_offsets[i] +
priv->fan_structure->speed);
Could a malicious HID device mimicking aquastreamxt trigger a kernel panic
here?
[ ... ]
[Severity: High]
This is a pre-existing issue, but is there a missing bounds check on
hdev->maxcollection before accessing hdev->collection[1] in aqc_probe()?
If a malicious USB device presents a HID report descriptor that defines 0 or 1
collections, could the driver perform an out-of-bounds array read when it
checks hdev->collection[1].type:
drivers/hwmon/aquacomputer_d5next.c:aqc_probe() {
...
if (hdev->collection[1].type != 0) {
ret = -ENODEV;
goto fail_and_close;
}
...
}
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_CE16CF998D9A25B20DEF1275DDCEDDB61907@qq.com?part=1
next prev parent reply other threads:[~2026-08-22 11:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 3:06 [syzbot] [hwmon?] KASAN: slab-out-of-bounds Read in aqc_raw_event 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:34 ` [PATCH] hwmon: valid the data size before reading the sensor data Edward Adam Davis
2026-08-22 5:44 ` sashiko-bot
2026-08-22 7:45 ` [PATCH v2] " Edward Adam Davis
2026-08-22 7:54 ` Guenter Roeck
2026-08-22 7:57 ` sashiko-bot
2026-08-22 9:14 ` [PATCH v3] hwmon: (aquacomputer_d5next) " Edward Adam Davis
2026-08-22 9:26 ` sashiko-bot
2026-08-22 11:34 ` [PATCH v4] " Edward Adam Davis
2026-08-22 11:47 ` sashiko-bot [this message]
2026-08-22 11:55 ` Greg KH
2026-08-22 12:23 ` Edward Adam Davis
2026-08-22 12:45 ` Greg KH
2026-08-22 13:03 ` Edward Adam Davis
2026-08-22 14:05 ` [PATCH v5] " Edward Adam Davis
2026-08-22 14:20 ` sashiko-bot
2026-08-22 14:25 ` Guenter Roeck
2026-08-22 6:41 ` [PATCH] hwmon: " Guenter Roeck
2026-08-22 7:54 ` Edward Adam Davis
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=20260822114746.B46471F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eadavis@qq.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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