DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dan Gora <dg@adax.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, Dan Gora <dg@adax.com>, marc.sune@bisdn.de
Subject: [dpdk-dev] [PATCH 1/1] kni: fix segfault in rte_kni_get
Date: Thu, 28 Jun 2018 15:58:38 -0700	[thread overview]
Message-ID: <20180628225838.22732-1-dg@adax.com> (raw)

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

             reply	other threads:[~2018-06-28 22:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 22:58 Dan Gora [this message]
2018-08-01 16:44 ` Thomas Monjalon
2018-08-09  9:44 ` Ferruh Yigit
2018-08-09  9:52   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628225838.22732-1-dg@adax.com \
    --to=dg@adax.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=marc.sune@bisdn.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).