mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] extcon: max77843: cancel cable detection work on remove
@ 2026-07-28  7:54 Hongyan Xu
  0 siblings, 0 replies; only message in thread
From: Hongyan Xu @ 2026-07-28  7:54 UTC (permalink / raw)
  To: cw00.choi, krzk, myungjoo.ham
  Cc: jianhao.xu, linux-kernel, Hongyan Xu, stable

max77843_muic_probe() queues wq_detcable after requesting the MUIC IRQs.
max77843_muic_remove() cancels irq_work, but it leaves the delayed cable
detection work pending while tearing down the MUIC IRQ chip and I2C
client. A delayed work item that runs after remove can dereference the
driver private data and removed resources.

Cancel wq_detcable synchronously at the start of remove, before tearing
down the resources used by the worker.

This issue was found by a static analysis tool.

Fixes: 27a28d32b4f2 ("extcon: max77843: Add max77843 MUIC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
 drivers/extcon/extcon-max77843.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 2ae9f7f1a67..a052d7a9af0 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -933,6 +933,7 @@ static void max77843_muic_remove(struct platform_device *pdev)
 	struct max77843_muic_info *info = platform_get_drvdata(pdev);
 	struct max77693_dev *max77843 = info->max77843;
 
+	cancel_delayed_work_sync(&info->wq_detcable);
 	cancel_work_sync(&info->irq_work);
 	regmap_del_irq_chip(max77843->irq, max77843->irq_data_muic);
 	i2c_unregister_device(max77843->i2c_muic);
-- 
2.50.1.windows.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-28  7:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28  7:54 [PATCH] extcon: max77843: cancel cable detection work on remove Hongyan Xu

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®