summaryrefslogtreecommitdiff
path: root/include/linux/rculist.h
diff options
context:
space:
mode:
authorAmol Grover <frextrite@gmail.com>2020-01-18 22:24:18 +0530
committerPaul E. McKenney <paulmck@kernel.org>2020-02-20 15:58:23 -0800
commit4dfd5cd83dc4458049c7f6eb9c4f361acc4239ea (patch)
tree77997758f8b5f1d2a6615c69428ab57d74738040 /include/linux/rculist.h
parentaa24f93753e256c4b14fe46f7261f150cff2a50c (diff)
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@gmail.com> Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'include/linux/rculist.h')
-rw-r--r--include/linux/rculist.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 9f313e4999fe..8214cdc715f2 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); })