power: supply: wm97xx: Fix NULL pointer dereference in power_supply_changed()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 7c87942aef52d2120e95ff1dec739998b9f95a78 · < c0def811ad8d642dca9b6d31a198cc39f5f90837| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
power: supply: wm97xx: Fix NULL pointer dereference in power_supply_changed()
In `probe()`, `request_irq()` is called before allocating/registering a `power_supply` handle. If an interrupt is fired between the call to `request_irq()` and `power_supply_register()`, the `power_supply` handle will be used uninitialized in `power_supply_changed()` in `wm97xx_bat_update()` (triggered from the interrupt handler). This will lead to a `NULL` pointer dereference since
Fix this racy `NULL` pointer dereference by making sure the IRQ is requested _after_ the registration of the `power_supply` handle. Since the IRQ is the last thing requests in the `probe()` now, remove the error path for freeing it. Instead add one for unregistering the `power_supply` handle when IRQ request fails.
From the CVE record · Linux
The Linux kernel’s wm97xx power supply driver can dereference a NULL pointer if an interrupt fires after the IRQ is requested but before the power supply handle is registered. This can cause a kernel crash. The input does not establish whether an attacker can trigger the race or what access would be required.
Anyone running Linux kernels with the wm97xx power supply driver should check whether their kernel includes the fix; affected versions are not specified.