diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/arp.c | 10 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 22 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 4 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 4 | ||||
-rw-r--r-- | net/ipv4/ipmr.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_netbios_ns.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_REDIRECT.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
10 files changed, 32 insertions, 30 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index ec0e36893b01..b425748f02d7 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -241,7 +241,7 @@ static int arp_constructor(struct neighbour *neigh) | |||
241 | neigh->type = inet_addr_type(addr); | 241 | neigh->type = inet_addr_type(addr); |
242 | 242 | ||
243 | rcu_read_lock(); | 243 | rcu_read_lock(); |
244 | in_dev = rcu_dereference(__in_dev_get(dev)); | 244 | in_dev = __in_dev_get_rcu(dev); |
245 | if (in_dev == NULL) { | 245 | if (in_dev == NULL) { |
246 | rcu_read_unlock(); | 246 | rcu_read_unlock(); |
247 | return -EINVAL; | 247 | return -EINVAL; |
@@ -989,8 +989,8 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev) | |||
989 | ipv4_devconf.proxy_arp = 1; | 989 | ipv4_devconf.proxy_arp = 1; |
990 | return 0; | 990 | return 0; |
991 | } | 991 | } |
992 | if (__in_dev_get(dev)) { | 992 | if (__in_dev_get_rtnl(dev)) { |
993 | __in_dev_get(dev)->cnf.proxy_arp = 1; | 993 | __in_dev_get_rtnl(dev)->cnf.proxy_arp = 1; |
994 | return 0; | 994 | return 0; |
995 | } | 995 | } |
996 | return -ENXIO; | 996 | return -ENXIO; |
@@ -1095,8 +1095,8 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev) | |||
1095 | ipv4_devconf.proxy_arp = 0; | 1095 | ipv4_devconf.proxy_arp = 0; |
1096 | return 0; | 1096 | return 0; |
1097 | } | 1097 | } |
1098 | if (__in_dev_get(dev)) { | 1098 | if (__in_dev_get_rtnl(dev)) { |
1099 | __in_dev_get(dev)->cnf.proxy_arp = 0; | 1099 | __in_dev_get_rtnl(dev)->cnf.proxy_arp = 0; |
1100 | return 0; | 1100 | return 0; |
1101 | } | 1101 | } |
1102 | return -ENXIO; | 1102 | return -ENXIO; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index ba2895ae8151..74f2207e131a 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -351,7 +351,7 @@ static int inet_insert_ifa(struct in_ifaddr *ifa) | |||
351 | 351 | ||
352 | static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) | 352 | static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) |
353 | { | 353 | { |
354 | struct in_device *in_dev = __in_dev_get(dev); | 354 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
355 | 355 | ||
356 | ASSERT_RTNL(); | 356 | ASSERT_RTNL(); |
357 | 357 | ||
@@ -449,7 +449,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
449 | goto out; | 449 | goto out; |
450 | 450 | ||
451 | rc = -ENOBUFS; | 451 | rc = -ENOBUFS; |
452 | if ((in_dev = __in_dev_get(dev)) == NULL) { | 452 | if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) { |
453 | in_dev = inetdev_init(dev); | 453 | in_dev = inetdev_init(dev); |
454 | if (!in_dev) | 454 | if (!in_dev) |
455 | goto out; | 455 | goto out; |
@@ -584,7 +584,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg) | |||
584 | if (colon) | 584 | if (colon) |
585 | *colon = ':'; | 585 | *colon = ':'; |
586 | 586 | ||
587 | if ((in_dev = __in_dev_get(dev)) != NULL) { | 587 | if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { |
588 | if (tryaddrmatch) { | 588 | if (tryaddrmatch) { |
589 | /* Matthias Andree */ | 589 | /* Matthias Andree */ |
590 | /* compare label and address (4.4BSD style) */ | 590 | /* compare label and address (4.4BSD style) */ |
@@ -748,7 +748,7 @@ rarok: | |||
748 | 748 | ||
749 | static int inet_gifconf(struct net_device *dev, char __user *buf, int len) | 749 | static int inet_gifconf(struct net_device *dev, char __user *buf, int len) |
750 | { | 750 | { |
751 | struct in_device *in_dev = __in_dev_get(dev); | 751 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
752 | struct in_ifaddr *ifa; | 752 | struct in_ifaddr *ifa; |
753 | struct ifreq ifr; | 753 | struct ifreq ifr; |
754 | int done = 0; | 754 | int done = 0; |
@@ -791,7 +791,7 @@ u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope) | |||
791 | struct in_device *in_dev; | 791 | struct in_device *in_dev; |
792 | 792 | ||
793 | rcu_read_lock(); | 793 | rcu_read_lock(); |
794 | in_dev = __in_dev_get(dev); | 794 | in_dev = __in_dev_get_rcu(dev); |
795 | if (!in_dev) | 795 | if (!in_dev) |
796 | goto no_in_dev; | 796 | goto no_in_dev; |
797 | 797 | ||
@@ -818,7 +818,7 @@ no_in_dev: | |||
818 | read_lock(&dev_base_lock); | 818 | read_lock(&dev_base_lock); |
819 | rcu_read_lock(); | 819 | rcu_read_lock(); |
820 | for (dev = dev_base; dev; dev = dev->next) { | 820 | for (dev = dev_base; dev; dev = dev->next) { |
821 | if ((in_dev = __in_dev_get(dev)) == NULL) | 821 | if ((in_dev = __in_dev_get_rcu(dev)) == NULL) |
822 | continue; | 822 | continue; |
823 | 823 | ||
824 | for_primary_ifa(in_dev) { | 824 | for_primary_ifa(in_dev) { |
@@ -887,7 +887,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop | |||
887 | 887 | ||
888 | if (dev) { | 888 | if (dev) { |
889 | rcu_read_lock(); | 889 | rcu_read_lock(); |
890 | if ((in_dev = __in_dev_get(dev))) | 890 | if ((in_dev = __in_dev_get_rcu(dev))) |
891 | addr = confirm_addr_indev(in_dev, dst, local, scope); | 891 | addr = confirm_addr_indev(in_dev, dst, local, scope); |
892 | rcu_read_unlock(); | 892 | rcu_read_unlock(); |
893 | 893 | ||
@@ -897,7 +897,7 @@ u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scop | |||
897 | read_lock(&dev_base_lock); | 897 | read_lock(&dev_base_lock); |
898 | rcu_read_lock(); | 898 | rcu_read_lock(); |
899 | for (dev = dev_base; dev; dev = dev->next) { | 899 | for (dev = dev_base; dev; dev = dev->next) { |
900 | if ((in_dev = __in_dev_get(dev))) { | 900 | if ((in_dev = __in_dev_get_rcu(dev))) { |
901 | addr = confirm_addr_indev(in_dev, dst, local, scope); | 901 | addr = confirm_addr_indev(in_dev, dst, local, scope); |
902 | if (addr) | 902 | if (addr) |
903 | break; | 903 | break; |
@@ -957,7 +957,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
957 | void *ptr) | 957 | void *ptr) |
958 | { | 958 | { |
959 | struct net_device *dev = ptr; | 959 | struct net_device *dev = ptr; |
960 | struct in_device *in_dev = __in_dev_get(dev); | 960 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
961 | 961 | ||
962 | ASSERT_RTNL(); | 962 | ASSERT_RTNL(); |
963 | 963 | ||
@@ -1078,7 +1078,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
1078 | if (idx > s_idx) | 1078 | if (idx > s_idx) |
1079 | s_ip_idx = 0; | 1079 | s_ip_idx = 0; |
1080 | rcu_read_lock(); | 1080 | rcu_read_lock(); |
1081 | if ((in_dev = __in_dev_get(dev)) == NULL) { | 1081 | if ((in_dev = __in_dev_get_rcu(dev)) == NULL) { |
1082 | rcu_read_unlock(); | 1082 | rcu_read_unlock(); |
1083 | continue; | 1083 | continue; |
1084 | } | 1084 | } |
@@ -1149,7 +1149,7 @@ void inet_forward_change(void) | |||
1149 | for (dev = dev_base; dev; dev = dev->next) { | 1149 | for (dev = dev_base; dev; dev = dev->next) { |
1150 | struct in_device *in_dev; | 1150 | struct in_device *in_dev; |
1151 | rcu_read_lock(); | 1151 | rcu_read_lock(); |
1152 | in_dev = __in_dev_get(dev); | 1152 | in_dev = __in_dev_get_rcu(dev); |
1153 | if (in_dev) | 1153 | if (in_dev) |
1154 | in_dev->cnf.forwarding = on; | 1154 | in_dev->cnf.forwarding = on; |
1155 | rcu_read_unlock(); | 1155 | rcu_read_unlock(); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 4e1379f71269..e61bc7177eb1 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -173,7 +173,7 @@ int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | |||
173 | 173 | ||
174 | no_addr = rpf = 0; | 174 | no_addr = rpf = 0; |
175 | rcu_read_lock(); | 175 | rcu_read_lock(); |
176 | in_dev = __in_dev_get(dev); | 176 | in_dev = __in_dev_get_rcu(dev); |
177 | if (in_dev) { | 177 | if (in_dev) { |
178 | no_addr = in_dev->ifa_list == NULL; | 178 | no_addr = in_dev->ifa_list == NULL; |
179 | rpf = IN_DEV_RPFILTER(in_dev); | 179 | rpf = IN_DEV_RPFILTER(in_dev); |
@@ -607,7 +607,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
607 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 607 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
608 | { | 608 | { |
609 | struct net_device *dev = ptr; | 609 | struct net_device *dev = ptr; |
610 | struct in_device *in_dev = __in_dev_get(dev); | 610 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
611 | 611 | ||
612 | if (event == NETDEV_UNREGISTER) { | 612 | if (event == NETDEV_UNREGISTER) { |
613 | fib_disable_ip(dev, 2); | 613 | fib_disable_ip(dev, 2); |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index d41219e8037c..186f20c4a45e 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1087,7 +1087,7 @@ fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm, | |||
1087 | rta->rta_oif = &dev->ifindex; | 1087 | rta->rta_oif = &dev->ifindex; |
1088 | if (colon) { | 1088 | if (colon) { |
1089 | struct in_ifaddr *ifa; | 1089 | struct in_ifaddr *ifa; |
1090 | struct in_device *in_dev = __in_dev_get(dev); | 1090 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
1091 | if (!in_dev) | 1091 | if (!in_dev) |
1092 | return -ENODEV; | 1092 | return -ENODEV; |
1093 | *colon = ':'; | 1093 | *colon = ':'; |
@@ -1268,7 +1268,7 @@ int fib_sync_up(struct net_device *dev) | |||
1268 | } | 1268 | } |
1269 | if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) | 1269 | if (nh->nh_dev == NULL || !(nh->nh_dev->flags&IFF_UP)) |
1270 | continue; | 1270 | continue; |
1271 | if (nh->nh_dev != dev || __in_dev_get(dev) == NULL) | 1271 | if (nh->nh_dev != dev || !__in_dev_get_rtnl(dev)) |
1272 | continue; | 1272 | continue; |
1273 | alive++; | 1273 | alive++; |
1274 | spin_lock_bh(&fib_multipath_lock); | 1274 | spin_lock_bh(&fib_multipath_lock); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 70c44e4c3ceb..8b6d3939e1e6 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1323,7 +1323,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr) | |||
1323 | } | 1323 | } |
1324 | if (dev) { | 1324 | if (dev) { |
1325 | imr->imr_ifindex = dev->ifindex; | 1325 | imr->imr_ifindex = dev->ifindex; |
1326 | idev = __in_dev_get(dev); | 1326 | idev = __in_dev_get_rtnl(dev); |
1327 | } | 1327 | } |
1328 | return idev; | 1328 | return idev; |
1329 | } | 1329 | } |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index f0d5740d7e22..896ce3f8f53a 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1104,10 +1104,10 @@ static int ipgre_open(struct net_device *dev) | |||
1104 | return -EADDRNOTAVAIL; | 1104 | return -EADDRNOTAVAIL; |
1105 | dev = rt->u.dst.dev; | 1105 | dev = rt->u.dst.dev; |
1106 | ip_rt_put(rt); | 1106 | ip_rt_put(rt); |
1107 | if (__in_dev_get(dev) == NULL) | 1107 | if (__in_dev_get_rtnl(dev) == NULL) |
1108 | return -EADDRNOTAVAIL; | 1108 | return -EADDRNOTAVAIL; |
1109 | t->mlink = dev->ifindex; | 1109 | t->mlink = dev->ifindex; |
1110 | ip_mc_inc_group(__in_dev_get(dev), t->parms.iph.daddr); | 1110 | ip_mc_inc_group(__in_dev_get_rtnl(dev), t->parms.iph.daddr); |
1111 | } | 1111 | } |
1112 | return 0; | 1112 | return 0; |
1113 | } | 1113 | } |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 9dbf5909f3a6..302b7eb507c9 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -149,7 +149,7 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v) | |||
149 | if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { | 149 | if (err == 0 && (dev = __dev_get_by_name(p.name)) != NULL) { |
150 | dev->flags |= IFF_MULTICAST; | 150 | dev->flags |= IFF_MULTICAST; |
151 | 151 | ||
152 | in_dev = __in_dev_get(dev); | 152 | in_dev = __in_dev_get_rtnl(dev); |
153 | if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) | 153 | if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) |
154 | goto failure; | 154 | goto failure; |
155 | in_dev->cnf.rp_filter = 0; | 155 | in_dev->cnf.rp_filter = 0; |
@@ -278,7 +278,7 @@ static int vif_delete(int vifi) | |||
278 | 278 | ||
279 | dev_set_allmulti(dev, -1); | 279 | dev_set_allmulti(dev, -1); |
280 | 280 | ||
281 | if ((in_dev = __in_dev_get(dev)) != NULL) { | 281 | if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { |
282 | in_dev->cnf.mc_forwarding--; | 282 | in_dev->cnf.mc_forwarding--; |
283 | ip_rt_multicast_event(in_dev); | 283 | ip_rt_multicast_event(in_dev); |
284 | } | 284 | } |
@@ -421,7 +421,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock) | |||
421 | return -EINVAL; | 421 | return -EINVAL; |
422 | } | 422 | } |
423 | 423 | ||
424 | if ((in_dev = __in_dev_get(dev)) == NULL) | 424 | if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) |
425 | return -EADDRNOTAVAIL; | 425 | return -EADDRNOTAVAIL; |
426 | in_dev->cnf.mc_forwarding++; | 426 | in_dev->cnf.mc_forwarding++; |
427 | dev_set_allmulti(dev, +1); | 427 | dev_set_allmulti(dev, +1); |
diff --git a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c index 577bac22dcc6..186646eb249f 100644 --- a/net/ipv4/netfilter/ip_conntrack_netbios_ns.c +++ b/net/ipv4/netfilter/ip_conntrack_netbios_ns.c | |||
@@ -58,7 +58,7 @@ static int help(struct sk_buff **pskb, | |||
58 | goto out; | 58 | goto out; |
59 | 59 | ||
60 | rcu_read_lock(); | 60 | rcu_read_lock(); |
61 | in_dev = __in_dev_get(rt->u.dst.dev); | 61 | in_dev = __in_dev_get_rcu(rt->u.dst.dev); |
62 | if (in_dev != NULL) { | 62 | if (in_dev != NULL) { |
63 | for_primary_ifa(in_dev) { | 63 | for_primary_ifa(in_dev) { |
64 | if (ifa->ifa_broadcast == iph->daddr) { | 64 | if (ifa->ifa_broadcast == iph->daddr) { |
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index 715cb613405c..5245bfd33d52 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -93,7 +93,7 @@ redirect_target(struct sk_buff **pskb, | |||
93 | newdst = 0; | 93 | newdst = 0; |
94 | 94 | ||
95 | rcu_read_lock(); | 95 | rcu_read_lock(); |
96 | indev = __in_dev_get((*pskb)->dev); | 96 | indev = __in_dev_get_rcu((*pskb)->dev); |
97 | if (indev && (ifa = indev->ifa_list)) | 97 | if (indev && (ifa = indev->ifa_list)) |
98 | newdst = ifa->ifa_local; | 98 | newdst = ifa->ifa_local; |
99 | rcu_read_unlock(); | 99 | rcu_read_unlock(); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 8549f26e2495..381dd6a6aebb 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2128,7 +2128,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr, | |||
2128 | struct in_device *in_dev; | 2128 | struct in_device *in_dev; |
2129 | 2129 | ||
2130 | rcu_read_lock(); | 2130 | rcu_read_lock(); |
2131 | if ((in_dev = __in_dev_get(dev)) != NULL) { | 2131 | if ((in_dev = __in_dev_get_rcu(dev)) != NULL) { |
2132 | int our = ip_check_mc(in_dev, daddr, saddr, | 2132 | int our = ip_check_mc(in_dev, daddr, saddr, |
2133 | skb->nh.iph->protocol); | 2133 | skb->nh.iph->protocol); |
2134 | if (our | 2134 | if (our |
@@ -2443,7 +2443,9 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2443 | err = -ENODEV; | 2443 | err = -ENODEV; |
2444 | if (dev_out == NULL) | 2444 | if (dev_out == NULL) |
2445 | goto out; | 2445 | goto out; |
2446 | if (__in_dev_get(dev_out) == NULL) { | 2446 | |
2447 | /* RACE: Check return value of inet_select_addr instead. */ | ||
2448 | if (__in_dev_get_rtnl(dev_out) == NULL) { | ||
2447 | dev_put(dev_out); | 2449 | dev_put(dev_out); |
2448 | goto out; /* Wrong error code */ | 2450 | goto out; /* Wrong error code */ |
2449 | } | 2451 | } |