diff options
| author | Linmao Li <lilinmao@kylinos.cn> | 2026-08-31 09:45:09 +0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-09-09 18:16:34 -0700 |
| commit | 508baf1713f32f287bfb4f85d759403ec8ba35a3 (patch) | |
| tree | d539c4f54f802a947e8d7c2f7f44522c1d85ae7f /scripts/basic | |
| parent | 6d760f8b41aed74de4402440e4db663d261478bd (diff) | |
| download | linux-508baf1713f32f287bfb4f85d759403ec8ba35a3.tar.gz linux-508baf1713f32f287bfb4f85d759403ec8ba35a3.zip | |
hwmon: (corsair-cpro) Create debugfs entries after hwmon registration
ccp_debugfs_init() registers debugfs files whose private data is the devm
allocated ccp. It runs before hwmon_device_register_with_info(), so when
that registration fails, ccp_probe() returns with the files still in
place. The HID core then frees ccp, and ccp_remove() is not called for a
failed probe, so nothing removes them later either. Reading one of the
files dereferences the freed pointer.
Create the debugfs entries only after the hwmon device has been
registered, so no failing path can leave them behind.
The two version queries stay where they are. They send USB commands
without holding ccp->mutex, which is only safe as long as nothing else
can call send_usb_cmd(); once the hwmon device is registered its
callbacks can do so concurrently. Only the debugfs creation moves, and
it is told which queries succeeded.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-hwmon/20260708031612.BD7E61F000E9@smtp.kernel.org/
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 5997eb60f896 ("hwmon: (corsair-cpro) Add firmware and bootloader information")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Link: https://patch.msgid.link/20260831014509.3352442-1-lilinmao@kylinos.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'scripts/basic')
0 files changed, 0 insertions, 0 deletions
