aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-07 11:36:57 -0400
commit4cac04dd63fa3b202ee313ed1afbbd135ab887ee (patch)
tree8fa7ed0186030297c69ac95530853eb5c860a894 /net
parente1c287b992d30dab86f1b1bfe1780d9d3a652b34 (diff)
parentbfe87dbc7b4da5b05a1a78480e996787a500cc6f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: fix endian lossage in forcedeth net/tokenring/olympic.c section fixes net: marvell.c fix sparse shadowed variable warning [VLAN]: Fix egress priority mappings leak. [TG3]: Add PHY workaround for 5784 [NET]: srandom32 fixes for networking v2 [IPV6]: Fix refcounting for anycast dst entries. [IPV6]: inet6_dev on loopback should be kept until namespace stop. [IPV6]: Event type in addrconf_ifdown is mis-used. [ICMP]: Ensure that ICMP relookup maintains status quo
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c15
-rw-r--r--net/ipv4/icmp.c24
-rw-r--r--net/ipv6/addrconf.c12
-rw-r--r--net/ipv6/anycast.c9
-rw-r--r--net/ipv6/icmp.c22
5 files changed, 48 insertions, 34 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 480ea90e7dcd..41a76a05e6fd 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -692,6 +692,20 @@ static int vlan_dev_init(struct net_device *dev)
692 return 0; 692 return 0;
693} 693}
694 694
695static void vlan_dev_uninit(struct net_device *dev)
696{
697 struct vlan_priority_tci_mapping *pm;
698 struct vlan_dev_info *vlan = vlan_dev_info(dev);
699 int i;
700
701 for (i = 0; i < ARRAY_SIZE(vlan->egress_priority_map); i++) {
702 while ((pm = vlan->egress_priority_map[i]) != NULL) {
703 vlan->egress_priority_map[i] = pm->next;
704 kfree(pm);
705 }
706 }
707}
708
695void vlan_setup(struct net_device *dev) 709void vlan_setup(struct net_device *dev)
696{ 710{
697 ether_setup(dev); 711 ether_setup(dev);
@@ -701,6 +715,7 @@ void vlan_setup(struct net_device *dev)
701 715
702 dev->change_mtu = vlan_dev_change_mtu; 716 dev->change_mtu = vlan_dev_change_mtu;
703 dev->init = vlan_dev_init; 717 dev->init = vlan_dev_init;
718 dev->uninit = vlan_dev_uninit;
704 dev->open = vlan_dev_open; 719 dev->open = vlan_dev_open;
705 dev->stop = vlan_dev_stop; 720 dev->stop = vlan_dev_stop;
706 dev->set_mac_address = vlan_dev_set_mac_address; 721 dev->set_mac_address = vlan_dev_set_mac_address;
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index a944e8053e28..40508babad8c 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -591,7 +591,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
591 } 591 }
592 592
593 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) 593 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET))
594 goto ende; 594 goto relookup_failed;
595 595
596 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) 596 if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL)
597 err = __ip_route_output_key(net, &rt2, &fl); 597 err = __ip_route_output_key(net, &rt2, &fl);
@@ -601,7 +601,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
601 601
602 fl2.fl4_dst = fl.fl4_src; 602 fl2.fl4_dst = fl.fl4_src;
603 if (ip_route_output_key(net, &rt2, &fl2)) 603 if (ip_route_output_key(net, &rt2, &fl2))
604 goto ende; 604 goto relookup_failed;
605 605
606 /* Ugh! */ 606 /* Ugh! */
607 odst = skb_in->dst; 607 odst = skb_in->dst;
@@ -614,21 +614,23 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
614 } 614 }
615 615
616 if (err) 616 if (err)
617 goto ende; 617 goto relookup_failed;
618 618
619 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL, 619 err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL,
620 XFRM_LOOKUP_ICMP); 620 XFRM_LOOKUP_ICMP);
621 if (err == -ENOENT) { 621 switch (err) {
622 case 0:
623 dst_release(&rt->u.dst);
624 rt = rt2;
625 break;
626 case -EPERM:
627 goto ende;
628 default:
629relookup_failed:
622 if (!rt) 630 if (!rt)
623 goto out_unlock; 631 goto out_unlock;
624 goto route_done; 632 break;
625 } 633 }
626
627 dst_release(&rt->u.dst);
628 rt = rt2;
629
630 if (err)
631 goto out_unlock;
632 } 634 }
633 635
634route_done: 636route_done:
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e7a1882db048..a65935a9afd9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2456,7 +2456,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2456 2456
2457 ASSERT_RTNL(); 2457 ASSERT_RTNL();
2458 2458
2459 if (dev == init_net.loopback_dev && how == 1) 2459 if ((dev->flags & IFF_LOOPBACK) && how == 1)
2460 how = 0; 2460 how = 0;
2461 2461
2462 rt6_ifdown(dev); 2462 rt6_ifdown(dev);
@@ -2469,7 +2469,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2469 /* Step 1: remove reference to ipv6 device from parent device. 2469 /* Step 1: remove reference to ipv6 device from parent device.
2470 Do not dev_put! 2470 Do not dev_put!
2471 */ 2471 */
2472 if (how == 1) { 2472 if (how) {
2473 idev->dead = 1; 2473 idev->dead = 1;
2474 2474
2475 /* protected by rtnl_lock */ 2475 /* protected by rtnl_lock */
@@ -2501,12 +2501,12 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2501 write_lock_bh(&idev->lock); 2501 write_lock_bh(&idev->lock);
2502 2502
2503 /* Step 3: clear flags for stateless addrconf */ 2503 /* Step 3: clear flags for stateless addrconf */
2504 if (how != 1) 2504 if (!how)
2505 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY); 2505 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
2506 2506
2507 /* Step 4: clear address list */ 2507 /* Step 4: clear address list */
2508#ifdef CONFIG_IPV6_PRIVACY 2508#ifdef CONFIG_IPV6_PRIVACY
2509 if (how == 1 && del_timer(&idev->regen_timer)) 2509 if (how && del_timer(&idev->regen_timer))
2510 in6_dev_put(idev); 2510 in6_dev_put(idev);
2511 2511
2512 /* clear tempaddr list */ 2512 /* clear tempaddr list */
@@ -2543,7 +2543,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2543 2543
2544 /* Step 5: Discard multicast list */ 2544 /* Step 5: Discard multicast list */
2545 2545
2546 if (how == 1) 2546 if (how)
2547 ipv6_mc_destroy_dev(idev); 2547 ipv6_mc_destroy_dev(idev);
2548 else 2548 else
2549 ipv6_mc_down(idev); 2549 ipv6_mc_down(idev);
@@ -2552,7 +2552,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2552 2552
2553 /* Shot the device (if unregistered) */ 2553 /* Shot the device (if unregistered) */
2554 2554
2555 if (how == 1) { 2555 if (how) {
2556 addrconf_sysctl_unregister(idev); 2556 addrconf_sysctl_unregister(idev);
2557 neigh_parms_release(&nd_tbl, idev->nd_parms); 2557 neigh_parms_release(&nd_tbl, idev->nd_parms);
2558 neigh_ifdown(&nd_tbl, dev); 2558 neigh_ifdown(&nd_tbl, dev);
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 9c7f83fbc3a1..e5f56c953b58 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -334,9 +334,7 @@ int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr)
334 idev->ac_list = aca; 334 idev->ac_list = aca;
335 write_unlock_bh(&idev->lock); 335 write_unlock_bh(&idev->lock);
336 336
337 dst_hold(&rt->u.dst); 337 ip6_ins_rt(rt);
338 if (ip6_ins_rt(rt))
339 dst_release(&rt->u.dst);
340 338
341 addrconf_join_solict(dev, &aca->aca_addr); 339 addrconf_join_solict(dev, &aca->aca_addr);
342 340
@@ -378,10 +376,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr)
378 addrconf_leave_solict(idev, &aca->aca_addr); 376 addrconf_leave_solict(idev, &aca->aca_addr);
379 377
380 dst_hold(&aca->aca_rt->u.dst); 378 dst_hold(&aca->aca_rt->u.dst);
381 if (ip6_del_rt(aca->aca_rt)) 379 ip6_del_rt(aca->aca_rt);
382 dst_free(&aca->aca_rt->u.dst);
383 else
384 dst_release(&aca->aca_rt->u.dst);
385 380
386 aca_put(aca); 381 aca_put(aca);
387 return 0; 382 return 0;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index f204a7275a0d..893287ecc628 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -436,24 +436,26 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
436 } 436 }
437 437
438 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6)) 438 if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
439 goto out_dst_release; 439 goto relookup_failed;
440 440
441 if (ip6_dst_lookup(sk, &dst2, &fl)) 441 if (ip6_dst_lookup(sk, &dst2, &fl))
442 goto out_dst_release; 442 goto relookup_failed;
443 443
444 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP); 444 err = xfrm_lookup(&dst2, &fl, sk, XFRM_LOOKUP_ICMP);
445 if (err == -ENOENT) { 445 switch (err) {
446 case 0:
447 dst_release(dst);
448 dst = dst2;
449 break;
450 case -EPERM:
451 goto out_dst_release;
452 default:
453relookup_failed:
446 if (!dst) 454 if (!dst)
447 goto out; 455 goto out;
448 goto route_done; 456 break;
449 } 457 }
450 458
451 dst_release(dst);
452 dst = dst2;
453
454 if (err)
455 goto out;
456
457route_done: 459route_done:
458 if (ipv6_addr_is_multicast(&fl.fl6_dst)) 460 if (ipv6_addr_is_multicast(&fl.fl6_dst))
459 hlimit = np->mcast_hops; 461 hlimit = np->mcast_hops;