From: Tristan Madani <tristmd@gmail.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
Seung-Woo Kim <sw0312.kim@samsung.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH 4/5] extcon: rt8973a: cancel wq_detcable on driver unbind
Date: Tue, 20 Oct 2026 15:41:18 +0000 [thread overview]
Message-ID: <20261020154119.2568395-5-tristmd@gmail.com> (raw)
In-Reply-To: <20261020154119.2568395-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
The driver schedules wq_detcable as a delayed work during probe but
the remove callback only tears down the regmap IRQ chip and 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.
Fixes: c03e017c4d3d ("extcon: rt8973a: Add Richtek RT8973A extcon driver")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/extcon/extcon-rt8973a.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
index 19bb49f13fb08..184e9f4c16ce3 100644
--- a/drivers/extcon/extcon-rt8973a.c
+++ b/drivers/extcon/extcon-rt8973a.c
@@ -6,6 +6,7 @@
* Author: Chanwoo Choi <cw00.choi@samsung.com>
*/
+#include <linux/devm-helpers.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/input.h>
@@ -635,7 +636,10 @@ static int rt8973a_muic_i2c_probe(struct i2c_client *i2c)
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
- INIT_DELAYED_WORK(&info->wq_detcable, rt8973a_muic_detect_cable_wq);
+ ret = devm_delayed_work_autocancel(&i2c->dev, &info->wq_detcable,
+ rt8973a_muic_detect_cable_wq);
+ if (ret)
+ return ret;
queue_delayed_work(system_power_efficient_wq, &info->wq_detcable,
msecs_to_jiffies(DELAY_MS_DEFAULT));
--
2.47.3
next prev parent reply other threads:[~2026-10-20 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 15:41 [PATCH 0/5] extcon: cancel wq_detcable delayed work " Tristan Madani
2026-10-20 15:41 ` [PATCH 1/5] extcon: max14577: cancel wq_detcable " Tristan Madani
2026-10-20 15:41 ` [PATCH 2/5] extcon: max77693: " Tristan Madani
2026-10-20 15:41 ` [PATCH 3/5] extcon: max8997: " Tristan Madani
2026-10-20 15:41 ` Tristan Madani [this message]
2026-10-20 15:41 ` [PATCH 5/5] extcon: sm5502: " Tristan Madani
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=20261020154119.2568395-5-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=stable@vger.kernel.org \
--cc=sw0312.kim@samsung.com \
--cc=tristan@talencesecurity.com \
/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®