From: sashiko-bot@kernel.org
To: "Jorijn van der Graaf" <jorijnvdgraaf@catcrafts.net>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61
Date: Mon, 10 Aug 2026 11:28:12 +0000 [thread overview]
Message-ID: <20260810112812.E39C71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260810110423.41697-4-jorijnvdgraaf@catcrafts.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The IIO device is unregistered before the threaded IRQ handler is freed, creating a Use-After-Free race condition during device removal.
--
--- Patch [3]: [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61 ---
commit c621ace8607632002893d3b296ea6bb5b3e8c5f1
Author: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
iio: light: stk3310: support the Sensortek STK36C61
This commit adds support for the Sensortek STK36C61 ambient light,
proximity, and RGB color sensor to the stk3310 driver. It introduces the
new chip ID, registers, and intensity channels for color data.
> diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> index 17b1ff42bf6e1..289900aeafa78 100644
> --- a/drivers/iio/light/stk3310.c
> +++ b/drivers/iio/light/stk3310.c
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential
use-after-free race during device removal in this driver.
In stk3310_remove(), the IIO device is unregistered before the devm-managed
threaded IRQ handler is freed:
drivers/iio/light/stk3310.c:stk3310_remove() {
struct iio_dev *indio_dev = i2c_get_clientdata(client);
iio_device_unregister(indio_dev);
stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
}
Since the interrupt is requested with devm_request_threaded_irq() in
stk3310_probe(), it remains active until after stk3310_remove() returns.
If an interrupt fires during or immediately after iio_device_unregister(),
the IRQ handler can call iio_push_event().
Because iio_device_unregister() frees the event interface, could this result
in a use-after-free when the active IRQ handler writes to the freed memory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260810110423.41697-1-jorijnvdgraaf@catcrafts.net?part=3
prev parent reply other threads:[~2026-08-10 11:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 11:04 [PATCH 0/3] iio: light: stk3310: per-chip match data and STK36C61 support Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 1/3] dt-bindings: iio: light: stk33xx: document the Sensortek STK36C61 Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 2/3] iio: light: stk3310: add per-chip match data Jorijn van der Graaf
2026-08-10 11:04 ` [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61 Jorijn van der Graaf
2026-08-10 11:28 ` sashiko-bot [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=20260810112812.E39C71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jorijnvdgraaf@catcrafts.net \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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