patch 'app/testpmd: fix stack overflow for EEPROM display' has been queued to stable release 20.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 18 13:39:03 CET 2022


Hi,

FYI, your patch has been queued to stable release 20.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/20/22. 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://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/58767a90f4b169d62b4e42086473bec562ed3ab7

Thanks.

Luca Boccassi

---
>From 58767a90f4b169d62b4e42086473bec562ed3ab7 Mon Sep 17 00:00:00 2001
From: Steve Yang <stevex.yang at intel.com>
Date: Thu, 20 Jan 2022 02:59:31 +0000
Subject: [PATCH] app/testpmd: fix stack overflow for EEPROM display

[ upstream commit ff6db8829678396d2d10b3c29744d36149608982 ]

When the size of EEPROM exceeds the default thread stack size(8MB),
e.g.: 10MB size, it will crash due to stack overflow.

Allocate the data of EPPROM information on the heap.

Fixes: 6b67721dee2a ("app/testpmd: add EEPROM command")

Signed-off-by: Steve Yang <stevex.yang at intel.com>
Acked-by: Aman Singh <aman.deep.singh at intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 app/test-pmd/config.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 8e37602f6b..abe2cc394c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -797,10 +797,15 @@ port_eeprom_display(portid_t port_id)
 		return;
 	}
 
-	char buf[len_eeprom];
 	einfo.offset = 0;
 	einfo.length = len_eeprom;
-	einfo.data = buf;
+	einfo.data = calloc(1, len_eeprom);
+	if (!einfo.data) {
+		fprintf(stderr,
+			"Allocation of port %u eeprom data failed\n",
+			port_id);
+		return;
+	}
 
 	ret = rte_eth_dev_get_eeprom(port_id, &einfo);
 	if (ret != 0) {
@@ -818,10 +823,12 @@ port_eeprom_display(portid_t port_id)
 			printf("Unable to get EEPROM: %d\n", ret);
 			break;
 		}
+		free(einfo.data);
 		return;
 	}
 	rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
 	printf("Finish -- Port: %d EEPROM length: %d bytes\n", port_id, len_eeprom);
+	free(einfo.data);
 }
 
 void
@@ -856,10 +863,15 @@ port_module_eeprom_display(portid_t port_id)
 		return;
 	}
 
-	char buf[minfo.eeprom_len];
 	einfo.offset = 0;
 	einfo.length = minfo.eeprom_len;
-	einfo.data = buf;
+	einfo.data = calloc(1, minfo.eeprom_len);
+	if (!einfo.data) {
+		fprintf(stderr,
+			"Allocation of port %u eeprom data failed\n",
+			port_id);
+		return;
+	}
 
 	ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
 	if (ret != 0) {
@@ -877,11 +889,13 @@ port_module_eeprom_display(portid_t port_id)
 			printf("Unable to get module EEPROM: %d\n", ret);
 			break;
 		}
+		free(einfo.data);
 		return;
 	}
 
 	rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
 	printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length);
+	free(einfo.data);
 }
 
 void
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-18 12:37:41.481428216 +0000
+++ 0094-app-testpmd-fix-stack-overflow-for-EEPROM-display.patch	2022-02-18 12:37:37.822794868 +0000
@@ -1 +1 @@
-From ff6db8829678396d2d10b3c29744d36149608982 Mon Sep 17 00:00:00 2001
+From 58767a90f4b169d62b4e42086473bec562ed3ab7 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit ff6db8829678396d2d10b3c29744d36149608982 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -22 +23 @@
-index 1722d6c8f8..e812f57151 100644
+index 8e37602f6b..abe2cc394c 100644
@@ -25 +26 @@
-@@ -912,10 +912,15 @@ port_eeprom_display(portid_t port_id)
+@@ -797,10 +797,15 @@ port_eeprom_display(portid_t port_id)
@@ -43,2 +44,2 @@
-@@ -933,10 +938,12 @@ port_eeprom_display(portid_t port_id)
- 			fprintf(stderr, "Unable to get EEPROM: %d\n", ret);
+@@ -818,10 +823,12 @@ port_eeprom_display(portid_t port_id)
+ 			printf("Unable to get EEPROM: %d\n", ret);
@@ -56 +57 @@
-@@ -972,10 +979,15 @@ port_module_eeprom_display(portid_t port_id)
+@@ -856,10 +863,15 @@ port_module_eeprom_display(portid_t port_id)
@@ -74,2 +75,2 @@
-@@ -994,11 +1006,13 @@ port_module_eeprom_display(portid_t port_id)
- 				ret);
+@@ -877,11 +889,13 @@ port_module_eeprom_display(portid_t port_id)
+ 			printf("Unable to get module EEPROM: %d\n", ret);
@@ -87 +88 @@
- int
+ void


More information about the stable mailing list