diff options
author | David L Stevens <dlstevens@us.ibm.com> | 2007-01-06 01:06:28 +0100 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2007-01-09 03:23:31 +0100 |
commit | 30f1962cb4491cfaabcd98715535f4bd7eba4307 (patch) | |
tree | dc89f681c2da9677826b89ad4acc8a7e489fa45b /net/ipv4 | |
parent | f6fce1f36022c103af046c5548c4eedb7f1c2f4e (diff) | |
download | lwn-30f1962cb4491cfaabcd98715535f4bd7eba4307.tar.gz lwn-30f1962cb4491cfaabcd98715535f4bd7eba4307.zip |
[IPV4/IPV6]: Fix inet{,6} device initialization order.
It is important that we only assign dev->ip{,6}_ptr
only after all portions of the inet{,6} are setup.
Otherwise we can receive packets before the multicast
spinlocks et al. are initialized.
Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/devinet.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 3ffa60dadc0c..73a62007e36e 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -158,9 +158,8 @@ struct in_device *inetdev_init(struct net_device *dev) NET_IPV4_NEIGH, "ipv4", NULL, NULL); #endif - /* Account for reference dev->ip_ptr */ + /* Account for reference dev->ip_ptr (below) */ in_dev_hold(in_dev); - rcu_assign_pointer(dev->ip_ptr, in_dev); #ifdef CONFIG_SYSCTL devinet_sysctl_register(in_dev, &in_dev->cnf); @@ -169,6 +168,8 @@ struct in_device *inetdev_init(struct net_device *dev) if (dev->flags & IFF_UP) ip_mc_up(in_dev); out: + /* we can receive as soon as ip_ptr is set -- do this last */ + rcu_assign_pointer(dev->ip_ptr, in_dev); return in_dev; out_kfree: kfree(in_dev); |