diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-07-14 23:54:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-14 23:54:23 -0400 |
commit | 5ae7b444137143a4e067b80354171ab128eb1b2b (patch) | |
tree | 5a903c02c26d186d2ed95d81152ee28c5e2daaa3 /net | |
parent | bc3f9076f671f128c82022428992c30be57f22d5 (diff) |
ipv6: Check return of dev_set_allmulti
allmulti might overflow.
Commit: "netdevice: Fix promiscuity and allmulti overflow" in net-next makes
dev_set_promiscuity/allmulti return error number if overflow happened.
Here, we check the positive increment for allmulti to get error return.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ip6mr.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index cfac26d674ed..2dd832592a31 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -595,6 +595,7 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
595 | int vifi = vifc->mif6c_mifi; | 595 | int vifi = vifc->mif6c_mifi; |
596 | struct mif_device *v = &vif6_table[vifi]; | 596 | struct mif_device *v = &vif6_table[vifi]; |
597 | struct net_device *dev; | 597 | struct net_device *dev; |
598 | int err; | ||
598 | 599 | ||
599 | /* Is vif busy ? */ | 600 | /* Is vif busy ? */ |
600 | if (MIF_EXISTS(vifi)) | 601 | if (MIF_EXISTS(vifi)) |
@@ -612,6 +613,11 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
612 | dev = ip6mr_reg_vif(); | 613 | dev = ip6mr_reg_vif(); |
613 | if (!dev) | 614 | if (!dev) |
614 | return -ENOBUFS; | 615 | return -ENOBUFS; |
616 | err = dev_set_allmulti(dev, 1); | ||
617 | if (err) { | ||
618 | unregister_netdevice(dev); | ||
619 | return err; | ||
620 | } | ||
615 | break; | 621 | break; |
616 | #endif | 622 | #endif |
617 | case 0: | 623 | case 0: |
@@ -619,13 +625,14 @@ static int mif6_add(struct mif6ctl *vifc, int mrtsock) | |||
619 | if (!dev) | 625 | if (!dev) |
620 | return -EADDRNOTAVAIL; | 626 | return -EADDRNOTAVAIL; |
621 | dev_put(dev); | 627 | dev_put(dev); |
628 | err = dev_set_allmulti(dev, 1); | ||
629 | if (err) | ||
630 | return err; | ||
622 | break; | 631 | break; |
623 | default: | 632 | default: |
624 | return -EINVAL; | 633 | return -EINVAL; |
625 | } | 634 | } |
626 | 635 | ||
627 | dev_set_allmulti(dev, 1); | ||
628 | |||
629 | /* | 636 | /* |
630 | * Fill in the VIF structures | 637 | * Fill in the VIF structures |
631 | */ | 638 | */ |