linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-4.8] irq/affinity: use get/put_online_cpus
@ 2016-08-11 14:06 Christoph Hellwig
  2016-08-14 16:00 ` Christoph Hellwig
  2016-08-22  9:28 ` [tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around cpumask operations tip-bot for Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2016-08-11 14:06 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 kernel/irq/affinity.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index f689593..32f6cfc 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)
 		return NULL;
 	}
 
+	get_online_cpus();
 	if (max_vecs >= num_online_cpus()) {
 		cpumask_copy(affinity_mask, cpu_online_mask);
 		*nr_vecs = num_online_cpus();
@@ -56,6 +57,7 @@ struct cpumask *irq_create_affinity_mask(unsigned int *nr_vecs)
 		}
 		*nr_vecs = vecs;
 	}
+	put_online_cpus();
 
 	return affinity_mask;
 }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-22  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 14:06 [PATCH for-4.8] irq/affinity: use get/put_online_cpus Christoph Hellwig
2016-08-14 16:00 ` Christoph Hellwig
2016-08-22  9:01   ` Thomas Gleixner
2016-08-22  9:28 ` [tip:irq/urgent] genirq/affinity: Use get/put_online_cpus around cpumask operations tip-bot for Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).