From: Patrick McHardy <kaber@trash.net>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH net-2.6] macvlan: do a proper cleanup in macvlan_common_newlink()
Date: Mon, 24 May 2010 20:56:32 +0200 [thread overview]
Message-ID: <4BFACBE0.4020109@trash.net> (raw)
In-Reply-To: <20100524170224.GA2816@psychotron.redhat.com>
Jiri Pirko wrote:
> Mon, May 24, 2010 at 05:58:58PM CEST, jpirko@
> Subject: [PATCH net-2.6] macvlan: do proper cleanup in macvlan_common_newlink() V2
>
> Fixes possible memory leak.
Looks good, thanks.
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Acked-by: Patrick McHardy <kaber@trash.net>
> ---
> drivers/net/macvlan.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
> index 4e238af..87e8d4c 100644
> --- a/drivers/net/macvlan.c
> +++ b/drivers/net/macvlan.c
> @@ -634,11 +634,18 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
>
> err = register_netdevice(dev);
> if (err < 0)
> - return err;
> + goto destroy_port;
>
> list_add_tail(&vlan->list, &port->vlans);
> netif_stacked_transfer_operstate(lowerdev, dev);
> +
> return 0;
> +
> +destroy_port:
> + if (list_empty(&port->vlans))
> + macvlan_port_destroy(lowerdev);
> +
> + return err;
> }
> EXPORT_SYMBOL_GPL(macvlan_common_newlink);
>
next prev parent reply other threads:[~2010-05-24 18:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-24 15:58 [PATCH net-2.6] macvlan: do a proper cleanup in macvlan_common_newlink() Jiri Pirko
2010-05-24 17:02 ` Jiri Pirko
2010-05-24 18:56 ` Patrick McHardy [this message]
2010-05-25 1:41 ` 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=4BFACBE0.4020109@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=jpirko@redhat.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 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).