From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751099AbdKLM1o (ORCPT ); Sun, 12 Nov 2017 07:27:44 -0500 Received: from terminus.zytor.com ([65.50.211.136]:52363 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbdKLM1m (ORCPT ); Sun, 12 Nov 2017 07:27:42 -0500 Date: Sun, 12 Nov 2017 04:24:15 -0800 From: tip-bot for Thomas Gleixner Message-ID: 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 Reply-To: mingo@kernel.org, peterz@infradead.org, frederic@kernel.org, tglx@linutronix.de, byungchul.park@lge.com, linux-kernel@vger.kernel.org, petri.latvala@intel.com, hpa@zytor.com In-Reply-To: <151027307351.14762.4611888896020658384@mail.alporthouse.com> References: <151027307351.14762.4611888896020658384@mail.alporthouse.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] irq/work: Use llist_for_each_entry_safe Git-Commit-ID: d00a08cf9ee986ad6689ce8c6fd176aff679c106 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d00a08cf9ee986ad6689ce8c6fd176aff679c106 Gitweb: https://git.kernel.org/tip/d00a08cf9ee986ad6689ce8c6fd176aff679c106 Author: Thomas Gleixner AuthorDate: Sun, 12 Nov 2017 13:02:51 +0100 Committer: Thomas Gleixner 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 Signed-off-by: Thomas Gleixner Cc: Frederic Weisbecker Cc: Byungchul Park Cc: Peter Zijlstra Cc: Petri Latvala 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.