From patchwork Fri Jun 23 12:41:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allain Legacy X-Patchwork-Id: 25658 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C0F523230; Fri, 23 Jun 2017 14:41:48 +0200 (CEST) Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by dpdk.org (Postfix) with ESMTP id 78ED6292D; Fri, 23 Jun 2017 14:41:46 +0200 (CEST) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id v5NCficv021677 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 23 Jun 2017 05:41:44 -0700 (PDT) Received: from yow-cgts4-lx.wrs.com (128.224.145.137) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 23 Jun 2017 05:41:44 -0700 From: Allain Legacy To: , CC: , Date: Fri, 23 Jun 2017 08:41:37 -0400 Message-ID: <20170623124137.61091-1-allain.legacy@windriver.com> X-Mailer: git-send-email 2.12.1 MIME-Version: 1.0 X-Originating-IP: [128.224.145.137] Subject: [dpdk-dev] [PATCH] net/virtio-user: fix crash when detaching device 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The rte_eth_dev.data pointer is set to a reference to a static table. Attempting to rte_free() it leads to a panic. For example, the following commands result in a panic if run in testpmd testpmd> port attach virtio_user0,path=/dev/vhost-net,iface=test0 testpmd> port stop 2 testpmd> port close 2 testpmd> port detach 2 Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device") Signed-off-by: Allain Legacy --- drivers/net/virtio/virtio_user_ethdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 280406c02..e9af946e8 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -556,7 +556,6 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev) virtio_user_dev_uninit(dev); rte_free(eth_dev->data->dev_private); - rte_free(eth_dev->data); rte_eth_dev_release_port(eth_dev); return 0;