[dpdk-dev] [PATCH] net/virtio: fix missing listen FD initialization

Zhou, JunX W junx.w.zhou at intel.com
Tue Feb 2 10:26:37 CET 2021

Tested-by: Zhou, Jun <junx.w.zhou at intel.com> 

-----Original Message-----
From: Maxime Coquelin [mailto:maxime.coquelin at redhat.com] 
Sent: Monday, February 1, 2021 5:33 PM
To: dev at dpdk.org; Wang, Yinan <yinan.wang at intel.com>; Xia, Chenbo <chenbo.xia at intel.com>; amorenoz at redhat.com; david.marchand at redhat.com; Ling, WeiX <weix.ling at intel.com>; Jiang, YuX <yux.jiang at intel.com>
Cc: Maxime Coquelin <maxime.coquelin at redhat.com>; Zhou, JunX W <junx.w.zhou at intel.com>
Subject: [PATCH] net/virtio: fix missing listen FD 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.

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

Reported-by: Jun W Zhou <junx.w.zhou at intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
 drivers/net/virtio/virtio_user/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index ec2c53c8fb..f8569f6e6f 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -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) {

More information about the dev mailing list