mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
hwmon: (nzxt-kraken3) Stop device IO before calling hid_hw_stop
Calling hid_hw_stop() does not stop the device IO.
This results in a race condition between hid_input_report() and the point
immediately following the execution of hid_device_io_start() within
the driver probe function. If the probe operation fails after "io start"
has been initiated, this race condition will result in a UAF vulnerability.
Fix the problem by calling hid_device_io_stop() before calling
hid_hw_stop().
Reported-by: Sashiko <sashiko-bot@kernel.org>
Fixes: f3b4b146eb ("hwmon: Add driver for NZXT Kraken X and Z series AIO CPU coolers")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
59d104b54b
commit
f151d0143a
|
|
@ -948,7 +948,7 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id
|
|||
ret = kraken3_init_device(hdev);
|
||||
if (ret < 0) {
|
||||
hid_err(hdev, "device init failed with %d\n", ret);
|
||||
goto fail_and_close;
|
||||
goto fail_and_stop_io;
|
||||
}
|
||||
|
||||
ret = kraken3_get_fw_ver(hdev);
|
||||
|
|
@ -960,13 +960,15 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id
|
|||
if (IS_ERR(priv->hwmon_dev)) {
|
||||
ret = PTR_ERR(priv->hwmon_dev);
|
||||
hid_err(hdev, "hwmon registration failed with %d\n", ret);
|
||||
goto fail_and_close;
|
||||
goto fail_and_stop_io;
|
||||
}
|
||||
|
||||
kraken3_debugfs_init(priv, device_name);
|
||||
|
||||
return 0;
|
||||
|
||||
fail_and_stop_io:
|
||||
hid_device_io_stop(hdev);
|
||||
fail_and_close:
|
||||
hid_hw_close(hdev);
|
||||
fail_and_stop:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user