[patch 2/5] mips: Validate online cpus in irq_set_affinity() callbacks

From: Thomas Gleixner
Date: Tue Mar 04 2014 - 15:46:25 EST


The [user space] interface does not filter out offline cpus. It merily
guarantees that the mask contains at least one online cpu.

So the selector in the irq chip implementation needs to make sure to
pick only an online cpu because otherwise:

Offline Core 1
Set affinity to 0xe (is valid due to online mask 0xd)
cpumask_first will pick core 1, which is offline

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: linux-mips@xxxxxxxxxxxxxx
---
arch/mips/sibyte/bcm1480/irq.c | 2 +-
arch/mips/sibyte/sb1250/irq.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

Index: tip/arch/mips/sibyte/bcm1480/irq.c
===================================================================
--- tip.orig/arch/mips/sibyte/bcm1480/irq.c
+++ tip/arch/mips/sibyte/bcm1480/irq.c
@@ -95,7 +95,7 @@ static int bcm1480_set_affinity(struct i
u64 cur_ints;
unsigned long flags;

- i = cpumask_first(mask);
+ i = cpumask_first_and(mask< cpu_online_mask);

/* Convert logical CPU to physical CPU */
cpu = cpu_logical_map(i);
Index: tip/arch/mips/sibyte/sb1250/irq.c
===================================================================
--- tip.orig/arch/mips/sibyte/sb1250/irq.c
+++ tip/arch/mips/sibyte/sb1250/irq.c
@@ -88,7 +88,7 @@ static int sb1250_set_affinity(struct ir
u64 cur_ints;
unsigned long flags;

- i = cpumask_first(mask);
+ i = cpumask_first_and(mask< cpu_online_mask);

/* Convert logical CPU to physical CPU */
cpu = cpu_logical_map(i);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/