From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08E34454EF; Tue, 25 Jun 2024 13:17:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CC1942DDF; Tue, 25 Jun 2024 13:15:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 0EEA9427C9; Tue, 25 Jun 2024 13:15:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719314133; x=1750850133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p1uKmns0jr4Q2K0EM1z3dDUPCx/LXSnANp6JGn3lVDo=; b=bZ6ZEWF0dbJBnmX1CYen5xdlj+kxyQ+dxpHSbIVVN+QKKQ9eiL8Vv6Ij AMY12sNwSg+CsF03KJ3KM1EJD/dytfsWoilkfMNqZkhVjXx5KJWLUabwr 2+XVSpLo4JWBR5RdVnc0fWRfF22skC0Pj3kQgHfTLZU3K6FxTI1TDV+iy V2XY9LSUQ2ztrJnZvPcXDzcVNOjaESAGB4+LTZ7weVGQyrsX4BqvahTZG 5vUNLEYZ5GHuXk7YlCY54yhdcLklqp2Qjyul0Y9wxb2janzDdOUZWXKIt jVY1HAKX43hdF0QnSx/oC5AZ0/ZeidD1gyu5K2usmoU9DKI/KVMimMdf+ g==; X-CSE-ConnectionGUID: iSmqLP3ER/KWVp0u0IJCtQ== X-CSE-MsgGUID: gcnOlSqqTDOgwXyobEIkCA== X-IronPort-AV: E=McAfee;i="6700,10204,11113"; a="16080105" X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="16080105" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2024 04:15:32 -0700 X-CSE-ConnectionGUID: P5iEtT47R6mqFmMFT8sPRw== X-CSE-MsgGUID: nz/62yhYRni+jFhbUmQj2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,263,1712646000"; d="scan'208";a="43719011" Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 25 Jun 2024 04:15:31 -0700 From: Anatoly Burakov To: dev@dpdk.org, Paul Greenwalt , Qi Zhang , Qiming Yang Cc: Eric Joyner , bruce.richardson@intel.com, ian.stokes@intel.com, stable@dpdk.org Subject: [PATCH v3 020/129] net/ice/base: fix memory leak when checking firmware version Date: Tue, 25 Jun 2024 12:12:25 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Eric Joyner 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. Fixes: 4b6ede113f55 ("net/ice/base: support auto FEC with FEC disabled") Cc: qi.z.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Eric Joyner Signed-off-by: Ian Stokes --- 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 3d787d2a29..ef6696cddf 100644 --- a/drivers/net/ice/base/ice_common.c +++ b/drivers/net/ice/base/ice_common.c @@ -3843,8 +3843,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