From mboxrd@z Thu Jan 1 00:00:00 1970 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 02:41:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,420,1534834800"; d="scan'208";a="98114194" Received: from btwcube1.sh.intel.com ([10.67.104.158]) by fmsmga002.fm.intel.com with ESMTP; 24 Oct 2018 02:41:11 -0700 From: Tiwei Bie To: maxime.coquelin@redhat.com, zhihong.wang@intel.com, dev@dpdk.org Date: Wed, 24 Oct 2018 17:39:48 +0800 Message-Id: <20181024093948.9539-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] vhost: initialize postcopy ufd properly 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: Wed, 24 Oct 2018 09:41:14 -0000 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