patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Paul Greenwalt <paul.greenwalt@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Qiming Yang <qiming.yang@intel.com>
Cc: Eric Joyner <eric.joyner@intel.com>,
	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	[thread overview]
Message-ID: <ea004d6ce7bfeef73f306a0f1973f6155644eb9b.1719313663.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1719313663.git.anatoly.burakov@intel.com>

From: Eric Joyner <eric.joyner@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.

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 <eric.joyner@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@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 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


       reply	other threads:[~2024-06-25 11:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1718204528.git.anatoly.burakov@intel.com>
     [not found] ` <cover.1719313663.git.anatoly.burakov@intel.com>
2024-06-25 11:12   ` Anatoly Burakov [this message]
2024-06-25 11:12   ` [PATCH v3 035/129] net/ice/base: fix sign-extension Anatoly Burakov
2024-06-25 11:14   ` [PATCH v3 115/129] net/ice/base: fix ice_get_ctx() issue Anatoly Burakov
     [not found]   ` <cover.1719401847.git.anatoly.burakov@intel.com>
2024-06-26 11:41     ` [PATCH v4 015/103] net/ice/base: fix sign-extension Anatoly Burakov
2024-06-26 11:41     ` [PATCH v4 050/103] net/ice/base: fix wrong definition of board type Anatoly Burakov
2024-06-26 11:42     ` [PATCH v4 086/103] net/ice/base: fix masking in ice_get_ctx() Anatoly Burakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea004d6ce7bfeef73f306a0f1973f6155644eb9b.1719313663.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=eric.joyner@intel.com \
    --cc=ian.stokes@intel.com \
    --cc=paul.greenwalt@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).