From: Tiwei Bie Date: Wed, 24 Oct 2018 09:39:48 +0000 (+0800) Subject: vhost: initialize postcopy ufd properly X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0dcdf32e642df5b2f3a82d3ebd639322b147c0ca;p=dpdk.git vhost: initialize postcopy ufd properly 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 Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 047ee535c4..70ac6bc9c4 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;