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

Yongseok Koh yskoh at mellanox.com
Tue Jul 23 03:00:10 CEST 2019


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 <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 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 <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,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;


More information about the stable mailing list