net_ns: add __rcu annotations
add __rcu annotation to (struct net)->gen, and use rcu_dereference_protected() in net_assign_generic() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6e3f7faf3e
commit
1c87733d06
2 changed files with 4 additions and 2 deletions
|
@ -88,7 +88,7 @@ struct net {
|
||||||
#ifdef CONFIG_WEXT_CORE
|
#ifdef CONFIG_WEXT_CORE
|
||||||
struct sk_buff_head wext_nlevents;
|
struct sk_buff_head wext_nlevents;
|
||||||
#endif
|
#endif
|
||||||
struct net_generic *gen;
|
struct net_generic __rcu *gen;
|
||||||
|
|
||||||
/* Note : following structs are cache line aligned */
|
/* Note : following structs are cache line aligned */
|
||||||
#ifdef CONFIG_XFRM
|
#ifdef CONFIG_XFRM
|
||||||
|
|
|
@ -42,7 +42,9 @@ static int net_assign_generic(struct net *net, int id, void *data)
|
||||||
BUG_ON(!mutex_is_locked(&net_mutex));
|
BUG_ON(!mutex_is_locked(&net_mutex));
|
||||||
BUG_ON(id == 0);
|
BUG_ON(id == 0);
|
||||||
|
|
||||||
ng = old_ng = net->gen;
|
old_ng = rcu_dereference_protected(net->gen,
|
||||||
|
lockdep_is_held(&net_mutex));
|
||||||
|
ng = old_ng;
|
||||||
if (old_ng->len >= id)
|
if (old_ng->len >= id)
|
||||||
goto assign;
|
goto assign;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue