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 03AD04404F; Wed, 12 Jun 2024 17:09:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4131B4278E; Wed, 12 Jun 2024 17:03:57 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id D66254275C for ; Wed, 12 Jun 2024 17:03:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718204635; x=1749740635; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=339HT5V1/crVv73Ll/ouSkZpyv0k4OWleLnx7PXYTQQ=; b=SDdMVrgBKcBJTjIB3M6yW4Q795RHYWSDXdox3eFkoiegiiKPhGPvt2hQ d8gi4XS+H0CxszT6CxNQlCMCrbndkqkUCVqvoLD7k8xfHmYgmc5GA9GlV qGTgfZNPwnUktWd4ygLOM96WIzEqQUKMB7RXJhEg1VTV4XnUIy+t6xVRT s7z4u3lezO+qUFugpv6AD3uhzOipoSZkRWvz5bwTaOv33Yo431iWCwjcE 1ViLDHEWphZ25Wr7K6GSJpkW/+KXbzg45ph0AY8hQVoH5Ja3gTB1DdnTB b7bQsgGh/D982bYo9r7fhqjCF1Pu39wKz/YmnQNY7EpXX+8k4UZ42Te65 w==; X-CSE-ConnectionGUID: u8OUCoHwQo6Ffj7S4WtAbg== X-CSE-MsgGUID: PL/EU1H/TIyW/vJ1SzW+0g== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="32459248" X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="32459248" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 08:03:54 -0700 X-CSE-ConnectionGUID: VHAPdhtSTaWrpKwOPTyKMQ== X-CSE-MsgGUID: 1xRrhxynT+qKjSZTHqsP1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,233,1712646000"; d="scan'208";a="39924970" Received: from silpixa00401119.ir.intel.com ([10.55.129.167]) by orviesa009.jf.intel.com with ESMTP; 12 Jun 2024 08:03:53 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Ian Stokes , bruce.richardson@intel.com, Eric Joyner Subject: [PATCH v2 023/148] net/ice/base: fix memory leak when checking firmware version Date: Wed, 12 Jun 2024 16:00:17 +0100 Message-ID: <1f8ef2a03bede7e082e9d53860f70a57751982fa.1718204528.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20240430154014.1026-1-ian.stokes@intel.com> 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: Ian Stokes 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 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 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