[PATCH v2] app/pdump: check lcore is not the maximum core
Reshma Pattan
reshma.pattan at intel.com
Mon Feb 21 11:19:44 CET 2022
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 at intel.com
Cc: stable at dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan at intel.com>
---
app/pdump/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index 04a38e8911..7677a5f8f5 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -930,12 +930,15 @@ dump_packets(void)
return;
}
- lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
for (i = 0; i < num_tuples; i++) {
+ lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
+ if (lcore_id == RTE_MAX_LCORE)
+ rte_exit(EXIT_FAILURE,
+ "Max core limit %u reached for packet capture", lcore_id);
+
rte_eal_remote_launch(dump_packets_core,
&pdump_t[i], lcore_id);
- lcore_id = rte_get_next_lcore(lcore_id, 1, 0);
if (rte_eal_wait_lcore(lcore_id) < 0)
rte_exit(EXIT_FAILURE, "failed to wait\n");
--
2.27.0
More information about the stable
mailing list