HIGH
power/supply Goldfish UAF
CVE-2026-45936
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: power: supply: goldfish: Fix use-after-free in power_supply_changed() Using the `devm_` variant for requesting IRQ _before_ the `devm_` variant for allocating/registering the `power_supply` handle, means that the `power_supply` handle will be deallocated/unregistered _before_ the interrupt handler (since `devm_` naturally deallocates in reverse allocation order). This means that during removal, there is a race condition where an interrupt can fire just _after_ the `power_supply` handle has been freed, *but* just _before_ the corresponding unregistration of the IRQ handler has run. This will lead to the IRQ handler calling `power_supply_changed()` with a freed `power_supply` handle. Which usually crashes the system or otherwise silently corrupts the memory... Note that there is a similar situation which can also happen during `probe()`; the possibility of an interrupt firing _before_ registering the `power_supply` handle. This would then lead to the nasty situation of using the `power_supply` handle *uninitialized* in `power_supply_changed()`. Fix this racy use-after-free by making sure the IRQ is requested _after_ the registration of the `power_supply` handle.
02KernelScan AI Analysis
Risk summary
A use-after-free vulnerability in the goldfish battery driver can cause kernel crashes, memory corruption, and potential information leaks in Android emulator environments. The race condition occurs during device removal when an interrupt handler accesses a freed power supply structure, with similar issues during probe with uninitialized data.
Vulnerability analysis
The vulnerability stems from incorrect resource ordering in the goldfish battery driver's probe function. The driver requests an IRQ handler before registering the power supply, but devm_ resources are freed in reverse allocation order. During device removal, this creates a race window where the power supply is freed before the IRQ handler is unregistered, allowing interrupts to trigger power_supply_changed() with a freed pointer. A similar issue exists during probe where an interrupt can fire before the power_supply handle is initialized. The fix reorders the operations to ensure the power supply remains valid throughout the IRQ handler's lifetime.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 5.10 | 5.10.252 | 589d4fe56713 |
| 5.15 | 5.15.202 | bad8b61eb505 |
| 6.1 | 6.1.165 | 33751e28842b |
| 6.12 | 6.12.75 | 4350505e82b4 |
| 6.18 | 6.18.14 | 8c89aade8335 |
| 6.19 | 6.19.4 | 0b29ffe4090a |
| 6.6 | 6.6.128 | 77ea437faa4c |
| mainline | 7.0 | b2ce982e2e0c |