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:	Fri, 26 Feb 2010 11:22:24 -0500
From:	Andy Gospodarek <andy@...yhouse.net>
To:	Patrick McHardy <kaber@...sh.net>
Cc:	Linux Netdev List <netdev@...r.kernel.org>,
	Jay Vosburgh <fubar@...ibm.com>
Subject: Re: bonding: fix device leak on error in bond_create()

On Fri, Feb 26, 2010 at 05:17:40PM +0100, Patrick McHardy wrote:
> Andy Gospodarek wrote:
> > On Fri, Feb 26, 2010 at 04:35:52PM +0100, Patrick McHardy wrote:
> > 
> >> commit f357a5caa0ca29b74811a0fc08efb5ae4aade959
> >> Author: Patrick McHardy <kaber@...sh.net>
> >> Date:   Thu Feb 25 20:21:10 2010 +0100
> >>
> >>     bonding: fix device leak on error in bond_create()
> >>     
> >>     When the register_netdevice() call fails, the newly allocated device is
> >>     not freed.
> >>     
> >>     Signed-off-by: Patrick McHardy <kaber@...sh.net>
> >>
> >> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> >> index 1787e3c..430c022 100644
> >> --- a/drivers/net/bonding/bond_main.c
> >> +++ b/drivers/net/bonding/bond_main.c
> >> @@ -4946,6 +4946,8 @@ int bond_create(struct net *net, const char *name)
> >>  	}
> >>  
> >>  	res = register_netdevice(bond_dev);
> >> +	if (res < 0)
> >> +		goto out_netdev;
> >>  
> >>  out:
> >>  	rtnl_unlock();
> > 
> > Acked-by: Andy Gospodarek <andy@...yhouse.net>
> > 
> > Seems like a good idea.  I know register_netdevice is always supposed to
> > return a value < 0 on error, but this would work if it didn't for some
> > reason.
> 
> I don't care much, but that would be a bug since we'd return
> invalid errno codes to userspace.

Then I guess the bonding driver would probably not be the last to know
if someone snuck a bug into register_netdevice....

--
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