mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
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: a6a15aca42 ("sfc: enumerate mports in ef100")
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Link: https://patch.msgid.link/20251023141844.25847-1-nihaal@cse.iitm.ac.in
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
03ca7c8c42
commit
46a499aaf8
|
|
@ -1090,6 +1090,9 @@ void efx_mae_remove_mport(void *desc, void *arg)
|
|||
kfree(mport);
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes ownership of @desc, even if it returns an error
|
||||
*/
|
||||
static int efx_mae_process_mport(struct efx_nic *efx,
|
||||
struct mae_mport_desc *desc)
|
||||
{
|
||||
|
|
@ -1100,6 +1103,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user