From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 33302A00E6 for ; Tue, 16 Apr 2019 16:39:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 222F41B4D3; Tue, 16 Apr 2019 16:39:00 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5394F1B4E3 for ; Tue, 16 Apr 2019 16:38:57 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B68593199369; Tue, 16 Apr 2019 14:38:56 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A2291001E92; Tue, 16 Apr 2019 14:38:54 +0000 (UTC) From: Kevin Traynor To: Anoob Joseph Cc: Ankur Dwivedi , Fiona Trahe , Akhil Goyal , dpdk stable Date: Tue, 16 Apr 2019 15:37:06 +0100 Message-Id: <20190416143719.21601-48-ktraynor@redhat.com> In-Reply-To: <20190416143719.21601-1-ktraynor@redhat.com> References: <20190416143719.21601-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 16 Apr 2019 14:38:56 +0000 (UTC) Subject: [dpdk-stable] patch 'cryptodev: fix driver name comparison' has been queued to LTS release 18.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/24/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >From 8a2facefbc4c7478c8f528715822fb1b852bccb7 Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Mon, 11 Mar 2019 05:55:44 +0000 Subject: [PATCH] cryptodev: fix driver name comparison [ upstream commit 2382aa8c8f5820a5783b32a82e364a63d486183f ] The string compare to the length of driver name might give false positives when there are drivers with similar names (one being the subset of another). Following is such a naming which could result in false positive. 1. crypto_driver 2. crypto_driver1 When strncmp with len = strlen("crypto_driver") is done, it could give a false positive when compared against "crypto_driver1". For such cases, 'strlen + 1' is done, so that the NULL termination also would be considered for the comparison. Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices") Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph Acked-by: Fiona Trahe Acked-by: Akhil Goyal --- lib/librte_cryptodev/rte_cryptodev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index a52eaaa45..ff8520cf7 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -577,5 +577,5 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices, cmp = strncmp(devs[i].device->driver->name, driver_name, - strlen(driver_name)); + strlen(driver_name) + 1); if (cmp == 0) @@ -1572,5 +1572,5 @@ rte_cryptodev_driver_id_get(const char *name) TAILQ_FOREACH(driver, &cryptodev_driver_list, next) { driver_name = driver->driver->name; - if (strncmp(driver_name, name, strlen(driver_name)) == 0) + if (strncmp(driver_name, name, strlen(driver_name) + 1) == 0) return driver->id; } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-04-16 15:34:27.351563111 +0100 +++ 0048-cryptodev-fix-driver-name-comparison.patch 2019-04-16 15:34:25.223178996 +0100 @@ -1,8 +1,10 @@ -From 2382aa8c8f5820a5783b32a82e364a63d486183f Mon Sep 17 00:00:00 2001 +From 8a2facefbc4c7478c8f528715822fb1b852bccb7 Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Mon, 11 Mar 2019 05:55:44 +0000 Subject: [PATCH] cryptodev: fix driver name comparison +[ upstream commit 2382aa8c8f5820a5783b32a82e364a63d486183f ] + The string compare to the length of driver name might give false positives when there are drivers with similar names (one being the subset of another). @@ -17,7 +19,6 @@ considered for the comparison. Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices") -Cc: stable@dpdk.org Signed-off-by: Ankur Dwivedi Signed-off-by: Anoob Joseph @@ -28,17 +29,17 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c -index 700973530..871d7dda8 100644 +index a52eaaa45..ff8520cf7 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c -@@ -587,5 +587,5 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices, +@@ -577,5 +577,5 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices, cmp = strncmp(devs[i].device->driver->name, driver_name, - strlen(driver_name)); + strlen(driver_name) + 1); if (cmp == 0) -@@ -1692,5 +1692,5 @@ rte_cryptodev_driver_id_get(const char *name) +@@ -1572,5 +1572,5 @@ rte_cryptodev_driver_id_get(const char *name) TAILQ_FOREACH(driver, &cryptodev_driver_list, next) { driver_name = driver->driver->name; - if (strncmp(driver_name, name, strlen(driver_name)) == 0)