From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 6/7] hwmon: (sht15) Remove redundant dev_err()
Date: Mon, 20 Jul 2026 06:47:32 +0000 [thread overview]
Message-ID: <20260720064732.7A7E81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260720063745.309331-7-panchuang@vivo.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Race window during probe leads to permanently disabled IRQ and broken device measurements.
- [High] Missing cancellation of pending workqueues on probe failure and device removal leads to Use-After-Free.
--
--- Patch [6]: [PATCH v2 6/7] hwmon: (sht15) Remove redundant dev_err() ---
commit 47aa96341071db3373308927505b18391833a75b
Author: Pan Chuang <panchuang@vivo.com>
hwmon: (sht15) Remove redundant dev_err()
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs detailed
error messages on failure. Remove the now-redundant driver-specific
dev_err() call.
> diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
> index 101cebbe68e4d..7bb2105d1ae22 100644
> --- a/drivers/hwmon/sht15.c
> +++ b/drivers/hwmon/sht15.c
> @@ -981,10 +981,8 @@ static int sht15_probe(struct platform_device *pdev)
> IRQF_TRIGGER_FALLING,
> "sht15 data",
> data);
> - if (ret) {
> - dev_err(&pdev->dev, "failed to get irq for data line\n");
> + if (ret)
> goto err_release_reg;
[Severity: High]
This is a pre-existing issue, but does the err_release_reg error path fail
to cancel pending workqueues, potentially leading to a use-after-free?
If initialization fails here and the code jumps to err_release_reg:
sht15_probe() {
...
err_release_reg:
if (!IS_ERR(data->reg)) {
regulator_unregister_notifier(data->reg, &data->nb);
regulator_disable(data->reg);
}
return ret;
}
The update_supply_work workqueue is not cancelled via cancel_work_sync().
Because the data struct is allocated with devm_kzalloc(), devres will free
it immediately when the probe fails. If the regulator notifier scheduled
update_supply_work just before the probe failed, will the pending work
execute and dereference the freed data pointer?
A similar issue appears to exist in sht15_remove(), where both read_work
and update_supply_work are left uncancelled before returning.
> - }
> disable_irq_nosync(gpiod_to_irq(data->data));
[Severity: High]
This isn't a bug introduced by this patch, but is there a race window here
that could leave the IRQ permanently disabled?
Since devm_request_irq() is called without IRQF_NO_AUTOEN, the interrupt is
enabled immediately. If a falling edge occurs on the data line before the
disable_irq_nosync() call, sht15_interrupt_fired() will execute and call
disable_irq_nosync(), setting the IRQ disable depth to 1.
When sht15_probe() resumes, it will call disable_irq_nosync() again,
incrementing the disable depth to 2. Later, when a measurement starts,
enable_irq() only decrements the depth to 1. Could this cause the interrupt
to remain masked in hardware forever, breaking the driver?
> ret = sht15_connection_reset(data);
> if (ret)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720063745.309331-1-panchuang@vivo.com?part=6
next prev parent reply other threads:[~2026-07-20 6:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 6:37 [PATCH v2 0/7] hwmon: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-20 6:37 ` [PATCH v2 1/7] hwmon: (axi-fan-control) Remove redundant dev_err_probe() Pan Chuang
2026-07-20 6:47 ` sashiko-bot
2026-07-20 14:32 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 2/7] hwmon: (da9055) Remove redundant dev_err() Pan Chuang
2026-07-20 6:40 ` sashiko-bot
2026-07-20 14:33 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 3/7] hwmon: (lm90) " Pan Chuang
2026-07-20 6:42 ` sashiko-bot
2026-07-20 14:33 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 4/7] hwmon: (npcm750-pwm-fan) " Pan Chuang
2026-07-20 6:52 ` sashiko-bot
2026-07-20 14:34 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 5/7] hwmon: (pwm-fan) " Pan Chuang
2026-07-20 6:45 ` sashiko-bot
2026-07-20 14:35 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 6/7] hwmon: (sht15) " Pan Chuang
2026-07-20 6:47 ` sashiko-bot [this message]
2026-07-20 14:35 ` Guenter Roeck
2026-07-20 6:37 ` [PATCH v2 7/7] hwmon: (pmbus) " Pan Chuang
2026-07-20 6:43 ` sashiko-bot
2026-07-20 14:36 ` Guenter Roeck
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=20260720064732.7A7E81F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--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