diff options
-rw-r--r-- | include/net/net_namespace.h | 2 | ||||
-rw-r--r-- | net/core/net_namespace.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 65af9a07cf76..1bf812b21fb7 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -88,7 +88,7 @@ struct net { | |||
88 | #ifdef CONFIG_WEXT_CORE | 88 | #ifdef CONFIG_WEXT_CORE |
89 | struct sk_buff_head wext_nlevents; | 89 | struct sk_buff_head wext_nlevents; |
90 | #endif | 90 | #endif |
91 | struct net_generic *gen; | 91 | struct net_generic __rcu *gen; |
92 | 92 | ||
93 | /* Note : following structs are cache line aligned */ | 93 | /* Note : following structs are cache line aligned */ |
94 | #ifdef CONFIG_XFRM | 94 | #ifdef CONFIG_XFRM |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index c988e685433a..3f860261c5ee 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -42,7 +42,9 @@ static int net_assign_generic(struct net *net, int id, void *data) | |||
42 | BUG_ON(!mutex_is_locked(&net_mutex)); | 42 | BUG_ON(!mutex_is_locked(&net_mutex)); |
43 | BUG_ON(id == 0); | 43 | BUG_ON(id == 0); |
44 | 44 | ||
45 | ng = old_ng = net->gen; | 45 | old_ng = rcu_dereference_protected(net->gen, |
46 | lockdep_is_held(&net_mutex)); | ||
47 | ng = old_ng; | ||
46 | if (old_ng->len >= id) | 48 | if (old_ng->len >= id) |
47 | goto assign; | 49 | goto assign; |
48 | 50 | ||