DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/1] kni: fix segfault in rte_kni_get
@ 2018-06-28 22:58 Dan Gora
  2018-08-01 16:44 ` Thomas Monjalon
  2018-08-09  9:44 ` Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Gora @ 2018-06-28 22:58 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Dan Gora, marc.sune

Fix a segmentation fault which occurs when the kni_autotest is run
in the 'test' application.

This segmenation fault occurs when rte_kni_get() is called with a
NULL value for 'name'.

Fixes: 0c6bc8ef70ba ("kni: memzone pool for alloc and release")
Cc: marc.sune@bisdn.de

Signed-off-by: Dan Gora <dg@adax.com>
---
 lib/librte_kni/rte_kni.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index aa3559306..c4199e6ab 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -744,6 +744,9 @@ rte_kni_get(const char *name)
 	struct rte_kni_memzone_slot *it;
 	struct rte_kni *kni;
 
+	if (name == NULL || name[0] == '\0')
+		return NULL;
+
 	/* Note: could be improved perf-wise if necessary */
 	for (i = 0; i < kni_memzone_pool.max_ifaces; i++) {
 		it = &kni_memzone_pool.slots[i];
-- 
2.18.0.rc1.1.g6f333ff2f

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

end of thread, other threads:[~2018-08-09  9:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 22:58 [dpdk-dev] [PATCH 1/1] kni: fix segfault in rte_kni_get Dan Gora
2018-08-01 16:44 ` Thomas Monjalon
2018-08-09  9:44 ` Ferruh Yigit
2018-08-09  9:52   ` Thomas Monjalon

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