[<prev] [next>] [day] [month] [year] [list]
Message-ID: <158504140839.28353.7116236861803686306.tip-bot2@tip-bot2>
Date: Tue, 24 Mar 2020 09:16:48 -0000
From: "tip-bot2 for Amol Grover" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Amol Grover <frextrite@...il.com>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
"Paul E. McKenney" <paulmck@...nel.org>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: core/rcu] rculist: Add brackets around cond argument in
__list_check_rcu macro
The following commit has been merged into the core/rcu branch of tip:
Commit-ID: 4dfd5cd83dc4458049c7f6eb9c4f361acc4239ea
Gitweb: https://git.kernel.org/tip/4dfd5cd83dc4458049c7f6eb9c4f361acc4239ea
Author: Amol Grover <frextrite@...il.com>
AuthorDate: Sat, 18 Jan 2020 22:24:18 +05:30
Committer: Paul E. McKenney <paulmck@...nel.org>
CommitterDate: Thu, 20 Feb 2020 15:58:23 -08:00
rculist: Add brackets around cond argument in __list_check_rcu macro
Passing a complex lockdep condition to __list_check_rcu results
in false positive lockdep splat due to incorrect expression
evaluation.
For example, a lockdep check condition `cond1 || cond2` is
evaluated as `!cond1 || cond2 && !rcu_read_lock_any_held()`
which, according to operator precedence, evaluates to
`!cond1 || (cond2 && !rcu_read_lock_any_held())`.
This would result in a lockdep splat when cond1 is false
and cond2 is true which is logically incorrect.
Signed-off-by: Amol Grover <frextrite@...il.com>
Acked-by: Joel Fernandes (Google) <joel@...lfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
---
include/linux/rculist.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 9f313e4..8214cdc 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -60,9 +60,9 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
#define __list_check_rcu(dummy, cond, extra...) \
({ \
check_arg_count_one(extra); \
- RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \
+ RCU_LOCKDEP_WARN(!(cond) && !rcu_read_lock_any_held(), \
"RCU-list traversed in non-reader section!"); \
- })
+ })
#else
#define __list_check_rcu(dummy, cond, extra...) \
({ check_arg_count_one(extra); })
Powered by blists - more mailing lists