ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] clocksource: Remove redundant dev_err()/dev_err_probe()
Date: Mon, 13 Jul 2026 13:17:53 +0000	[thread overview]
Message-ID: <20260713131754.4B8871F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260713130740.293502-1-panchuang@vivo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] If `devm_request_irq()` fails, the driver exits with an error without unregistering the clockevent device, leaving a dangling pointer in the global clockevents subsystem which leads to a use-after-free.
--

--- Patch [1]: [PATCH] clocksource: Remove redundant dev_err()/dev_err_probe() ---
commit 6abdbb5acc54b54b2834aaea50a1948deb00002c
Author: Pan Chuang <panchuang@vivo.com>

clocksource: Remove redundant dev_err()/dev_err_probe()

This commit removes redundant driver-specific error logging following
devm_request_irq(), since the core function now automatically logs detailed
error messages on failure.

[ ... ]

> diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c
> index 6ab300d226215..bcf155fb9cac2 100644
> --- a/drivers/clocksource/timer-sun5i.c
> +++ b/drivers/clocksource/timer-sun5i.c
> @@ -247,10 +247,8 @@ static int sun5i_setup_clockevent(struct platform_device *pdev,
>  	ret = devm_request_irq(dev, irq, sun5i_timer_interrupt,
>  			       IRQF_TIMER | IRQF_IRQPOLL,
>  			       "sun5i_timer0", ce);
> -	if (ret) {
> -		dev_err(dev, "Unable to register interrupt\n");
> +	if (ret)
>  		return ret;

[Severity: High]
This isn't a bug introduced by this patch, but since we are modifying this
error path, does this return leave a dangling pointer in the clockevents
subsystem?

In sun5i_setup_clockevent(), clockevents_config_and_register() is called
just prior to devm_request_irq() to register the clockevent on the global
list. If the IRQ request fails, the function returns immediately without
unregistering the clockevent device.

Since the struct sun5i_timer is managed by devres, it is freed when the
probe fails, potentially leading to a use-after-free when the clockevents
core evaluates or iterates over its global list.

Should this path unregister the clockevent on failure?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713130740.293502-1-panchuang@vivo.com?part=1

      reply	other threads:[~2026-07-13 13:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 13:07 [PATCH] clocksource: Remove redundant dev_err()/dev_err_probe() Pan Chuang
2026-07-13 13:17 ` 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=20260713131754.4B8871F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sunxi@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