From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH] vhost: initialize postcopy ufd properly Date: Wed, 24 Oct 2018 12:20:41 +0200 Message-ID: References: <20181024093948.9539-1-tiwei.bie@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Tiwei Bie , zhihong.wang@intel.com, dev@dpdk.org Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id BAF231B12D for ; Wed, 24 Oct 2018 12:20:46 +0200 (CEST) In-Reply-To: <20181024093948.9539-1-tiwei.bie@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 10/24/18 11:39 AM, Tiwei Bie wrote: > 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; > Reviewed-by: Maxime Coquelin Thanks! Maxime