aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-07-14 23:57:07 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-14 23:57:07 -0400
commitb89fb7da2f9a69dd34ff10d45f66baa40ff8c0e5 (patch)
tree420f1810c6d94fed581607078c75e895125f99ef
parent7dc00c82cbb0119cf4663f65bbaa2cc55f961db2 (diff)
macvlan: 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>
-rw-r--r--drivers/net/macvlan.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index c02ceaa4a216..980001c2cf96 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -189,12 +189,20 @@ static int macvlan_open(struct net_device *dev)
189 189
190 err = dev_unicast_add(lowerdev, dev->dev_addr, ETH_ALEN); 190 err = dev_unicast_add(lowerdev, dev->dev_addr, ETH_ALEN);
191 if (err < 0) 191 if (err < 0)
192 return err; 192 goto out;
193 if (dev->flags & IFF_ALLMULTI) 193 if (dev->flags & IFF_ALLMULTI) {
194 dev_set_allmulti(lowerdev, 1); 194 err = dev_set_allmulti(lowerdev, 1);
195 if (err < 0)
196 goto del_unicast;
197 }
195 198
196 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[dev->dev_addr[5]]); 199 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[dev->dev_addr[5]]);
197 return 0; 200 return 0;
201
202del_unicast:
203 dev_unicast_delete(lowerdev, dev->dev_addr, ETH_ALEN);
204out:
205 return err;
198} 206}
199 207
200static int macvlan_stop(struct net_device *dev) 208static int macvlan_stop(struct net_device *dev)