DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix PHY capabilities buffer leak
@ 2026-09-30 16:52 Anurag Mandal
  2026-10-06  9:57 ` Burakov, Anatoly
  0 siblings, 1 reply; 3+ messages in thread
From: Anurag Mandal @ 2026-09-30 16:52 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, anatoly.burakov, Anurag Mandal, stable

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-06 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30 16:52 [PATCH] net/ice: fix PHY capabilities buffer leak Anurag Mandal
2026-10-06  9:57 ` Burakov, Anatoly
2026-10-06 14:00   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox