From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: [PATCH] vhost: initialize postcopy ufd properly Date: Wed, 24 Oct 2018 17:39:48 +0800 Message-ID: <20181024093948.9539-1-tiwei.bie@intel.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 99DF95F19 for ; Wed, 24 Oct 2018 11:41:13 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently, postcopy_ufd is initialized to 0 implicitly, so fd 0 could be closed unexpectedly by vhost_backend_cleanup(). Fix this issue by initializing postcopy_ufd to -1 explicitly. Fixes: 9eefef3b5970 ("vhost: introduce postcopy advise message") Signed-off-by: Tiwei Bie --- lib/librte_vhost/vhost.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 047ee535c..70ac6bc9c 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -344,6 +344,7 @@ vhost_new_device(void) dev->flags = VIRTIO_DEV_BUILTIN_VIRTIO_NET; dev->slave_req_fd = -1; dev->vdpa_dev_id = -1; + dev->postcopy_ufd = -1; rte_spinlock_init(&dev->slave_req_lock); return i; -- 2.19.1