[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251022163525.86362-1-nihaal@cse.iitm.ac.in>
Date: Wed, 22 Oct 2025 22:05:22 +0530
From: Abdun Nihaal <nihaal@....iitm.ac.in>
To: ecree.xilinx@...il.com
Cc: Abdun Nihaal <nihaal@....iitm.ac.in>,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
alejandro.lucero-palau@....com,
habetsm.xilinx@...il.com,
netdev@...r.kernel.org,
linux-net-drivers@....com,
linux-kernel@...r.kernel.org
Subject: [PATCH net] sfc: fix potential memory leak in efx_mae_process_mport()
In efx_mae_enumerate_mports(), memory allocated for mae_mport_desc is
passed as a argument to efx_mae_process_mport(), but when the error path
in efx_mae_process_mport() gets executed, the memory allocated for desc
gets leaked.
Fix that by freeing the memory allocation before returning error.
Fixes: a6a15aca4207 ("sfc: enumerate mports in ef100")
Signed-off-by: Abdun Nihaal <nihaal@....iitm.ac.in>
---
drivers/net/ethernet/sfc/mae.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/sfc/mae.c b/drivers/net/ethernet/sfc/mae.c
index 50f097487b14..15d4af6c1bb9 100644
--- a/drivers/net/ethernet/sfc/mae.c
+++ b/drivers/net/ethernet/sfc/mae.c
@@ -1100,6 +1100,7 @@ static int efx_mae_process_mport(struct efx_nic *efx,
if (!IS_ERR_OR_NULL(mport)) {
netif_err(efx, drv, efx->net_dev,
"mport with id %u does exist!!!\n", desc->mport_id);
+ kfree(desc);
return -EEXIST;
}
--
2.43.0
Powered by blists - more mailing lists