All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Ralf Baechle <ralf@linux-mips.org>
Subject: [patch 2/5] mips: Validate online cpus in irq_set_affinity() callbacks
Date: Tue, 04 Mar 2014 20:43:39 -0000	[thread overview]
Message-ID: <20140304203100.744800502@linutronix.de> (raw)
In-Reply-To: 20140304202425.102779779@linutronix.de

[-- Attachment #1: mips-validate-online-cpus-in-irq-set-affinity-callback.patch --]
[-- Type: text/plain, Size: 1521 bytes --]

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@linutronix.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 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);



  parent reply	other threads:[~2014-03-04 20:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 20:43 [patch 0/5] genirq: Sanitize irq_set_affinity callbacks Thomas Gleixner
2014-03-04 20:43 ` [patch 1/5] ia64: Validate online cpus in irq_set_affinity() callbacks Thomas Gleixner
2014-03-04 20:43   ` Thomas Gleixner
2014-03-12 12:15   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-03-12 12:15     ` tip-bot for Thomas Gleixner
2014-03-04 20:43 ` Thomas Gleixner [this message]
2014-03-05 11:20   ` [patch 2/5] mips: " Peter Zijlstra
2014-03-05 14:54     ` Thomas Gleixner
2014-03-12 12:15   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-03-04 20:43 ` [patch 4/5] xen: Validate online cpus in set_affinity Thomas Gleixner
2014-03-04 20:43   ` Thomas Gleixner
2014-03-05 10:36   ` David Vrabel
2014-03-05 10:36   ` David Vrabel
2014-03-12 12:15   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-03-12 12:15   ` tip-bot for Thomas Gleixner
2014-03-04 20:43 ` [patch 3/5] parisc: Validate online cpus in irq_set_affinity() callbacks Thomas Gleixner
2014-03-12 12:16   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2014-03-04 20:43 ` [patch 5/5] irqchip: armanda: Sanitize set_irq_affinity() Thomas Gleixner
2014-03-06 19:05   ` Jason Cooper
2014-03-07 16:02     ` Gregory CLEMENT
2014-03-07 17:17       ` Thomas Gleixner
2014-03-18 14:06         ` Gregory CLEMENT
2014-03-18 20:55           ` Thomas Gleixner
2014-03-18 21:04             ` Gregory CLEMENT
2014-04-24 16:04               ` Gregory CLEMENT
2014-04-25 11:15                 ` Jason Cooper
2014-04-28 19:05                   ` Thomas Gleixner
2014-04-28 19:33   ` [tip:irq/urgent] " tip-bot for Thomas Gleixner

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=20140304203100.744800502@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    /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.