Re: [PATCH] MIPS: SB1250: Validate and update IRQ affinity

From: Maciej W. Rozycki

Date: Mon Nov 09 2026 - 01:21:31 EST


On Fri, 6 Nov 2026, Maciej W. Rozycki wrote:

> > sb1250_set_affinity() selects the first online CPU in the requested
> > affinity mask without checking whether such a CPU exists. If the
> > intersection is empty, the resulting CPU index is invalid and must
> > not be passed to cpu_logical_map().
> >
> > Reject affinity masks containing no online CPU with -EINVAL before
> > accessing the CPU mapping or interrupt mapper registers.
>
> Why do you think this is needed? The only case where an unvalidated mask
> is passed is AFAICT with:
>
> /**
> * irq_force_affinity - Force the irq affinity of a given irq
> * @irq: Interrupt to set affinity
> * @cpumask: cpumask
> *
> * Same as irq_set_affinity, but without checking the mask against
> * online cpus.
> *
> * Solely for low level cpu hotplug code, where we need to make per
> * cpu interrupts affine before the cpu becomes online.
> */
>
> -- which does not apply here (nor for arch/mips/sibyte/bcm1480/irq.c,
> which uses analogous code and should otherwise be updated accordingly)
> since all the CPUs are onchip the SoC.
>
> Have I missed anything?
>
> > Also update the effective affinity mask to reflect the single logical
> > CPU selected as the interrupt target.
>
> Likewise, why is it needed? This code returns IRQ_SET_MASK_OK (should
> really use the enumeration constant), so the caller will do the copy.

I can see it went to Linus already. Can we please have it reverted?

Maciej