[PATCH v2 0/3] power: supply: fix work-vs-devres teardown use-after-free

From: hyunjungg

Date: Sun Nov 08 2026 - 23:43:41 EST


From: Hyunjung Ko <hj351016@xxxxxxxxx>

Three power-supply drivers register a poll/detect work for devm
cancellation before devm_power_supply_register(). devres unwinds in
reverse, so on unbind the power supply is freed before the work is
cancelled, and the work's power_supply_changed() then dereferences the
freed supply. Each patch moves the devm work-cancel registration to after
devm_power_supply_register() so teardown drains the work first. No
functional change.

v2 (thanks Sebastian Reichel):
- trim the commit messages down to the bug and the fix
- drop the inline comments
- no code change vs v1 other than that comment removal

Hyunjung Ko (3):
power: supply: ltc2941: drain poll work before unregistering the supply
power: supply: axp20x_usb_power: drain vbus_detect work before
unregistering the supply
power: supply: mt6360_charger: drain chrdet_work before unregistering
the supply

drivers/power/supply/axp20x_usb_power.c | 10 +++++-----
drivers/power/supply/ltc2941-battery-gauge.c | 10 +++++-----
drivers/power/supply/mt6360_charger.c | 7 ++++---
3 files changed, 14 insertions(+), 13 deletions(-)

--
2.43.0