Skip to content

Commit c8ca1aa

Browse files
author
Paul E. McKenney
committed
srcu: Check for invalid idx argument in srcu_read_unlock()
The current SRCU implementation has an idx argument of zero or one, and never anything else. This commit therefore adds a WARN_ON_ONCE() to complain if this restriction is violated. Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
1 parent 7a968bb commit c8ca1aa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/linux/srcu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ srcu_read_lock_notrace(struct srcu_struct *ssp) __acquires(ssp)
223223
static inline void srcu_read_unlock(struct srcu_struct *ssp, int idx)
224224
__releases(ssp)
225225
{
226+
WARN_ON_ONCE(idx & ~0x1);
226227
rcu_lock_release(&(ssp)->dep_map);
227228
__srcu_read_unlock(ssp, idx);
228229
}

0 commit comments

Comments
 (0)