From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0BD1A046B for ; Tue, 23 Jul 2019 03:02:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BABE1BF74; Tue, 23 Jul 2019 03:02:41 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1A7851BEF8 for ; Tue, 23 Jul 2019 03:02:40 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Jul 2019 04:02:34 +0300 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x6N11HfT026580; Tue, 23 Jul 2019 04:02:32 +0300 From: Yongseok Koh To: Anoob Joseph Cc: Ankur Dwivedi , Fiona Trahe , Akhil Goyal , dpdk stable Date: Mon, 22 Jul 2019 18:00:10 -0700 Message-Id: <20190723010115.6446-43-yskoh@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723010115.6446-1-yskoh@mellanox.com> References: <20190723010115.6446-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'cryptodev: fix driver name comparison' has been queued to LTS release 17.11.7 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 17.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 07/27/19. So please shout if anyone has objection. 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. Yongseok --- >From 419290bfaa14ccc88cd2f3c1b21ea1f3d53c7a15 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 b8e14b8627..c9f2b6235f 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -495,7 +495,7 @@ 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) devices[count++] = devs[i].data->dev_id; @@ -1405,7 +1405,7 @@ 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; } return -1; -- 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-07-22 17:55:08.850020102 -0700 +++ 0043-cryptodev-fix-driver-name-comparison.patch 2019-07-22 17:55:06.072470000 -0700 @@ -1,8 +1,10 @@ -From 2382aa8c8f5820a5783b32a82e364a63d486183f Mon Sep 17 00:00:00 2001 +From 419290bfaa14ccc88cd2f3c1b21ea1f3d53c7a15 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,10 +29,10 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c -index 7009735306..871d7dda8b 100644 +index b8e14b8627..c9f2b6235f 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c -@@ -586,7 +586,7 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices, +@@ -495,7 +495,7 @@ rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices, cmp = strncmp(devs[i].device->driver->name, driver_name, @@ -40,7 +41,7 @@ if (cmp == 0) devices[count++] = devs[i].data->dev_id; -@@ -1691,7 +1691,7 @@ rte_cryptodev_driver_id_get(const char *name) +@@ -1405,7 +1405,7 @@ rte_cryptodev_driver_id_get(const char *name) TAILQ_FOREACH(driver, &cryptodev_driver_list, next) { driver_name = driver->driver->name;