From: Patrick McHardy <kaber@trash.net>
To: Andy Gospodarek <andy@greyhouse.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
Jay Vosburgh <fubar@us.ibm.com>
Subject: Re: bonding: fix device leak on error in bond_create()
Date: Fri, 26 Feb 2010 17:17:40 +0100 [thread overview]
Message-ID: <4B87F424.6090300@trash.net> (raw)
In-Reply-To: <20100226160544.GA2108@gospo.rdu.redhat.com>
Andy Gospodarek wrote:
> On Fri, Feb 26, 2010 at 04:35:52PM +0100, Patrick McHardy wrote:
>
>> commit f357a5caa0ca29b74811a0fc08efb5ae4aade959
>> Author: Patrick McHardy <kaber@trash.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@trash.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@greyhouse.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.
next prev parent reply other threads:[~2010-02-26 16:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 15:35 bonding: fix device leak on error in bond_create() Patrick McHardy
2010-02-26 16:05 ` Andy Gospodarek
2010-02-26 16:17 ` Patrick McHardy [this message]
2010-02-26 16:22 ` Andy Gospodarek
2010-02-27 10:52 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B87F424.6090300@trash.net \
--to=kaber@trash.net \
--cc=andy@greyhouse.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.