Skip to content

Commit

Permalink
srcu: Check for invalid idx argument in srcu_read_unlock()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul E. McKenney committed Jan 25, 2019
1 parent 7a968bb commit c8ca1aa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/srcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ srcu_read_lock_notrace(struct srcu_struct *ssp) __acquires(ssp)
static inline void srcu_read_unlock(struct srcu_struct *ssp, int idx)
__releases(ssp)
{
WARN_ON_ONCE(idx & ~0x1);
rcu_lock_release(&(ssp)->dep_map);
__srcu_read_unlock(ssp, idx);
}
Expand Down

0 comments on commit c8ca1aa

Please sign in to comment.