From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot0-f195.google.com (mail-ot0-f195.google.com [74.125.82.195]) by dpdk.org (Postfix) with ESMTP id D77B31B43B for ; Fri, 29 Jun 2018 00:58:57 +0200 (CEST) Received: by mail-ot0-f195.google.com with SMTP id h6-v6so7982118otj.0 for ; Thu, 28 Jun 2018 15:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=Gm8Z129vqSAAODSSMLiIcSNgPjR3xs48OV8Y88X6ISQ=; b=UK0m9aPMvzzruFevlqryceBxR1JaeOW4m9QiBJviMfXu2igZk2FMquy/0fRS+WErF1 gZWYBOf9yYNcWLmGckIH9UvdzMy0gnpJiQAuXMKT2XvVTV80v7GLswkHnBNP4pXaG7Z8 ReiMBtx7tR76661L9nqgAKwOS/D4U+N+SnBam8E8ba3xbQlo0X8qwi0rA30jZVeEp9wq Jy4r/g7+4aPxcHqphSVeMmOBQCCAr4HJwaXZbQ5L6IsMVONSkqknsOpmvd+9o51T3rcK Nfm5CuicsIIge012pgBfuw7vUTsB7DyeZXjnDyHYK/mICQO4UBcX2Ow+zkGunb6dSeZi stdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Gm8Z129vqSAAODSSMLiIcSNgPjR3xs48OV8Y88X6ISQ=; b=PdDlwA6KuUd77OpOIZQj1/lfuztsgtM+GaCNVePBJGsjAV4+CHbAyv5VcEI0IlCmRR RnMfeEscPhyKB5GKRPz5JR9eMAIejiKw4lkEYiTsE5M4/6rJHR+Wojj9U0YHrGWiCvTo +WKya20F7evMYiqgZ2kadrJCI6+7XXl1cUj0/3cljkMQ7EEXwXUIWg7/tpgA8sjQ+Efj YuXIu42P2VHM560R9N/derXaEbQokJV+uetUCXCCUz9ms0r9nxv300DYhjyz39NAAu+z 5QB1s5JWbrUFxu2diXnNVom5zCC093aZ8jLe/MjPES33MC7dJWQeLrKMDGLvi67krTZc 7qyQ== X-Gm-Message-State: APt69E1ojtXd1UU/fZJNZ6biF/D8EpMe4+urAKHFhVuBQ1dSd0BMzay/ owc3SGmB6EqUicdCV8B8tfg= X-Google-Smtp-Source: AAOMgpcQTr6NRb8bHqL9x9FGSCFTy3NO5/h/KfdGhB4XBs47pnHPIYGTys5gykf+GiIdPkizWTiHSw== X-Received: by 2002:a9d:4d85:: with SMTP id u5-v6mr6793347otk.157.1530226737096; Thu, 28 Jun 2018 15:58:57 -0700 (PDT) Received: from linux.adax.com (172-11-198-60.lightspeed.sntcca.sbcglobal.net. [172.11.198.60]) by smtp.gmail.com with ESMTPSA id l91-v6sm3837599otc.81.2018.06.28.15.58.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jun 2018 15:58:56 -0700 (PDT) Sender: Dan Gora From: Dan Gora To: Ferruh Yigit Cc: dev@dpdk.org, Dan Gora , marc.sune@bisdn.de Date: Thu, 28 Jun 2018 15:58:38 -0700 Message-Id: <20180628225838.22732-1-dg@adax.com> X-Mailer: git-send-email 2.18.0.rc1.1.g6f333ff2f Subject: [dpdk-dev] [PATCH 1/1] kni: fix segfault in rte_kni_get X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 22:58:58 -0000 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 --- 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