public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create()
@ 2024-12-17  5:23 Harshit Mogalapalli
  2024-12-17  5:23 ` [PATCH net v2 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Harshit Mogalapalli @ 2024-12-17  5:23 UTC (permalink / raw)
  To: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
	Bharat Bhushan, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, netdev, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli,
	Przemek Kitszel

When rvu_rep_devlink_port_register() fails, free_netdev(ndev) for this
incomplete iteration before going to "exit:" label.

Fixes: 9ed0343f561e ("octeontx2-pf: Add devlink port support")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
v1-->v2: Change the Fixes tag to the correct one as pointed out by Przemek
---
 drivers/net/ethernet/marvell/octeontx2/nic/rep.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
index 232b10740c13..9e3fcbae5dee 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c
+++ 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);
 		err = register_netdev(ndev);
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-19  3:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17  5:23 [PATCH net v2 1/2] octeontx2-pf: fix netdev memory leak in rvu_rep_create() Harshit Mogalapalli
2024-12-17  5:23 ` [PATCH net v2 2/2] octeontx2-pf: fix error handling of devlink port " Harshit Mogalapalli
2024-12-18  6:04   ` [EXTERNAL] " Geethasowjanya Akula
2024-12-18  6:03 ` [EXTERNAL] [PATCH net v2 1/2] octeontx2-pf: fix netdev memory leak " Geethasowjanya Akula
2024-12-18 17:38 ` Markus Elfring
2024-12-18 17:51   ` Dan Carpenter
2024-12-19  3:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox