net/virtio: fix listen file initialization

When running in client mode, the listen file descriptor
is not initialized, and so has value 0. At destroy time,
the listen FD is closed if its value is greater than or
equal to zero, which causes STDIN to be closed.

Bugzilla ID: 630
Fixes: 949735312f5e ("net/virtio: move vhost-user specifics to its backend")

Reported-by: Jun W Zhou <junx.w.zhou@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
This commit is contained in:
Maxime Coquelin 2021-02-01 10:33:17 +01:00 committed by Ferruh Yigit
parent d700f0d0d7
commit 0ea5be8d25

View File

@ -831,6 +831,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
dev->backend_data = data;
data->vhostfd = -1;
data->listenfd = -1;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {