From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 0EA54595A for ; Tue, 3 Mar 2015 03:26:21 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 02 Mar 2015 18:26:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,679,1418112000"; d="scan'208";a="685918733" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 02 Mar 2015 18:26:19 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t232QHnA026862; Tue, 3 Mar 2015 10:26:17 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t232QE3Y030523; Tue, 3 Mar 2015 10:26:16 +0800 Received: (from hxie5@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t232QEO2030519; Tue, 3 Mar 2015 10:26:14 +0800 From: Huawei Xie To: dev@dpdk.org Date: Tue, 3 Mar 2015 10:26:04 +0800 Message-Id: <1425349564-30489-1-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [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: Tue, 03 Mar 2015 02:26:22 -0000 This patch fixes the segfault issue in the case vhost receives new VHOST_SET_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_vhost/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 == NULL) return -1; + /* 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); -- 1.8.1.4