Skip to contentSkip to conversation

net/virtio: fix missing listen FD initialization

PATCH Applied Maxime Coquelin 4 participants 4 messages Feb 1, 2021 – Feb 2, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/net/virtio/virtio_user/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user/vhost_user.c +1 -0
index ec2c53c8fb..f8569f6e6f 100644
@@ -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) {
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Maxime Coquelin

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

We put the Bugzilla ID: tag before Fixes:.

Quoted 20 lines
---
 drivers/net/virtio/virtio_user/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user/vhost_user.c +1 -1
index ec2c53c8fb..f8569f6e6f 100644
@@ -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) {
--
Quoted 2 lines

2.29.2

Signature · 1 line
David Marchand
Tested-by on v1 1/1
#2 lore raw
In reply to Maxime Coquelin

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Monday, February 1, 2021 5:33 PM
To: [email protected]; Wang, Yinan <[email protected]>; Xia, Chenbo <[email protected]>; [email protected]; [email protected]; Ling, WeiX <[email protected]>; Jiang, YuX <[email protected]>
Cc: Maxime Coquelin <[email protected]>; Zhou, JunX W <[email protected]>
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
---
 drivers/net/virtio/virtio_user/vhost_user.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/virtio/virtio_user/vhost_user.c +1 -0
index ec2c53c8fb..f8569f6e6f 100644
@@ -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) {

--
2.29.2

Applied
#3 lore raw
Quoted 10 lines · JunX W

-----Original Message-----
From: Maxime Coquelin [mailto:[email protected]]
Sent: Monday, February 1, 2021 5:33 PM
To: [email protected]; Wang, Yinan <[email protected]>; Xia, Chenbo <[email protected]>; [email protected]; [email protected]; Ling, WeiX <[email protected]>; Jiang, YuX <[email protected]>
Cc: Maxime Coquelin <[email protected]>; Zhou, JunX W <[email protected]>
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.

Bugzilla ID: 630

Quoted 9 lines
Fixes 949735312f5e ("net/virtio: move vhost-user specifics to its backend")

Applied to dpdk-next-net/main, thanks.