diff options
| author | Christoph Hellwig <hch@lst.de> | 2016-08-11 10:06:45 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2016-08-22 05:22:44 -0400 |
| commit | 3ee0ce2a54dff07d09440723594df89bc1a12e79 (patch) | |
| tree | 68a27c262c9f41cf768856730927e9d8467d111b /kernel/irq | |
| parent | 4396f46c8c628329bd35ee4b84140b8b001a11eb (diff) | |
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: 5e385a6ef31f: "genirq: Add a helper to spread an affinity mask for MSI/MSI-X vectors"
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/1470924405-25728-1-git-send-email-hch@lst.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
| -rw-r--r-- | kernel/irq/affinity.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c index f68959341c0f..32f6cfcff212 100644 --- a/kernel/irq/affinity.c +++ b/kernel/irq/affinity.c | |||
| @@ -39,6 +39,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs) | |||
| 39 | return NULL; | 39 | return NULL; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | get_online_cpus(); | ||
| 42 | if (max_vecs >= num_online_cpus()) { | 43 | if (max_vecs >= num_online_cpus()) { |
| 43 | cpumask_copy(affinity_mask, cpu_online_mask); | 44 | cpumask_copy(affinity_mask, cpu_online_mask); |
| 44 | *nr_vecs = num_online_cpus(); | 45 | *nr_vecs = num_online_cpus(); |
| @@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs) | |||
| 56 | } | 57 | } |
| 57 | *nr_vecs = vecs; | 58 | *nr_vecs = vecs; |
| 58 | } | 59 | } |
| 60 | put_online_cpus(); | ||
| 59 | 61 | ||
| 60 | return affinity_mask; | 62 | return affinity_mask; |
| 61 | } | 63 | } |
