[PATCH v2 023/148] net/ice/base: fix memory leak when checking firmware version
Anatoly Burakov
anatoly.burakov at intel.com
Wed Jun 12 17:00:17 CEST 2024
From: Ian Stokes <ian.stokes at intel.com>
If ice_cfg_phy_fec() goes through case ICE_FEC_DIS_AUTO but the underlying
device firmware isn't the correct version, then the memory used to hold the PHY
capabilities output from the firmware isn't freed.
Fix this by making sure the memory is freed by jumping to the label that frees
the memory instead of returning from the version check immediately.
Signed-off-by: Eric Joyner <eric.joyner at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
---
drivers/net/ice/base/ice_common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 4a2421a896..c3d429828d 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -3845,8 +3845,10 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
break;
case ICE_FEC_DIS_AUTO:
/* Set No FEC and auto FEC */
- if (!ice_fw_supports_fec_dis_auto(hw))
- return ICE_ERR_NOT_SUPPORTED;
+ if (!ice_fw_supports_fec_dis_auto(hw)) {
+ status = ICE_ERR_NOT_SUPPORTED;
+ goto out;
+ }
cfg->link_fec_opt |= ICE_AQC_PHY_FEC_DIS;
/* fall-through */
case ICE_FEC_AUTO:
--
2.43.0
More information about the dev
mailing list