HIGH Introduced in 2.6.36
at91_udc VbusTimer UAF
CVE-2026-89738
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI6.9MEDIUM
01Description
In the Linux kernel, the following vulnerability has been resolved: usb: gadget: at91_udc: drain polled-VBUS timer/work before udc is freed In polled-VBUS mode (board.vbus_pin && board.vbus_polled), probe arms a self-restarting cycle: at91_vbus_timer() schedules vbus_timer_work, and at91_vbus_timer_work() calls at91_vbus_update() and re-arms the timer via mod_timer(). Both recover the same udc through container_of and dereference it on every iteration. Neither teardown path cancels this cycle. udc is devm-allocated, so it is freed after at91udc_remove() returns, and is likewise freed when probe fails and devres runs. A timer callback or work item that is pending or running at either point dereferences the freed udc. Add at91_udc_shutdown_vbus_timer() and call it from at91udc_remove() and from the usb_add_gadget_udc() failure path in probe; the remaining probe error paths fail before the timer is armed. timer_shutdown_sync() waits for a running callback and clears timer->function, which makes the work handler's mod_timer() a permanent no-op; cancel_work_sync() then drains any pending or running work whose re-arm attempt now does nothing. The timer must be shut down first, since cancelling the work alone would let the timer re-queue it. The guard mirrors probe: in IRQ mode the timer and work_struct are never initialized. This does not require a fault; a normal driver unbind can interleave with an already queued work item. This issue was found by an in-house static analysis tool.
02KernelScan AI Analysis
Risk summary
A use-after-free in the Atmel AT91 USB gadget driver occurs when a self-restarting VBUS polling timer and work item continue running after the controller structure is freed during driver teardown. Systems with the AT91 USB gadget controller configured in polled-VBUS mode are at risk; a normal driver unbind racing with a queued work item can trigger a kernel panic or memory corruption. Local access and the specific hardware are required.
Vulnerability analysis
In the AT91 USB gadget driver, when polled-VBUS mode is active, a timer repeatedly schedules a work item that re-arms the timer, with both accessing the controller structure. During driver removal or a failed probe, this cycle is not stopped before the controller structure is freed. A pending or running callback can then access freed memory, causing a use-after-free. The fix stops the timer first so the work handler cannot restart it, then drains any pending work, ensuring no callback touches the freed structure. The bug is reachable only on systems with the AT91 USB gadget controller in polled-VBUS mode, triggered by a normal driver unbind racing with queued work, and requires local access with the hardware present.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.18 | 2.6.36 | 6.18.50 | 51a311eb97e9 |
| 7.2 | 2.6.36 | 7.2.4 | 557ef547d49f |
| 6.12 | 2.6.36 | 6.12.109 | a2a602cb1e28 |
| mainline | 2.6.36 | 7.3-rc1 | c27d13ce4bab |
| cip/6.12 | 2.6.36 | 6.12.111-cip32 | a2a602cb1e28 |