diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-07-14 23:54:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-14 23:54:54 -0400 |
commit | 7af3db78a99f47b9ff40b8cb0bb08160ad6a3d6b (patch) | |
tree | d8d3e43ace346a484705c2a143366ae03ed12a42 /net/ipv6/ip6mr.c | |
parent | 5ae7b444137143a4e067b80354171ab128eb1b2b (diff) |
ipv6: Fix using after dev_put()
Patrick McHardy pointed it out.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6mr.c')
-rw-r--r-- | net/ipv6/ip6mr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 2dd832592a31..0b41aa2675f5 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -443,6 +443,7 @@ static struct net_device *ip6mr_reg_vif(void) | |||
443 | if (dev_open(dev)) | 443 | if (dev_open(dev)) |
444 | goto failure; | 444 | goto failure; |
445 | 445 | ||
446 | dev_hold(dev); | ||
446 | return dev; | 447 | return dev; |
447 | 448 | ||
448 | failure: | 449 | failure: |
@@ -616,6 +617,7 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
616 | err = dev_set_allmulti(dev, 1); | 617 | err = dev_set_allmulti(dev, 1); |
617 | if (err) { | 618 | if (err) { |
618 | unregister_netdevice(dev); | 619 | unregister_netdevice(dev); |
620 | dev_put(dev); | ||
619 | return err; | 621 | return err; |
620 | } | 622 | } |
621 | break; | 623 | break; |
@@ -624,10 +626,11 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
624 | dev = dev_get_by_index(&init_net, vifc->mif6c_pifi); | 626 | dev = dev_get_by_index(&init_net, vifc->mif6c_pifi); |
625 | if (!dev) | 627 | if (!dev) |
626 | return -EADDRNOTAVAIL; | 628 | return -EADDRNOTAVAIL; |
627 | dev_put(dev); | ||
628 | err = dev_set_allmulti(dev, 1); | 629 | err = dev_set_allmulti(dev, 1); |
629 | if (err) | 630 | if (err) { |
631 | dev_put(dev); | ||
630 | return err; | 632 | return err; |
633 | } | ||
631 | break; | 634 | break; |
632 | default: | 635 | default: |
633 | return -EINVAL; | 636 | return -EINVAL; |
@@ -651,7 +654,6 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
651 | 654 | ||
652 | /* And finish update writing critical data */ | 655 | /* And finish update writing critical data */ |
653 | write_lock_bh(&mrt_lock); | 656 | write_lock_bh(&mrt_lock); |
654 | dev_hold(dev); | ||
655 | v->dev = dev; | 657 | v->dev = dev; |
656 | #ifdef CONFIG_IPV6_PIMSM_V2 | 658 | #ifdef CONFIG_IPV6_PIMSM_V2 |
657 | if (v->flags & MIFF_REGISTER) | 659 | if (v->flags & MIFF_REGISTER) |