Commit 3ee0ce2a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Thomas Gleixner

genirq/affinity: Use get/put_online_cpus around cpumask operations

Without locking out CPU mask operations we might end up with an inconsistent
view of the cpumask in the function.

Fixes: 5e385a6e: "genirq: Add a helper to spread an affinity mask for MSI/MSI-X vectors"
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/1470924405-25728-1-git-send-email-hch@lst.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4396f46c
...@@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs) ...@@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
return NULL; return NULL;
} }
get_online_cpus();
if (max_vecs >= num_online_cpus()) { if (max_vecs >= num_online_cpus()) {
cpumask_copy(affinity_mask, cpu_online_mask); cpumask_copy(affinity_mask, cpu_online_mask);
*nr_vecs = num_online_cpus(); *nr_vecs = num_online_cpus();
...@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs) ...@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
} }
*nr_vecs = vecs; *nr_vecs = vecs;
} }
put_online_cpus();
return affinity_mask; return affinity_mask;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment