DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix core number validation
@ 2018-12-20 10:00 Hari Kumar Vemula
  2018-12-21  8:27 ` David Marchand
  2019-01-02 14:23 ` David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: Hari Kumar Vemula @ 2018-12-20 10:00 UTC (permalink / raw)
  To: dev; +Cc: reshma.pattan, ferruh.yigit, Hari Kumar Vemula, stable

When incorrect core value or range provided,
as part of -l command line option, a crash occurs.

Added valid range checks to fix the crash.

Fixes: d888cb8b9613 ("eal: add core list input format")
Cc: stable@dpdk.org

Signed-off-by: Hari Kumar Vemula <hari.kumarx.vemula@intel.com>
---
 lib/librte_eal/common/eal_common_options.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index e31eca5c0..ea6bb508b 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -602,6 +602,14 @@ eal_parse_corelist(const char *corelist)
 			max = idx;
 			if (min == RTE_MAX_LCORE)
 				min = idx;
+			if ((unsigned int)idx >= cfg->lcore_count ||
+					(unsigned int)min >= cfg->lcore_count) {
+				RTE_LOG(ERR, EAL,
+					"Invalid core number given core range should be(0-%u)\n",
+					cfg->lcore_count);
+				return -1;
+			}
+
 			for (idx = min; idx <= max; idx++) {
 				if (cfg->lcore_role[idx] != ROLE_RTE) {
 					cfg->lcore_role[idx] = ROLE_RTE;
-- 
2.17.2

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

end of thread, other threads:[~2019-01-02 14:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 10:00 [dpdk-dev] [PATCH] eal: fix core number validation Hari Kumar Vemula
2018-12-21  8:27 ` David Marchand
2018-12-21  9:19   ` Burakov, Anatoly
2018-12-21  9:28     ` David Marchand
2019-01-02 12:47       ` Vemula, Hari KumarX
2019-01-02 14:23 ` David Marchand

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