[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d54b21b-7ca9-4126-ba13-bbd333d6ba0c@web.de>
Date: Wed, 18 Dec 2024 18:38:25 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
netdev@...r.kernel.org, Andrew Lunn <andrew+netdev@...n.ch>,
Bharat Bhushan <bbhushan2@...vell.com>,
Dan Carpenter <dan.carpenter@...aro.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Geethasowjanya Akula <gakula@...vell.com>,
Hariprasad Kelam <hkelam@...vell.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
Sunil Goutham <sgoutham@...vell.com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Dan Carpenter <error27@...il.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: Re: [PATCH net v2 1/2] octeontx2-pf: fix netdev memory leak in
rvu_rep_create()
> When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
> incomplete iteration before going to "exit:" label.
…
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
> @@ -680,8 +680,10 @@ int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
> ndev->features |= ndev->hw_features;
> eth_hw_addr_random(ndev);
> err = rvu_rep_devlink_port_register(rep);
> - if (err)
> + if (err) {
> + free_netdev(ndev);
> goto exit;
> + }
>
> SET_NETDEV_DEVLINK_PORT(ndev, &rep->dl_port);
…
I suggest to add another jump target instead so that a bit of exception handling
can be better reused at the end of this function implementation.
Regards,
Markus
Powered by blists - more mailing lists