Re: [PATCH net] sfc: fix potential memory leak in efx_mae_process_mport()

From
Edward Cree <ecree.xilinx@gmail.com>
Date
2025-10-23 11:27:23
Also in
lkml
Reply to
Abdun Nihaal, 2025-10-22
On 22/10/2025 17:35, Abdun Nihaal wrote:
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 <redacted>
Acked-by: Edward Cree <ecree.xilinx@gmail.com>

It might be nice to also add a comment on top of efx_mae_process_mport()
 stating that it takes ownership of @desc from the caller.
Thread (3 messages) 3 messages, 2 authors, last reply 2025-10-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help