From: sashiko-bot@kernel.org
To: "Caleb James DeLisle" <cjd@cjdns.fr>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 3/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered
Date: Thu, 15 Oct 2026 17:06:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-173237@kernel.org> (raw)
In-Reply-To: <20261015165404.519741-4-cjd@cjdns.fr>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] timers: NULL pointer dereference of dev->cpumask in early spurious interrupt
--
commit be0c6a6a32c2acd59113d1e62f6e59c3c3a35579
Author: Caleb James DeLisle <cjd@cjdns.fr>
clocksource/timer-econet-en751221: Disable IRQ until cevt registered
Eliminate a race condition where cevt_interrupt may trigger before
clockevents_config_and_register has been called, and dev->event_handler
is at that point NULL. Additionally, NULL check dev->event_handler in
interrupt callback just in case clockevents_config_and_register failed.
> diff --git a/drivers/clocksource/timer-econet-en751221.c b/drivers/clocksource/timer-econet-en751221.c
> index 714702b9ef128..f2c4c1ee0a56b 100644
> --- a/drivers/clocksource/timer-econet-en751221.c
> +++ b/drivers/clocksource/timer-econet-en751221.c
> @@ -75,7 +75,10 @@ static irqreturn_t cevt_interrupt(int irq, void *dev_id)
> return IRQ_NONE;
>
> iowrite32(ioread32(reg_count(cpu)), reg_compare(cpu));
> - dev->event_handler(dev);
> +
> + if (dev->event_handler)
> + dev->event_handler(dev);
> +
> return IRQ_HANDLED;
> }
[Severity: High]
Does this code still have a NULL pointer dereference earlier in the
function?
If a spurious or bootloader-pending interrupt fires immediately after
request_percpu_irq() is called in timer_init(), the generic IRQ layer
(handle_percpu_devid_irq) bypasses irq_can_handle_actions() checks for
percpu interrupts and invokes cevt_interrupt() unconditionally.
This would lead to a NULL pointer dereference when cevt_interrupt()
attempts to read dev->cpumask:
cevt_interrupt() {
struct clock_event_device *dev = this_cpu_ptr(&econet_timer_pcpu);
int cpu = cpumask_first(dev->cpumask);
...
Since cevt_init() has not yet run to initialize the timer state,
dev->cpumask remains NULL. This could cause cpumask_first() to crash
before it ever reaches the new dev->event_handler check.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261015165404.519741-1-cjd@cjdns.fr?part=3
next prev parent reply other threads:[~2026-10-15 17:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 16:53 [PATCH v11 0/5] clocksource/timer-econet-en751221: Support irq number per timer Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 1/5] dt-bindings: timer: econet: Update EN751627 for multi-IRQ Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 2/5] clocksource/timer-econet-en751221: Init teardown on error if possible Caleb James DeLisle
2026-10-15 16:54 ` [PATCH v11 3/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Caleb James DeLisle
2026-10-15 17:06 ` sashiko-bot [this message]
2026-10-15 16:54 ` [PATCH v11 4/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Caleb James DeLisle
2026-10-15 17:05 ` sashiko-bot
2026-10-15 16:54 ` [PATCH v11 5/5] clocksource/timer-econet-en751221: Do not use NR_CPUS for resource array size Caleb James DeLisle
2026-10-15 17:07 ` sashiko-bot
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=sashiko-outbox-173237@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cjd@cjdns.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--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