DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/pdump: check lcore is not the maximum core
@ 2022-02-18 15:18 Reshma Pattan
  2022-02-18 16:27 ` Stephen Hemminger
  2022-02-21 10:19 ` [PATCH v2] " Reshma Pattan
  0 siblings, 2 replies; 11+ messages in thread
From: Reshma Pattan @ 2022-02-18 15:18 UTC (permalink / raw)
  To: dev; +Cc: stephen, ferruh.yigit, Reshma Pattan, vipin.varghese, stable

Check lcore id value is not the maximum core supported.
Using lcore id without this check might cause
out of bound access inside the rte_eal_wait_lcore.

Coverity issue: 375841
Fixes: b2854d5317e8 ("app/pdump: support multi-core capture")
Cc: vipin.varghese@intel.com
Cc: stable@dpdk.org

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 app/pdump/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 04a38e8911..686c27d965 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -931,11 +931,19 @@ dump_packets(void)
 	}
 
 	lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
+	if (lcore_id == RTE_MAX_LCORE) {
+		printf("Invalid core %u for the packet capture!\n", lcore_id);
+		return;
+	}
 
 	for (i = 0; i < num_tuples; i++) {
 		rte_eal_remote_launch(dump_packets_core,
 				&pdump_t[i], lcore_id);
 		lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
+		if (lcore_id == RTE_MAX_LCORE) {
+			printf("Invalid core %u for the capture for the tuple=%d!\n", lcore_id, i);
+			return;
+		}
 
 		if (rte_eal_wait_lcore(lcore_id) < 0)
 			rte_exit(EXIT_FAILURE, "failed to wait\n");
-- 
2.25.1


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

end of thread, other threads:[~2022-03-08 15:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 15:18 [PATCH] app/pdump: check lcore is not the maximum core Reshma Pattan
2022-02-18 16:27 ` Stephen Hemminger
2022-02-21 10:19 ` [PATCH v2] " Reshma Pattan
2022-02-22 11:02   ` [PATCH v3] " Reshma Pattan
2022-02-25  9:59     ` Pattan, Reshma
2022-02-25 17:34     ` Stephen Hemminger
2022-02-28  9:58     ` [PATCH v4] " Reshma Pattan
2022-02-28 17:09       ` Stephen Hemminger
2022-03-08 13:47       ` Mcnamara, John
2022-03-08 14:27         ` Thomas Monjalon
2022-03-08 15:03           ` Mcnamara, John

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).