From: Nachiketa Prachanda Date: Mon, 12 Mar 2018 16:54:00 +0000 (-0700) Subject: bus/vdev: fix finding device by name X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=fada6963ce735048b2d40f215ff110cb2f4cb6a4;p=dpdk.git bus/vdev: fix finding device by name 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: stable@dpdk.org Signed-off-by: Nachiketa Prachanda Acked-by: Jianfeng Tan --- diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index e4bc724638..7eae319cbf 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; }