From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 05/18] thermal/drivers/imx: Remove redundant dev_err()
Date: Thu, 09 Jul 2026 02:55:52 +0000 [thread overview]
Message-ID: <20260709025553.046E31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709023048.599150-6-panchuang@vivo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The thermal zone device `data->tz` is dereferenced after it is freed if the temperature alarm interrupt fires during module removal.
--
--- Patch [5]: [PATCH 05/18] thermal/drivers/imx: Remove redundant dev_err() ---
commit 27d7703d9347749240647995387a1e21fab7887b
Author: Pan Chuang <panchuang@vivo.com>
thermal/drivers/imx: Remove redundant dev_err()
The devm_request_threaded_irq() now automatically logs detailed error
messages on failure. This eliminates the need for driver-specific
dev_err() calls that previously printed generic messages.
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index 5aaacbc534786..416d89c6287ad 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -732,10 +732,8 @@ static int imx_thermal_probe(struct platform_device *pdev)
> ret = devm_request_threaded_irq(dev, data->irq,
> imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
> 0, "imx_thermal", data);
> - if (ret < 0) {
> - dev_err(dev, "failed to request alarm irq: %d\n", ret);
> + if (ret < 0)
> goto thermal_zone_unregister;
[Severity: High]
This is a pre-existing issue, but could this lead to a use-after-free if the
temperature alarm interrupt fires during module removal?
Because the alarm IRQ is requested using devm_request_threaded_irq(), its
lifetime is tied to the device unbind phase via devres, meaning it is only
freed after the remove function finishes. However, in imx_thermal_remove(),
the thermal zone device is unregistered and freed:
drivers/thermal/imx_thermal.c:imx_thermal_remove() {
...
thermal_zone_device_unregister(data->tz);
...
}
Since the devm resources are cleaned up only after remove() returns, the IRQ
remains active while and after data->tz is freed. If the interrupt fires
during this window, wouldn't the threaded handler dereference the freed
data->tz?
drivers/thermal/imx_thermal.c:imx_thermal_alarm_irq_thread() {
...
thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED);
...
}
> - }
>
> pm_runtime_put(data->dev);
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709023048.599150-1-panchuang@vivo.com?part=5
next prev parent reply other threads:[~2026-07-09 2:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 2:30 [PATCH 00/18] thermal/drivers: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-09 2:30 ` [PATCH 05/18] thermal/drivers/imx: Remove redundant dev_err() Pan Chuang
2026-07-09 2:55 ` sashiko-bot [this message]
2026-07-09 3:38 ` Frank Li
2026-07-09 2:30 ` [PATCH 18/18] thermal/drivers/imx91: Remove redundant dev_err_probe() Pan Chuang
2026-07-09 3:00 ` sashiko-bot
2026-07-09 3:38 ` Frank Li
2026-07-09 7:09 ` [PATCH 00/18] thermal/drivers: Remove redundant error messages on IRQ request failure Krzysztof Kozlowski
2026-07-09 7:24 ` Wolfram Sang
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=20260709025553.046E31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=panchuang@vivo.com \
--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