Commit fa2d7708 authored by Abdun Nihaal's avatar Abdun Nihaal Committed by Greg Kroah-Hartman
Browse files

cxgb4: fix memory leak in cxgb4_init_ethtool_filters() error path



[ Upstream commit 00ffb372 ]

In the for loop used to allocate the loc_array and bmap for each port, a
memory leak is possible when the allocation for loc_array succeeds,
but the allocation for bmap fails. This is because when the control flow
goes to the label free_eth_finfo, only the allocations starting from
(i-1)th iteration are freed.

Fix that by freeing the loc_array in the bmap allocation error path.

Fixes: d915c299 ("cxgb4: add skeleton for ethtool n-tuple filters")
Signed-off-by: default avatarAbdun Nihaal <abdun.nihaal@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20250414170649.89156-1-abdun.nihaal@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1489c195
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment