From: Tristan Madani The driver schedules wq_detcable as a delayed work during probe but never cancels it. If the device is unbound before the work fires, the callback dereferences freed memory because the driver data is managed by devm. Use devm_delayed_work_autocancel() so the work is automatically cancelled when the device is removed, matching the existing irq_work conversion done in the same driver. Fixes: 962e56bfcf0b ("extcon: max14577: Add extcon-max14577 driver to support MUIC device") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani --- 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 5476f48ed74b9..905722ede7ab1 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); -- 2.47.3