From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 4/4] hwmon: (nzxt-kraken3) Stop device IO before calling hid_hw_stop
Date: Wed, 08 Jul 2026 02:10:03 +0000 [thread overview]
Message-ID: <20260708021003.89CD91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708015806.213790-5-linux@roeck-us.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional call to `hid_device_io_stop()` in the probe error path triggers a spurious kernel warning and improperly unwinds initialization.
--
--- Patch [4]: [PATCH 4/4] hwmon: (nzxt-kraken3) Stop device IO before calling hid_hw_stop ---
commit 1a6a1a210c8f1b5e86d4cd6021a1f5a8d033e172
Author: Guenter Roeck <linux@roeck-us.net>
hwmon: (nzxt-kraken3) Stop device IO before calling hid_hw_stop
Calling hid_hw_stop() does not stop the device IO, causing a race condition
if probe fails. This commit fixes the problem by calling
hid_device_io_stop() before calling hid_hw_stop().
> diff --git a/drivers/hwmon/nzxt-kraken3.c b/drivers/hwmon/nzxt-kraken3.c
> index d00409bcab93a..cca53252b343a 100644
> --- a/drivers/hwmon/nzxt-kraken3.c
> +++ b/drivers/hwmon/nzxt-kraken3.c
> @@ -970,6 +970,7 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id
> fail_and_close:
> hid_hw_close(hdev);
> fail_and_stop:
> + hid_device_io_stop(hdev);
[Severity: High]
Does this code unconditionally call hid_device_io_stop() on error paths where
hid_device_io_start() has not yet been called?
Looking at kraken3_probe() in drivers/hwmon/nzxt-kraken3.c, if we hit the
default case in the product switch statement or if memory allocation for
priv->buffer fails, we jump to fail_and_close:
default:
ret = -ENODEV;
goto fail_and_close;
At this point, hid_device_io_start() hasn't executed.
Because hid_device_io_stop() checks if io_started is false and emits a
dev_warn() in that case, this will trigger a spurious kernel warning on
these benign error paths. On systems with panic_on_warn enabled, this could
lead to a panic just by plugging in an unsupported device.
Additionally, when failing after hid_device_io_start() has been called
(for example, if kraken3_init_device() fails), the error handling jumps to
fail_and_close. This means hid_hw_close() is called before
hid_device_io_stop().
Should a new fail_and_stop_io label be added to ensure the teardown
happens in the correct LIFO order and to avoid warnings on early errors?
> hid_hw_stop(hdev);
> return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260708015806.213790-1-linux@roeck-us.net?part=4
prev parent reply other threads:[~2026-07-08 2:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 1:58 [PATCH 0/4] Fix error handling in HID device probe functions Guenter Roeck
2026-07-08 1:58 ` [PATCH 1/4] hwmon: (corsair-cpro) Stop device IO before calling hid_hw_stop Guenter Roeck
2026-07-08 2:09 ` sashiko-bot
2026-07-08 1:58 ` [PATCH 2/4] hwmon: (gigabyte_waterforce) " Guenter Roeck
2026-07-08 2:08 ` sashiko-bot
2026-07-08 1:58 ` [PATCH 3/4] hwmon: (nzxt-smart2) " Guenter Roeck
2026-07-08 2:11 ` sashiko-bot
2026-07-08 1:58 ` [PATCH 4/4] hwmon: (nzxt-kraken3) " Guenter Roeck
2026-07-08 2:10 ` sashiko-bot [this message]
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=20260708021003.89CD91F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--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