Where
-Infinity
0
Severity
7.8
Use After Free
AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

In the Linux kernel, the following vulnerability has been resolved:

HID: universal-pidff: stop the device when force-feedback init fails

universalpidffprobe() starts the device with hidhwstart() and then, if force-feedback initialisation fails, returns the error through a label that only does "return error". The device is left started.

The HID core does not unwind on the driver's behalf. hiddeviceprobe() releases the devres group, closes the report and clears hdev->driver:

if (ret) { devresreleasegroup(&hdev->dev, hdev->devresgroupid); hidclosereport(hdev); hdev->driver = NULL; }

The hidraw character device that hidhwstart() registered through hidconnect() is allocated with kzalloc() and added with cdevdeviceadd(), so it is not devres-managed and survives that. With hdev->driver NULL, hiddeviceremove() skips hidhwstop() as well, because it only unwinds while a driver is still attached. The registration therefore outlives the device on both paths.

Opening the surviving /dev/hidrawX writes into freed memory. KASAN reports a use-after-free write from hidrawopen() -> hidhwopen() -> the transport's open callback, which takes a spinlock inside the freed object. A descriptor that carries a PID usage page and no input reports is enough: hidraw claims the device so hidhwstart() succeeds, while hid->inputs stays empty so force-feedback init fails. The other failure returns in hidpidffinitwithquirks() - no output reports, an allocation failure, pidffinitfields(), pidffcheckautocenter(), an unusable effect count, inputffcreate() - all reach the same label.

Stop the device on that path. hid-dr.c and hid-emsff.c, which start the device with the same HIDCONNECTDEFAULT & ~HIDCONNECTFF mask, already do this. The two earlier gotos must keep returning without hidhwstop(), since neither has a started device, so give the path that fails after the start its own label.

Discovered by XBOW, triaged by Baul Lee <baul.lee@xbow.com>

First published (updated )

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203