All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vdev: fix name comparison in find_vdev
@ 2018-03-09 22:28 Nachiketa Prachanda
  2018-03-12  2:51 ` Tan, Jianfeng
  0 siblings, 1 reply; 4+ messages in thread
From: Nachiketa Prachanda @ 2018-03-09 22:28 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: dev, Nachiketa Prachanda, jblunck, stable

Use strcmp to compare device names as the strncmp in original code
causes find_vdev to return -EEXIST  for names that are prefix
of another. The creation of interfaces fails unpredictably based
on the order of their creation. An easy way hit this bug is to create
eth_vhost1 after eth_vhost11.

Signed-off-by: Nachiketa Prachanda <nprachan@vyatta.att-mail.com>

Fixes: dda987315ca2 ("vdev: make virtual bus use its device struct")
Cc: jblunck@infradead.org
Cc: stable@dpdk.org
---
 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index e4bc724..7eae319 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -188,7 +188,7 @@ find_vdev(const char *name)
 	TAILQ_FOREACH(dev, &vdev_device_list, next) {
 		const char *devname = rte_vdev_device_name(dev);
 
-		if (!strncmp(devname, name, strlen(name)))
+		if (!strcmp(devname, name))
 			return dev;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vdev: fix name comparison in find_vdev
  2018-03-09 22:28 [PATCH] vdev: fix name comparison in find_vdev Nachiketa Prachanda
@ 2018-03-12  2:51 ` Tan, Jianfeng
  2018-03-12 16:54   ` [PATCH v2] " Nachiketa Prachanda
  0 siblings, 1 reply; 4+ messages in thread
From: Tan, Jianfeng @ 2018-03-12  2:51 UTC (permalink / raw)
  To: Nachiketa Prachanda; +Cc: dev, jblunck, stable

Hi,


On 3/10/2018 6:28 AM, Nachiketa Prachanda wrote:
> Use strcmp to compare device names as the strncmp in original code
> causes find_vdev to return -EEXIST  for names that are prefix
> of another. The creation of interfaces fails unpredictably based
> on the order of their creation. An easy way hit this bug is to create
> eth_vhost1 after eth_vhost11.
>
> Signed-off-by: Nachiketa Prachanda <nprachan@vyatta.att-mail.com>

Except a nit bellow:

Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>

>
> Fixes: dda987315ca2 ("vdev: make virtual bus use its device struct")
> Cc: jblunck@infradead.org
> Cc: stable@dpdk.org

AFAIK, we usually put above line before Signed-off-by.

> ---
>   drivers/bus/vdev/vdev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
> index e4bc724..7eae319 100644
> --- a/drivers/bus/vdev/vdev.c
> +++ b/drivers/bus/vdev/vdev.c
> @@ -188,7 +188,7 @@ find_vdev(const char *name)
>   	TAILQ_FOREACH(dev, &vdev_device_list, next) {
>   		const char *devname = rte_vdev_device_name(dev);
>   
> -		if (!strncmp(devname, name, strlen(name)))
> +		if (!strcmp(devname, name))
>   			return dev;
>   	}
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] vdev: fix name comparison in find_vdev
  2018-03-12  2:51 ` Tan, Jianfeng
@ 2018-03-12 16:54   ` Nachiketa Prachanda
  2018-03-27 22:35     ` [dpdk-stable] " Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Nachiketa Prachanda @ 2018-03-12 16:54 UTC (permalink / raw)
  To: Jianfeng Tan; +Cc: dev, Nachiketa Prachanda, jblunck, stable

Use strcmp to compare device names as the strncmp in original code
causes find_vdev to return -EEXIST  for names that are prefix
of another. The creation of interfaces fails unpredictably based
on the order of their creation. An easy way hit this bug is to create
eth_vhost1 after eth_vhost11.

Fixes: dda987315ca2 ("vdev: make virtual bus use its device struct")
Cc: jblunck@infradead.org
Cc: stable@dpdk.org

Signed-off-by: Nachiketa Prachanda <nprachan@vyatta.att-mail.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
---

Notes:
     V2: No changes
    
     Move Signed-off-by line after Fixes.

 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index e4bc724..7eae319 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -188,7 +188,7 @@ find_vdev(const char *name)
 	TAILQ_FOREACH(dev, &vdev_device_list, next) {
 		const char *devname = rte_vdev_device_name(dev);
 
-		if (!strncmp(devname, name, strlen(name)))
+		if (!strcmp(devname, name))
 			return dev;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH v2] vdev: fix name comparison in find_vdev
  2018-03-12 16:54   ` [PATCH v2] " Nachiketa Prachanda
@ 2018-03-27 22:35     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-03-27 22:35 UTC (permalink / raw)
  To: Nachiketa Prachanda; +Cc: stable, Jianfeng Tan, dev, jblunck

12/03/2018 17:54, Nachiketa Prachanda:
> Use strcmp to compare device names as the strncmp in original code
> causes find_vdev to return -EEXIST  for names that are prefix
> of another. The creation of interfaces fails unpredictably based
> on the order of their creation. An easy way hit this bug is to create
> eth_vhost1 after eth_vhost11.
> 
> Fixes: dda987315ca2 ("vdev: make virtual bus use its device struct")
> Cc: jblunck@infradead.org
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nachiketa Prachanda <nprachan@vyatta.att-mail.com>
> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-27 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 22:28 [PATCH] vdev: fix name comparison in find_vdev Nachiketa Prachanda
2018-03-12  2:51 ` Tan, Jianfeng
2018-03-12 16:54   ` [PATCH v2] " Nachiketa Prachanda
2018-03-27 22:35     ` [dpdk-stable] " Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.