HID: hyperv: streamline driver probe to avoid devres issues
Published Dec 27, 2024
5.5
MEDIUMCVSS 3.1
EPSS 0.22%
Description
It was found that unloading 'hid_hyperv' module results in a devres complaint:
... hv_vmbus: unregistering driver hid_hyperv ------------[ cut here ]------------ WARNING: CPU: 2 PID: 3983 at drivers/base/devres.c:691 devres_release_group+0x1f2/0x2c0 ... Call Trace: <TASK> ? devres_release_group+0x1f2/0x2c0 ? __warn+0xd1/0x1c0 ? devres_release_group+0x1f2/0x2c0 ? report_bug+0x32a/0x3c0 ? handle_bug+0x53/0xa0 ? exc_invalid_op+0x18/0x50 ? asm_exc_invalid_op+0x1a/0x20 ? devres_release_group+0x1f2/0x2c0 ? devres_release_group+0x90/0x2c0 ? rcu_is_watching+0x15/0xb0 ? __pfx_devres_release_group+0x10/0x10 hid_device_remove+0xf5/0x220 device_release_driver_internal+0x371/0x540 ? klist_put+0xf3/0x170 bus_remove_device+0x1f1/0x3f0 device_del+0x33f/0x8c0 ? __pfx_device_del+0x10/0x10 ? cleanup_srcu_struct+0x337/0x500 hid_destroy_device+0xc8/0x130 mousevsc_remove+0xd2/0x1d0 [hid_hyperv] device_release_driver_internal+0x371/0x540 driver_detach+0xc5/0x180 bus_remove_driver+0x11e/0x2a0 ? __mutex_unlock_slowpath+0x160/0x5e0 vmbus_driver_unregister+0x62/0x2b0 [hv_vmbus] ...
And the issue seems to be that the corresponding devres group is not allocated. Normally, devres_open_group() is called from __hid_device_probe() but Hyper-V HID driver overrides 'hid_dev->driver' with 'mousevsc_hid_driver' stub and basically re-implements __hid_device_probe() by calling hid_parse() and hid_hw_start() but not devres_open_group(). hid_device_probe() does not call __hid_device_probe() for it. Later, when the driver is removed, hid_device_remove() calls devres_release_group() as it doesn't check whether hdev->driver was initially overridden or not.
The issue seems to be related to the commit 62c68e7cee33 ("HID: ensure timely release of driver-allocated resources") but the commit itself seems to be correct.
Fix the issue by dropping the 'hid_dev->driver' override and using hid_register_driver()/hid_unregister_driver() instead. Alternatively, it would have been possible to rely on the default handling but HID_CONNECT_DEFAULT implies HID_CONNECT_HIDRAW and it doesn't seem to work for mousevsc as-is.
Affected products
-
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version StatusaffectedConstraints
- Version
-
- Version 5.10.270StatusaffectedConstraints<5.10.271
- Version 5.15.221StatusaffectedConstraints<5.15.222
- Version 6.1.188StatusaffectedConstraints<6.1.189
- Version
-
- Version 6.5StatusaffectedConstraints-
- Version 0StatusunaffectedConstraints<6.5
- Version 5.10.271StatusunaffectedConstraints<=5.10.*
- Version 5.15.222StatusunaffectedConstraints<=5.15.*
- Version 6.1.189StatusunaffectedConstraints<=6.1.*
- Version 6.11.11StatusunaffectedConstraints<=6.11.*
- Version 6.12.2StatusunaffectedConstraints<=6.12.*
- Version 6.13StatusunaffectedConstraints<=*
- Version 6.6.64StatusunaffectedConstraints<=6.6.*
- Version
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Linux | Linux | unaffected |
| ||||||||||||||||||||||||||||||
| Linux | Linux | unaffected |
| ||||||||||||||||||||||||||||||
| Linux | Linux | affected |
|
- ≥ 6.5 · < 6.6.64
- ≥ 6.7 · < 6.11.11
- ≥ 6.12 · < 6.12.2
No data.
Red Hat Enterprise Linux 6
kernel
Out of support scope
Red Hat Enterprise Linux 7
kernel
Out of support scope
Red Hat Enterprise Linux 7
kernel-rt
Out of support scope
Red Hat Enterprise Linux 8
kernel
Not affected
Red Hat Enterprise Linux 8
kernel-rt
Not affected
Red Hat Enterprise Linux 9
kernel
Fix deferred
Red Hat Enterprise Linux 9
kernel-rt
Fix deferred
| Product | Package | State | Advisory |
|---|---|---|---|
| Red Hat Enterprise Linux 6 | kernel | Out of support scope | n/a |
| Red Hat Enterprise Linux 7 | kernel | Out of support scope | n/a |
| Red Hat Enterprise Linux 7 | kernel-rt | Out of support scope | n/a |
| Red Hat Enterprise Linux 8 | kernel | Not affected | n/a |
| Red Hat Enterprise Linux 8 | kernel-rt | Not affected | n/a |
| Red Hat Enterprise Linux 9 | kernel | Fix deferred | n/a |
| Red Hat Enterprise Linux 9 | kernel-rt | Fix deferred | n/a |
No package ranges for this CVE.
Remediation
No remediation recorded yet.
References (13)
- https://access.redhat.com/security/cve/CVE-2024-56545 Vendor Advisory
- https://bugzilla.redhat.com/show_bug.cgi?id=2334488 Issue Tracking
- https://euvd.enisa.europa.eu/vulnerability/EUVD-2024-53193 Advisory
- https://git.kernel.org/stable/c/19a9457e5e210e408c1f8865b5d93c5a2c90409d Patch
- https://git.kernel.org/stable/c/3d48d0fbaaa74a04fb9092780a3f83dc4f3f8160 Patch
- https://git.kernel.org/stable/c/4c419126cf71ca1f358ec0b8ccc448928719d502
- https://git.kernel.org/stable/c/66ef47faa90d838cda131fe1f7776456cc3b59f2 Patch
- https://git.kernel.org/stable/c/a216f6dc0444c3bd900bca66b9f21467d08e3ed3
- https://git.kernel.org/stable/c/b03e713a400aeb5f969bab4daf47a7402d0df814 Patch
- https://git.kernel.org/stable/c/b7c074d21fe8a8ee3b4f866a12c72cad6a5826eb
- https://lore.kernel.org/linux-cve-announce/2024122728-CVE-2024-56545-0bfa@gregkh/T
- https://nvd.nist.gov/vuln/detail/CVE-2024-56545
- https://www.cve.org/CVERecord?id=CVE-2024-56545
Change history (0)
No recorded changes yet.