From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00191d01.pphosted.com (mx0b-00191d01.pphosted.com [67.231.157.136]) by dpdk.org (Postfix) with ESMTP id 86DF15F54; Fri, 9 Mar 2018 23:29:39 +0100 (CET) Received: from pps.filterd (m0083689.ppops.net [127.0.0.1]) by m0083689.ppops.net-00191d01. (8.16.0.21/8.16.0.21) with SMTP id w29MPNHC048672; Fri, 9 Mar 2018 17:29:38 -0500 Received: from tlpd255.enaf.dadc.sbc.com (sbcsmtp3.sbc.com [144.160.112.28]) by m0083689.ppops.net-00191d01. with ESMTP id 2gm2ss8e9w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Mar 2018 17:29:38 -0500 Received: from enaf.dadc.sbc.com (localhost [127.0.0.1]) by tlpd255.enaf.dadc.sbc.com (8.14.5/8.14.5) with ESMTP id w29MTboc089187; Fri, 9 Mar 2018 16:29:38 -0600 Received: from zlp30499.vci.att.com (zlp30499.vci.att.com [135.46.181.149]) by tlpd255.enaf.dadc.sbc.com (8.14.5/8.14.5) with ESMTP id w29MTXQH089088; Fri, 9 Mar 2018 16:29:33 -0600 Received: from zlp30499.vci.att.com (zlp30499.vci.att.com [127.0.0.1]) by zlp30499.vci.att.com (Service) with ESMTP id 0EB48400074D; Fri, 9 Mar 2018 22:29:33 +0000 (GMT) Received: from clpi183.sldc.sbc.com (unknown [135.41.1.46]) by zlp30499.vci.att.com (Service) with ESMTP id E7D9540006FE; Fri, 9 Mar 2018 22:29:32 +0000 (GMT) Received: from sldc.sbc.com (localhost [127.0.0.1]) by clpi183.sldc.sbc.com (8.14.5/8.14.5) with ESMTP id w29MTWMX011196; Fri, 9 Mar 2018 16:29:32 -0600 Received: from mail.eng.vyatta.net (mail.eng.vyatta.net [10.156.50.82]) by clpi183.sldc.sbc.com (8.14.5/8.14.5) with ESMTP id w29MTPjB010766; Fri, 9 Mar 2018 16:29:25 -0600 Received: from np439h-Precision-7520.eng.vyatta.net (unknown [10.156.48.111]) by mail.eng.vyatta.net (Postfix) with ESMTP id 21DE136004A; Fri, 9 Mar 2018 14:29:25 -0800 (PST) From: Nachiketa Prachanda To: Jianfeng Tan Cc: dev@dpdk.org, Nachiketa Prachanda , jblunck@infradead.org, stable@dpdk.org Date: Fri, 9 Mar 2018 14:28:38 -0800 Message-Id: <1520634518-3055-1-git-send-email-nprachan@vyatta.att-mail.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-09_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=675 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803090265 Subject: [dpdk-dev] [PATCH] vdev: fix name comparison in find_vdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 22:29:39 -0000 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 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