DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anurag Mandal <anurag.mandal@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, anatoly.burakov@intel.com,
	Anurag Mandal <anurag.mandal@intel.com>,
	stable@dpdk.org
Subject: [PATCH] net/ice: fix PHY capabilities buffer leak
Date: Wed, 30 Sep 2026 16:52:30 +0000	[thread overview]
Message-ID: <20260930165230.342989-1-anurag.mandal@intel.com> (raw)

ice_phy_conf_link() allocates the PHY capabilities buffer and only
then validates hw->port_info.
If hw->port_info is NULL,it returns directly without freeing
PHY capabilities buffer causing the buffer leak.

This patch fixes the issue by moving the hw->port_info NULL check
above the PHY capabilities buffer allocation.

Fixes: 36afbc269081 ("net/ice: support link speed change")
Cc: stable@dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal@intel.com>
---
 drivers/net/intel/ice/ice_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/intel/ice/ice_ethdev.c b/drivers/net/intel/ice/ice_ethdev.c
index 2c5ffe07f3..dd23a7555c 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -5253,14 +5253,14 @@ ice_phy_conf_link(struct ice_hw *hw,
 	u64 phy_type_low = 0;
 	u64 phy_type_high = 0;
 
+	if (!pi)
+		return -EIO;
+
 	phy_caps = (struct ice_aqc_get_phy_caps_data *)
 		ice_malloc(hw, sizeof(*phy_caps));
 	if (!phy_caps)
 		return ICE_ERR_NO_MEMORY;
 
-	if (!pi)
-		return -EIO;
-
 
 	if (ice_fw_supports_report_dflt_cfg(pi->hw))
 		err = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_DFLT_CFG,
-- 
2.34.1


             reply	other threads:[~2026-09-30 16:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 16:52 Anurag Mandal [this message]
2026-10-06  9:57 ` [PATCH] net/ice: fix PHY capabilities buffer leak Burakov, Anatoly
2026-10-06 14:00   ` Bruce Richardson

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=20260930165230.342989-1-anurag.mandal@intel.com \
    --to=anurag.mandal@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --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