aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-06 15:30:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-06 15:30:19 -0500
commitabb359450f20c32ae03039d8736f12b1d561caf5 (patch)
tree6e8723885feb66a138f19f0ff31615dc13a8d859 /net/socket.c
parentcb600d2f83c854ec3d6660063e4466431999489b (diff)
parent4e3dbdb1392a83bd21a6ff8f6bc785495058d37c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1436 commits) cassini: Use local-mac-address prom property for Cassini MAC address net: remove the duplicate #ifdef __KERNEL__ net: bridge: check the length of skb after nf_bridge_maybe_copy_header() netconsole: clarify stopping message netconsole: don't announce stopping if nothing happened cnic: Fix the type field in SPQ messages netfilter: fix export secctx error handling netfilter: fix the race when initializing nf_ct_expect_hash_rnd ipv4: IP defragmentation must be ECN aware net: r6040: Return proper error for r6040_init_one dcb: use after free in dcb_flushapp() dcb: unlock on error in dcbnl_ieee_get() net: ixp4xx_eth: Return proper error for eth_init_one include/linux/if_ether.h: Add #define ETH_P_LINK_CTL for HPNA and wlan local tunnel net: add POLLPRI to sock_def_readable() af_unix: Avoid socket->sk NULL OOPS in stream connect security hooks. net_sched: pfifo_head_drop problem mac80211: remove stray extern mac80211: implement off-channel TX using hw r-o-c offload mac80211: implement hardware offload for remain-on-channel ...
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/socket.c b/net/socket.c
index 088fb3fd45e0..c1663c0ff3d3 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -156,7 +156,7 @@ static const struct file_operations socket_file_ops = {
156 */ 156 */
157 157
158static DEFINE_SPINLOCK(net_family_lock); 158static DEFINE_SPINLOCK(net_family_lock);
159static const struct net_proto_family *net_families[NPROTO] __read_mostly; 159static const struct net_proto_family __rcu *net_families[NPROTO] __read_mostly;
160 160
161/* 161/*
162 * Statistics counters of the socket lists 162 * Statistics counters of the socket lists
@@ -1215,7 +1215,7 @@ int __sock_create(struct net *net, int family, int type, int protocol,
1215 * requested real, full-featured networking support upon configuration. 1215 * requested real, full-featured networking support upon configuration.
1216 * Otherwise module support will break! 1216 * Otherwise module support will break!
1217 */ 1217 */
1218 if (net_families[family] == NULL) 1218 if (rcu_access_pointer(net_families[family]) == NULL)
1219 request_module("net-pf-%d", family); 1219 request_module("net-pf-%d", family);
1220#endif 1220#endif
1221 1221
@@ -2347,10 +2347,11 @@ int sock_register(const struct net_proto_family *ops)
2347 } 2347 }
2348 2348
2349 spin_lock(&net_family_lock); 2349 spin_lock(&net_family_lock);
2350 if (net_families[ops->family]) 2350 if (rcu_dereference_protected(net_families[ops->family],
2351 lockdep_is_held(&net_family_lock)))
2351 err = -EEXIST; 2352 err = -EEXIST;
2352 else { 2353 else {
2353 net_families[ops->family] = ops; 2354 rcu_assign_pointer(net_families[ops->family], ops);
2354 err = 0; 2355 err = 0;
2355 } 2356 }
2356 spin_unlock(&net_family_lock); 2357 spin_unlock(&net_family_lock);
@@ -2378,7 +2379,7 @@ void sock_unregister(int family)
2378 BUG_ON(family < 0 || family >= NPROTO); 2379 BUG_ON(family < 0 || family >= NPROTO);
2379 2380
2380 spin_lock(&net_family_lock); 2381 spin_lock(&net_family_lock);
2381 net_families[family] = NULL; 2382 rcu_assign_pointer(net_families[family], NULL);
2382 spin_unlock(&net_family_lock); 2383 spin_unlock(&net_family_lock);
2383 2384
2384 synchronize_rcu(); 2385 synchronize_rcu();