Skip to content

Commit

Permalink
net: add rtnl_dereference()
Browse files Browse the repository at this point in the history
We sometime want to dereference an rcu protected pointer while
holding RTNL. Use a macro to hide all lockdep details.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 16, 2010
1 parent e0de7c9 commit 7dff59e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/linux/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,15 @@ extern int lockdep_rtnl_is_held(void);
rcu_dereference_check(p, rcu_read_lock_held() || \
lockdep_rtnl_is_held())

/**
* rtnl_dereference - rcu_dereference with debug checking
* @p: The pointer to read, prior to dereferencing
*
* Do an rcu_dereference(p), but check caller holds RTNL
*/
#define rtnl_dereference(p) \
rcu_dereference_check(p, lockdep_rtnl_is_held())

extern void rtnetlink_init(void);
extern void __rtnl_unlock(void);

Expand Down

0 comments on commit 7dff59e

Please sign in to comment.