mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongyan Xu <getshell@seu.edu.cn>
To: cw00.choi@samsung.com, krzk@kernel.org, myungjoo.ham@samsung.com
Cc: jianhao.xu@seu.edu.cn, linux-kernel@vger.kernel.org,
	Hongyan Xu <getshell@seu.edu.cn>,
	stable@vger.kernel.org
Subject: [PATCH] extcon: max77843: cancel cable detection work on remove
Date: Tue, 28 Jul 2026 15:54:29 +0800	[thread overview]
Message-ID: <20260728075429.838-1-getshell@seu.edu.cn> (raw)

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

                 reply	other threads:[~2026-07-28  7:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260728075429.838-1-getshell@seu.edu.cn \
    --to=getshell@seu.edu.cn \
    --cc=cw00.choi@samsung.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®