]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen: Validate online cpus in set_affinity
authorThomas Gleixner <tglx@linutronix.de>
Tue, 4 Mar 2014 20:43:40 +0000 (20:43 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 12 Mar 2014 12:07:41 +0000 (13:07 +0100)
The user space interface does not filter out offline cpus. It merily
verifies 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
     Selector will pick first set bit, i.e. core 1

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen <xen-devel@lists.xenproject.org>
Link: http://lkml.kernel.org/r/20140304203100.978031089@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/xen/events/events_base.c

index 8b91c2561b684e6d17be9094f714c93ee10c7009..c3458f58de905efb9eb8ae6a611532abda763f9e 100644 (file)
@@ -1324,7 +1324,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest,
                            bool force)
 {
-       unsigned tcpu = cpumask_first(dest);
+       unsigned tcpu = cpumask_first_and(dest, cpu_online_mask);
 
        return rebind_irq_to_cpu(data->irq, tcpu);
 }