[dpdk-stable] patch 'cryptodev: fix driver name comparison' has been queued to LTS release 18.11.2

Kevin Traynor ktraynor at redhat.com
Tue Apr 16 16:37:06 CEST 2019


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 <anoobj at marvell.com>
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 <adwivedi at marvell.com>
Signed-off-by: Anoob Joseph <anoobj at marvell.com>
Acked-by: Fiona Trahe <fiona.trahe at intel.com>
Acked-by: Akhil Goyal <akhil.goyal at nxp.com>
---
 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 <anoobj at marvell.com>
 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 at dpdk.org
 
 Signed-off-by: Ankur Dwivedi <adwivedi at marvell.com>
 Signed-off-by: Anoob Joseph <anoobj at marvell.com>
@@ -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)


More information about the stable mailing list