mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] power: supply: fix work-vs-devres teardown use-after-free
@ 2026-11-09  4:42 hyunjungg
  2026-11-09  4:42 ` [PATCH v2 1/3] power: supply: ltc2941: drain poll work before unregistering the supply hyunjungg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hyunjungg @ 2026-11-09  4:42 UTC (permalink / raw)
  To: Sebastian Reichel, linux-pm
  Cc: Sebastian Reichel, Chen-Yu Tsai, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek,
	linux-kernel, Hyunjung Ko

From: Hyunjung Ko <hj351016@gmail.com>

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-09  4:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09  4:42 [PATCH v2 0/3] power: supply: fix work-vs-devres teardown use-after-free hyunjungg
2026-11-09  4:42 ` [PATCH v2 1/3] power: supply: ltc2941: drain poll work before unregistering the supply hyunjungg
2026-11-09  4:42 ` [PATCH v2 2/3] power: supply: axp20x_usb_power: drain vbus_detect " hyunjungg
2026-11-09  4:42 ` [PATCH v2 3/3] power: supply: mt6360_charger: drain chrdet_work " hyunjungg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®