CVE-2026-80766: HID: uclogic: fix use-after-free of inrange_timer on remove
In the Linux kernel, the following vulnerability has been resolved:
HID: uclogic: fix use-after-free of inrangetimer on remove
uclogicremove() cancels the pen in-range timer and then stops the device:
timerdeletesync(&drvdata->inrangetimer); hidhwstop(hdev);
timerdeletesync() only guarantees the timer is idle at that instant. uclogicraweventpen() keeps delivering pen reports until hidhwstop() stops the transport several lines later, and every report with pen->inrange == UCLOGICPARAMSPENINRANGENONE re-arms the timer:
modtimer(&drvdata->inrangetimer, jiffies + msecstojiffies(100));
A report landing between the timerdeletesync() call and the transport teardown in hidhwstop() re-arms inrangetimer after it was cancelled. uclogicremove() then returns and the devm drvdata is freed, while hidhwstop() has already freed the input device drvdata->peninput points at, so when the timer fires ~100 ms later uclogicinrangetimeout() dereferences freed memory -- a use-after-free in timer-softirq context.
Swapping the two calls is not a fix: stopping the device first frees drvdata->peninput via hidinputdisconnect() while the timer may still be pending, so a timer already armed before removal fires on the freed input device in the window before timerdeletesync() runs.
Use timershutdownsync() before hidhwstop() instead. It cancels the timer, waits for a running callback while peninput is still valid, and prevents any further re-arming -- a later modtimer() from an in-flight report is silently ignored -- so the timer is provably dead before hidhwstop() frees the inputs. This is the ordering the timer core documents for this "timer re-armed from another path" teardown case.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In the uclogic driver, during device removal, call timer_shutdown_sync() for the inrange timer before calling hid_hw_stop(), to prevent the timer from being re-armed and firing on freed device/input data (fixes use-after-free in inrange_timer on remove).
Linux kernel (uclogic HID driver) timer teardown ordering = Use timer_shutdown_sync() before hid_hw_stop()
Event History
Frequently Asked Questions
Which systems are exposed to this removal path?
The affected path is in the Linux kernel's uclogic HID driver and involves pen input handling. Systems not using this driver and its pen-report path are not described as exposed by the available information.
Can this be fixed by only changing the order of timer cancellation and device shutdown?
No. The available information explicitly states that simply stopping the device before cancelling the timer is also unsafe, because teardown can free the pen input object while the timer remains pending.
Which Linux kernel versions include the fix?
No affected or fixed kernel version numbers are provided. The supplied references identify stable-kernel commits, but the available information does not map those commits to released kernel versions.