diff options
-rw-r--r-- | net/ipv4/devinet.c | 5 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 84bed40273ad..25c8a42965df 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -165,9 +165,8 @@ struct in_device *inetdev_init(struct net_device *dev) | |||
165 | NET_IPV4_NEIGH, "ipv4", NULL, NULL); | 165 | NET_IPV4_NEIGH, "ipv4", NULL, NULL); |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | /* Account for reference dev->ip_ptr */ | 168 | /* Account for reference dev->ip_ptr (below) */ |
169 | in_dev_hold(in_dev); | 169 | in_dev_hold(in_dev); |
170 | rcu_assign_pointer(dev->ip_ptr, in_dev); | ||
171 | 170 | ||
172 | #ifdef CONFIG_SYSCTL | 171 | #ifdef CONFIG_SYSCTL |
173 | devinet_sysctl_register(in_dev, &in_dev->cnf); | 172 | devinet_sysctl_register(in_dev, &in_dev->cnf); |
@@ -176,6 +175,8 @@ struct in_device *inetdev_init(struct net_device *dev) | |||
176 | if (dev->flags & IFF_UP) | 175 | if (dev->flags & IFF_UP) |
177 | ip_mc_up(in_dev); | 176 | ip_mc_up(in_dev); |
178 | out: | 177 | out: |
178 | /* we can receive as soon as ip_ptr is set -- do this last */ | ||
179 | rcu_assign_pointer(dev->ip_ptr, in_dev); | ||
179 | return in_dev; | 180 | return in_dev; |
180 | out_kfree: | 181 | out_kfree: |
181 | kfree(in_dev); | 182 | kfree(in_dev); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 9b0a90643151..171e5b55d7d6 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -413,8 +413,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
413 | if (netif_carrier_ok(dev)) | 413 | if (netif_carrier_ok(dev)) |
414 | ndev->if_flags |= IF_READY; | 414 | ndev->if_flags |= IF_READY; |
415 | 415 | ||
416 | /* protected by rtnl_lock */ | ||
417 | rcu_assign_pointer(dev->ip6_ptr, ndev); | ||
418 | 416 | ||
419 | ipv6_mc_init_dev(ndev); | 417 | ipv6_mc_init_dev(ndev); |
420 | ndev->tstamp = jiffies; | 418 | ndev->tstamp = jiffies; |
@@ -425,6 +423,8 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
425 | NULL); | 423 | NULL); |
426 | addrconf_sysctl_register(ndev, &ndev->cnf); | 424 | addrconf_sysctl_register(ndev, &ndev->cnf); |
427 | #endif | 425 | #endif |
426 | /* protected by rtnl_lock */ | ||
427 | rcu_assign_pointer(dev->ip6_ptr, ndev); | ||
428 | return ndev; | 428 | return ndev; |
429 | } | 429 | } |
430 | 430 | ||