From: Christoph Hellwig <hch@lst.de>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH for-4.8] irq/affinity: use get/put_online_cpus
Date: Thu, 11 Aug 2016 07:06:45 -0700 [thread overview]
Message-ID: <1470924405-25728-1-git-send-email-hch@lst.de> (raw)
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
next reply other threads:[~2016-08-11 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 14:06 Christoph Hellwig [this message]
2016-08-14 16:00 ` [PATCH for-4.8] irq/affinity: use get/put_online_cpus 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
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=1470924405-25728-1-git-send-email-hch@lst.de \
--to=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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 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).