From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, petri.latvala@intel.com,
linux-kernel@vger.kernel.org, byungchul.park@lge.com,
tglx@linutronix.de, frederic@kernel.org, peterz@infradead.org,
mingo@kernel.org
Subject: [tip:irq/core] irq/work: Use llist_for_each_entry_safe
Date: Sun, 12 Nov 2017 04:24:15 -0800 [thread overview]
Message-ID: <tip-d00a08cf9ee986ad6689ce8c6fd176aff679c106@git.kernel.org> (raw)
In-Reply-To: <151027307351.14762.4611888896020658384@mail.alporthouse.com>
Commit-ID: d00a08cf9ee986ad6689ce8c6fd176aff679c106
Gitweb: https://git.kernel.org/tip/d00a08cf9ee986ad6689ce8c6fd176aff679c106
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 12 Nov 2017 13:02:51 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 12 Nov 2017 13:15:14 +0100
irq/work: Use llist_for_each_entry_safe
The llist_for_each_entry() loop in irq_work_run_list() is unsafe because
once the works PENDING bit is cleared it can be requeued on another CPU.
Use llist_for_each_entry_safe() instead.
Fixes: 16c0890dc66d ("irq/work: Don't reinvent the wheel but use existing llist API")
Reported-by:Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Byungchul Park <byungchul.park@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petri Latvala <petri.latvala@intel.com>
Link: http://lkml.kernel.org/r/151027307351.14762.4611888896020658384@mail.alporthouse.com
---
kernel/irq_work.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index e2ebe8c..6647b33f 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -128,9 +128,9 @@ bool irq_work_needs_cpu(void)
static void irq_work_run_list(struct llist_head *list)
{
- unsigned long flags;
- struct irq_work *work;
+ struct irq_work *work, *tmp;
struct llist_node *llnode;
+ unsigned long flags;
BUG_ON(!irqs_disabled());
@@ -138,7 +138,7 @@ static void irq_work_run_list(struct llist_head *list)
return;
llnode = llist_del_all(list);
- llist_for_each_entry(work, llnode, llnode) {
+ llist_for_each_entry_safe(work, tmp, llnode, llnode) {
/*
* Clear the PENDING bit, after this point the @work
* can be re-used.
prev parent reply other threads:[~2017-11-12 12:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 1:46 [PATCH] irq_work: Don't reinvent the wheel but use existing llist API Frederic Weisbecker
2017-10-31 12:04 ` [tip:irq/core] irq/work: " tip-bot for Byungchul Park
2017-11-10 0:17 ` [PATCH] irq_work: " Chris Wilson
2017-11-12 12:24 ` tip-bot for Thomas Gleixner [this message]
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=tip-d00a08cf9ee986ad6689ce8c6fd176aff679c106@git.kernel.org \
--to=tipbot@zytor.com \
--cc=byungchul.park@lge.com \
--cc=frederic@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=petri.latvala@intel.com \
--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