patch 'net/ice/base: fix resource leak' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Mon Aug 12 14:48:50 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=2458257e56ecddc177bff0cbb93f9028e819c3fe

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 2458257e56ecddc177bff0cbb93f9028e819c3fe Mon Sep 17 00:00:00 2001
From: Fabio Pricoco <fabio.pricoco at intel.com>
Date: Wed, 26 Jun 2024 12:40:57 +0100
Subject: [PATCH] net/ice/base: fix resource leak
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit e2072ba1b039a92f0f405a9533237a15404ef3a1 ]

When errors happen during OROM reads, the allocated buffer is not freed.
Fix it by adding a goto label to free the buffer in case of error.

Fixes: ac882a0eda69 ("net/ice/base: store NVM version in extracted format")

Signed-off-by: Fabio Pricoco <fabio.pricoco at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/ice/base/ice_nvm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_nvm.c b/drivers/net/ice/base/ice_nvm.c
index e46aded12a..c112d3a27e 100644
--- a/drivers/net/ice/base/ice_nvm.c
+++ b/drivers/net/ice/base/ice_nvm.c
@@ -749,7 +749,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 				       orom_data, hw->flash.banks.orom_size);
 	if (status) {
 		ice_debug(hw, ICE_DBG_NVM, "Unable to read Option ROM data\n");
-		return status;
+		goto exit_error;;
 	}
 
 	/* Scan the memory buffer to locate the CIVD data section */
@@ -773,7 +773,8 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		if (sum) {
 			ice_debug(hw, ICE_DBG_NVM, "Found CIVD data with invalid checksum of %u\n",
 				  sum);
-			goto err_invalid_checksum;
+			status = ICE_ERR_NVM;
+			goto exit_error;
 		}
 
 		*civd = *tmp;
@@ -781,11 +782,12 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
 		return ICE_SUCCESS;
 	}
 
+	status = ICE_ERR_NVM;
 	ice_debug(hw, ICE_DBG_NVM, "Unable to locate CIVD data within the Option ROM\n");
 
-err_invalid_checksum:
+exit_error:
 	ice_free(hw, orom_data);
-	return ICE_ERR_NVM;
+	return status;
 }
 
 /**
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:04.303305057 +0800
+++ 0053-net-ice-base-fix-resource-leak.patch	2024-08-12 20:44:02.075069291 +0800
@@ -1 +1 @@
-From e2072ba1b039a92f0f405a9533237a15404ef3a1 Mon Sep 17 00:00:00 2001
+From 2458257e56ecddc177bff0cbb93f9028e819c3fe Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit e2072ba1b039a92f0f405a9533237a15404ef3a1 ]
@@ -10 +12,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
-index 9cebe7a07b..55e624cb31 100644
+index e46aded12a..c112d3a27e 100644
@@ -23 +25 @@
-@@ -748,7 +748,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
+@@ -749,7 +749,7 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
@@ -32 +34 @@
-@@ -772,7 +772,8 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
+@@ -773,7 +773,8 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
@@ -42,2 +44,2 @@
-@@ -780,11 +781,12 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
- 		return 0;
+@@ -781,11 +782,12 @@ ice_get_orom_civd_data(struct ice_hw *hw, enum ice_bank_select bank,
+ 		return ICE_SUCCESS;


More information about the stable mailing list