From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Xiaotian Feng <dfeng@redhat.com>
Cc: davem@davemloft.net, bridge@lists.linux-foundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiaotian Feng <dfeng@redhat.com>
Subject: Re: [PATCH] net/bridge: use kobject_put to release kobject in br_add_if error path
Date: Fri, 24 Jul 2009 08:36:07 -0700 [thread overview]
Message-ID: <20090724083607.6b91282d@nehalam> (raw)
In-Reply-To: <1248426392-30777-1-git-send-email-dfeng@redhat.com>
On Fri, 24 Jul 2009 17:06:32 +0800
Xiaotian Feng <dfeng@redhat.com> wrote:
> kobject_init_and_add will alloc memory for kobj->name, so in br_add_if
> error path, simply use kobject_del will not free memory for kobj->name.
> Fix by using kobject_put instead, kobject_put will internally calls
> kobject_del and frees memory for kobj->name.
>
> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
> ---
> net/bridge/br_if.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index 8a96672..eb404dc 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -424,7 +424,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
> err2:
> br_fdb_delete_by_port(br, p, 1);
> err1:
> - kobject_del(&p->kobj);
> + kobject_put(&p->kobj);
> err0:
> dev_set_promiscuity(dev, -1);
> put_back:
I assume you tested this by doing something like adding two interfaces
with the same MAC address to a bridge.
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
--
next prev parent reply other threads:[~2009-07-24 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-24 9:06 [PATCH] net/bridge: use kobject_put to release kobject in br_add_if error path Xiaotian Feng
2009-07-24 15:36 ` Stephen Hemminger [this message]
2009-07-27 2:21 ` 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=20090724083607.6b91282d@nehalam \
--to=shemminger@linux-foundation.org \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dfeng@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).