From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Myeonghun Pak <mhun512@gmail.com>, Ijae Kim <ae878000@gmail.com>,
Joshua Crofts <joshua.crofts1@gmail.com>,
Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/2] iio: proximity: hx9023s: Allocate trigger before requesting IRQ
Date: Thu, 26 Nov 2026 12:10:07 -0500 [thread overview]
Message-ID: <20261126171001.2690575-2-sashal@kernel.org> (raw)
In-Reply-To: <20261126171001.2690575-1-sashal@kernel.org>
From: Myeonghun Pak <mhun512@gmail.com>
[ Upstream commit bfa3b177d839bb303d0187335115b572a2644920 ]
An IRQ handler that already read trigger_enabled can poll data->trig
after buffer disable. Detaching the virtual IRQ does not join this
physical IRQ, and trigger deselection can drop the consumer reference.
Devres may then free the trigger before joining the handler.
Allocate the trigger before requesting the IRQ so devres joins the
handler before dropping the allocation reference.
This issue was identified as part of our ongoing research while
reviewing kernel code.
Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iio/proximity/hx9023s.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 8488b9a751f2c..1fba29265bfd5 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -1131,14 +1131,6 @@ static int hx9023s_probe(struct i2c_client *client)
return dev_err_probe(dev, ret, "reg config failed\n");
if (client->irq) {
- ret = devm_request_threaded_irq(dev, client->irq,
- hx9023s_irq_handler,
- hx9023s_irq_thread_handler,
- IRQF_ONESHOT,
- "hx9023s_event", indio_dev);
- if (ret)
- return ret;
-
data->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
indio_dev->name,
iio_device_id(indio_dev));
@@ -1148,6 +1140,14 @@ static int hx9023s_probe(struct i2c_client *client)
data->trig->ops = &hx9023s_trigger_ops;
iio_trigger_set_drvdata(data->trig, indio_dev);
+ ret = devm_request_threaded_irq(dev, client->irq,
+ hx9023s_irq_handler,
+ hx9023s_irq_thread_handler,
+ IRQF_ONESHOT,
+ "hx9023s_event", indio_dev);
+ if (ret)
+ return ret;
+
ret = devm_iio_trigger_register(dev, data->trig);
if (ret)
return dev_err_probe(dev, ret,
--
2.53.0
prev parent reply other threads:[~2026-11-26 17:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 12:44 FAILED: patch "[PATCH] iio: proximity: hx9023s: Allocate trigger before requesting" failed to apply to 6.18-stable tree gregkh
2026-11-26 17:10 ` [PATCH 6.18.y 1/2] iio: proximity: Remove redundant dev_err()/dev_err_probe() Sasha Levin
2026-11-26 17:10 ` Sasha Levin [this message]
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=20261126171001.2690575-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=ae878000@gmail.com \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=joshua.crofts1@gmail.com \
--cc=mhun512@gmail.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