From: Wang Chen Date: Tue, 15 Jul 2008 03:53:13 +0000 (-0700) Subject: bridge: Check return of dev_set_promiscuity X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bc3f9076f671f128c82022428992c30be57f22d5;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- 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) if (IS_ERR(p)) return PTR_ERR(p); + err = dev_set_promiscuity(dev, 1); + if (err) + goto put_back; + err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj), SYSFS_BRIDGE_PORT_ATTR); if (err) @@ -388,7 +392,6 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) rcu_assign_pointer(dev->br_port, p); dev_disable_lro(dev); - dev_set_promiscuity(dev, 1); list_add_rcu(&p->list, &br->port_list); @@ -412,12 +415,12 @@ err2: br_fdb_delete_by_port(br, p, 1); err1: kobject_del(&p->kobj); - goto put_back; err0: kobject_put(&p->kobj); - + dev_set_promiscuity(dev, -1); put_back: dev_put(dev); + kfree(p); return err; }