From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 77E01A6A for ; Wed, 4 Mar 2015 12:57:48 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 04 Mar 2015 03:57:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,687,1418112000"; d="scan'208";a="462359254" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by FMSMGA003.fm.intel.com with ESMTP; 04 Mar 2015 03:51:31 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.145]) by IRSMSX103.ger.corp.intel.com ([169.254.3.247]) with mapi id 14.03.0195.001; Wed, 4 Mar 2015 11:57:45 +0000 From: "Long, Thomas" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message Thread-Index: AQHQVVl18ybDBh3cKk6hTV1NG4hvVZ0MOGug Date: Wed, 4 Mar 2015 11:57:44 +0000 Message-ID: References: <1425349564-30489-1-git-send-email-huawei.xie@intel.com> In-Reply-To: <1425349564-30489-1-git-send-email-huawei.xie@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] lib/librte_vhost: remove vhost device from data plane when receive VHOST_SET_MEM_TABLE message X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2015 11:57:48 -0000 Acked-by: Tommy Long -----Original Message----- From: Xie, Huawei=20 Sent: Tuesday, March 3, 2015 2:26 AM To: dev@dpdk.org Cc: haifeng.lin@huawei.com; mukawa@igel.co.jp; Long, Thomas; Xie, Huawei Subject: [PATCH] lib/librte_vhost: remove vhost device from data plane when= receive VHOST_SET_MEM_TABLE message This patch fixes the segfault issue in the case vhost receives new VHOST_SE= T_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE(which we uses as the= stop message). Signed-off-by: Huawei Xie --- lib/librte_vhost/vhost_user/virtio-net-user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vho= st/vhost_user/virtio-net-user.c index 97c5177..aa08706 100644 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c @@ -109,6 +109,10 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct= VhostUserMsg *pmsg) if (dev =3D=3D NULL) return -1; =20 + /* Remove from the data plane. */ + if (dev->flags & VIRTIO_DEV_RUNNING) + notify_ops->destroy_device(dev); + if (dev->mem) { free_mem_region(dev); free(dev->mem); --=20 1.8.1.4