lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Jun 2008 18:18:19 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	Wang Chen <wangchen@...fujitsu.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	NETDEV <netdev@...r.kernel.org>,
	Patrick McHardy <kaber@...sh.net>
Subject: Re: [PATCH net-next 3/8] bridge: Check return of
 dev_set_promiscuity

On Fri, 20 Jun 2008 08:55:00 +0800
Wang Chen <wangchen@...fujitsu.com> wrote:

> 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.
> 
> BTW, I have to add a function to handle cleanup for br_sysfs_addif().
> I know Stephen has removed br_sysfs_removeif() to keep kobjects in use
> even if not using sysfs.
> But here we have a new br_sysfs_removeif() which only cleanup the sysfs
> and doesn't touch kobjects.
> 
> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>

Not that hard way please. Instead just rearrange the order of setup to avoid having to
do the things that are harder to unwind. Sysfs calls seem to be more fragile/error
prone than the simple counters.

Like this (untested)

--- a/net/bridge/br_if.c	2008-06-19 18:09:59.000000000 -0700
+++ b/net/bridge/br_if.c	2008-06-19 18:16:44.000000000 -0700
@@ -373,6 +373,10 @@ int br_add_if(struct net_bridge *br, str
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
+	err = dev_set_promiscuity(dev, 1);
+	if (err)
+		goto put_kobj;
+
 	err = kobject_init_and_add(&p->kobj, &brport_ktype, &(dev->dev.kobj),
 				   SYSFS_BRIDGE_PORT_ATTR);
 	if (err)
@@ -387,7 +391,6 @@ int br_add_if(struct net_bridge *br, str
 		goto err2;
 
 	rcu_assign_pointer(dev->br_port, p);
-	dev_set_promiscuity(dev, 1);
 
 	list_add_rcu(&p->list, &br->port_list);
 
@@ -416,6 +419,8 @@ err0:
 	kobject_put(&p->kobj);
 
 put_back:
+	dev_set_promiscuity(dev, -1);
+put_dev:
 	dev_put(dev);
 	return err;
 }
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ