net/virtio: fix listen file initialization
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Mon, 1 Feb 2021 09:33:17 +0000 (10:33 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 2 Feb 2021 23:48:11 +0000 (00:48 +0100)
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>
drivers/net/virtio/virtio_user/vhost_user.c

index ec2c53c..f8569f6 100644 (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) {