summaryrefslogtreecommitdiff
path: root/lib/librte_kni/rte_kni.c
diff options
context:
space:
mode:
authorDan Gora <dg@adax.com>2018-06-28 15:58:38 -0700
committerThomas Monjalon <thomas@monjalon.net>2018-08-09 11:50:10 +0200
commite716b639856cc4baa46bc6d5bc63bcc1d6bd9cf9 (patch)
tree1a0f5633b39070f3cc8d03738dde39d8bbb829b8 /lib/librte_kni/rte_kni.c
parent7ca1e39af2160e85fe178b6d73e2e48fe2dde83c (diff)
downloaddpdk-e716b639856cc4baa46bc6d5bc63bcc1d6bd9cf9.zip
dpdk-e716b639856cc4baa46bc6d5bc63bcc1d6bd9cf9.tar.gz
dpdk-e716b639856cc4baa46bc6d5bc63bcc1d6bd9cf9.tar.xz
kni: fix crash with null name
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: stable@dpdk.org Signed-off-by: Dan Gora <dg@adax.com> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'lib/librte_kni/rte_kni.c')
-rw-r--r--lib/librte_kni/rte_kni.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 8a8f6c1..65f6a2b 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -715,6 +715,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];