diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-07-14 23:53:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-14 23:53:13 -0400 |
commit | bc3f9076f671f128c82022428992c30be57f22d5 (patch) | |
tree | ec3ecf7cf8d22e9a319f832650b5edb1634ec9f3 /net/bridge/br_if.c | |
parent | 7e1a1ac1fbaa88fe254400b7f30b775502932ad3 (diff) |
bridge: Check return of dev_set_promiscuity
dev_set_promiscuity/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 promiscuity to get error return.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r-- | net/bridge/br_if.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 497df086141a..a072ea5ca6f5 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -373,6 +373,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
373 | if (IS_ERR(p)) | 373 | if (IS_ERR(p)) |
374 | return PTR_ERR(p); | 374 | return PTR_ERR(p); |
375 | 375 | ||
376 | err = dev_set_promiscuity(dev, 1); | ||
377 | if (err) | ||
378 | goto put_back; | ||
379 | |||
376 | err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), | 380 | err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), |
377 | SYSFS_BRIDGE_PORT_ATTR); | 381 | SYSFS_BRIDGE_PORT_ATTR); |
378 | if (err) | 382 | if (err) |
@@ -388,7 +392,6 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) | |||
388 | 392 | ||
389 | rcu_assign_pointer(dev->br_port, p); | 393 | rcu_assign_pointer(dev->br_port, p); |
390 | dev_disable_lro(dev); | 394 | dev_disable_lro(dev); |
391 | dev_set_promiscuity(dev, 1); | ||
392 | 395 | ||
393 | list_add_rcu(&p->list, &br->port_list); | 396 | list_add_rcu(&p->list, &br->port_list); |
394 | 397 | ||
@@ -412,12 +415,12 @@ err2: | |||
412 | br_fdb_delete_by_port(br, p, 1); | 415 | br_fdb_delete_by_port(br, p, 1); |
413 | err1: | 416 | err1: |
414 | kobject_del(&p->kobj); | 417 | kobject_del(&p->kobj); |
415 | goto put_back; | ||
416 | err0: | 418 | err0: |
417 | kobject_put(&p->kobj); | 419 | kobject_put(&p->kobj); |
418 | 420 | dev_set_promiscuity(dev, -1); | |
419 | put_back: | 421 | put_back: |
420 | dev_put(dev); | 422 | dev_put(dev); |
423 | kfree(p); | ||
421 | return err; | 424 | return err; |
422 | } | 425 | } |
423 | 426 | ||