[PATCH] extcon: max14577: Fix potential use-after-free on removal
From: Guangshuo Li
Date: Thu Nov 26 2026 - 03:25:46 EST
Probe queues delayed cable detection, but removal does not cancel it.
The worker can therefore run after the device resources and private
data have been released.
Use managed delayed work so cable detection is cancelled before its
extcon device and private data are released.
This issue was found by our static analysis tool under development.
Fixes: 962e56bfcf0b ("extcon: max14577: Add extcon-max14577 driver to support MUIC device")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
drivers/extcon/extcon-max14577.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 7eefc13e9f59..dc13f1997f41 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -763,7 +763,10 @@ static int max14577_muic_probe(struct platform_device *pdev)
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
- INIT_DELAYED_WORK(&info->wq_detcable, max14577_muic_detect_cable_wq);
+ ret = devm_delayed_work_autocancel(&pdev->dev, &info->wq_detcable,
+ max14577_muic_detect_cable_wq);
+ if (ret)
+ return ret;
queue_delayed_work(system_power_efficient_wq, &info->wq_detcable,
delay_jiffies);
base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
--
2.43.0