All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Bhargav Joshi <j.bhargav.u@gmail.com>
Cc: Thomas Gleixner <tglx@kernel.org>,
	Tony Lindgren <tony@atomide.com>,
	Jason Cooper <jason@lakedaemon.net>,
	linux-kernel@vger.kernel.org, goledhruva@gmail.com,
	m-chawdhry@ti.com, daniel.baluta@gmail.com, simona.toaca@nxp.com
Subject: Re: [PATCH RFC] irqchip: crossbar: Fix data race in allocate_gic_irq
Date: Wed, 10 Jun 2026 09:33:04 +0100	[thread overview]
Message-ID: <86a4t2u75r.wl-maz@kernel.org> (raw)
In-Reply-To: <CAOWyW_4qFFaE5vAUA=6L1C+kwZQi_QgifacaYYJgZbq_NZs2BA@mail.gmail.com>

On Wed, 10 Jun 2026 08:20:59 +0100,
Bhargav Joshi <j.bhargav.u@gmail.com> wrote:
> 
> On Wed, Jun 10, 2026 at 12:21 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Tue, 09 Jun 2026 22:00:09 +0100,
> > Bhargav Joshi <j.bhargav.u@gmail.com> wrote:
> > >
> > > In allocate_gic_irq(), if irq_domain_alloc_irqs_parent() fails, the
> > > error path resets cb->irq_map[i] to IRQ_FREE. It modifies cb->irq_map[]
> > > without holding cb->lock. modifying without lock could cause data race.
> > >
> > > Fix this by acquiring raw_spin_lock around cb->irq_map[] modification.
> > >
> > > Fixes: 783d31863fb8 ("irqchip: crossbar: Convert dra7 crossbar to stacked domains")
> > >
> > > Signed-off-by: Bhargav Joshi <j.bhargav.u@gmail.com>
> > > ---
> > > This bug was flagged by the Sashiko AI bot during the review process for
> > > the DT schema conversion of ti,irq-crossbar binding.
> > > https://lore.kernel.org/linux-devicetree/20260605210647.CCC881F00893@smtp.kernel.org/
> > > ---
> > >  drivers/irqchip/irq-crossbar.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
> > > index cd1134101ace..9b809e711009 100644
> > > --- a/drivers/irqchip/irq-crossbar.c
> > > +++ b/drivers/irqchip/irq-crossbar.c
> > > @@ -100,8 +100,11 @@ static int allocate_gic_irq(struct irq_domain *domain, unsigned virq,
> > >       fwspec.param[2] = IRQ_TYPE_LEVEL_HIGH;
> > >
> > >       err = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
> > > -     if (err)
> > > +     if (err) {
> > > +             raw_spin_lock(&cb->lock);
> > >               cb->irq_map[i] = IRQ_FREE;
> > > +             raw_spin_lock(&cb->lock);
> >
> > Really?
> >
> Apologies for the typo, Should I send a v2 with the proper
> raw_spin_unlock(), or do you feel this specific error path doesn't
> warrant the fix?

I don't know what to answer to that question. Surely *you* have done
the necessary analysis before sending a patch, right?

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2026-06-10  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 21:00 [PATCH RFC] irqchip: crossbar: Fix data race in allocate_gic_irq Bhargav Joshi
2026-06-10  6:51 ` Marc Zyngier
2026-06-10  7:20   ` Bhargav Joshi
2026-06-10  8:33     ` Marc Zyngier [this message]
2026-06-10  8:54       ` Bhargav Joshi

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=86a4t2u75r.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=goledhruva@gmail.com \
    --cc=j.bhargav.u@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-chawdhry@ti.com \
    --cc=simona.toaca@nxp.com \
    --cc=tglx@kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.