usb: gadget: f_hid: don't call cdev_init while cdev in use
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ cb382536052fcc7713988869b54a81137069e5a9 · < 75ecc46828ec377dd5692c677168ef6d64fd7123| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_hid: don't call cdev_init while cdev in use
When calling unbind, then bind again, cdev_init reinitialized the cdev, even though there may still be references to it. That's the case when the /dev/hidg* device is still opened. This obviously unsafe behavior like oopes.
This fixes this by using cdev_alloc to put the cdev on the heap. That way, we can simply allocate a new one in hidg_bind.
From the CVE record · Linux
The Linux kernel USB HID gadget can reinitialize a character device that is still in use when the gadget is unbound and bound again. If /dev/hidg* remains open during that sequence, the unsafe behavior can cause a kernel oops. The input does not specify authentication requirements or whether an attacker can trigger the sequence.
Engineers running Linux kernels that use the USB HID gadget should check their versions; affected versions are not specified.