From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00191d01.pphosted.com (mx0a-00191d01.pphosted.com [67.231.149.140]) by dpdk.org (Postfix) with ESMTP id D0648FEB; Mon, 12 Mar 2018 17:55:16 +0100 (CET) Received: from pps.filterd (m0053301.ppops.net [127.0.0.1]) by mx0a-00191d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w2CGtBKr016375; Mon, 12 Mar 2018 12:55:15 -0400 Received: from alpi155.enaf.aldc.att.com (sbcsmtp7.sbc.com [144.160.229.24]) by mx0a-00191d01.pphosted.com with ESMTP id 2gntcmmhur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Mar 2018 12:55:15 -0400 Received: from enaf.aldc.att.com (localhost [127.0.0.1]) by alpi155.enaf.aldc.att.com (8.14.5/8.14.5) with ESMTP id w2CGt5NC027528; Mon, 12 Mar 2018 12:55:05 -0400 Received: from zlp27126.vci.att.com (zlp27126.vci.att.com [135.66.87.47]) by alpi155.enaf.aldc.att.com (8.14.5/8.14.5) with ESMTP id w2CGt0xX027427; Mon, 12 Mar 2018 12:55:00 -0400 Received: from zlp27126.vci.att.com (zlp27126.vci.att.com [127.0.0.1]) by zlp27126.vci.att.com (Service) with ESMTP id 5FCEB4000392; Mon, 12 Mar 2018 16:55:00 +0000 (GMT) Received: from mlpi432.sfdc.sbc.com (unknown [144.151.223.11]) by zlp27126.vci.att.com (Service) with ESMTP id 49E7D4000391; Mon, 12 Mar 2018 16:55:00 +0000 (GMT) Received: from sfdc.sbc.com (localhost [127.0.0.1]) by mlpi432.sfdc.sbc.com (8.14.5/8.14.5) with ESMTP id w2CGt0OT019496; Mon, 12 Mar 2018 12:55:00 -0400 Received: from mail.eng.vyatta.net (mail.eng.vyatta.net [10.156.50.82]) by mlpi432.sfdc.sbc.com (8.14.5/8.14.5) with ESMTP id w2CGsqfo019305; Mon, 12 Mar 2018 12:54:52 -0400 Received: from localhost.localdomain (unknown [10.156.48.170]) by mail.eng.vyatta.net (Postfix) with ESMTP id C88183600F0; Mon, 12 Mar 2018 09:54:51 -0700 (PDT) From: Nachiketa Prachanda To: Jianfeng Tan Cc: dev@dpdk.org, Nachiketa Prachanda , jblunck@infradead.org, stable@dpdk.org Date: Mon, 12 Mar 2018 09:54:00 -0700 Message-Id: <1520873640-24067-1-git-send-email-nprachan@vyatta.att-mail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-12_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=892 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803120192 Subject: [dpdk-dev] [PATCH v2] 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: Mon, 12 Mar 2018 16:55:17 -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. Fixes: dda987315ca2 ("vdev: make virtual bus use its device struct") Cc: jblunck@infradead.org Cc: stable@dpdk.org Signed-off-by: Nachiketa Prachanda Acked-by: Jianfeng Tan --- 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