[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201022091211.2a86355c@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date: Thu, 22 Oct 2020 09:12:11 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Dinghao Liu <dinghao.liu@....edu.cn>
Cc: kjlu@....edu, "David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net-veth: Fix memleak in veth_newlink
On Thu, 22 Oct 2020 13:42:33 +0800 Dinghao Liu wrote:
> When rtnl_configure_link() fails, peer needs to be
> freed just like when register_netdevice() fails.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
Can you see this leak or are you just sending this based on your
reading of the code?
netdev should be freed by the core:
static void veth_setup(struct net_device *dev)
{
ether_setup(dev);
[...]
dev->needs_free_netdev = true;
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 8c737668008a..6c68094399cc 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1405,8 +1405,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,
> /* nothing to do */
> err_configure_peer:
> unregister_netdevice(peer);
> - return err;
> -
> err_register_peer:
> free_netdev(peer);
> return err;
Powered by blists - more mailing lists