patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/virtio_user: do not close invalid file descriptor
@ 2020-01-06 19:18 Stephen Hemminger
  2020-01-07  1:41 ` Tiwei Bie
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2020-01-06 19:18 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, jianfeng.tan, stable

Valgrind complains that virtio_user is calling close(-1).
Fix this by adding check in virtio that is similar to existing code.

Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer")
Cc: jianfeng.tan@intel.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index ea016e85d8af..ffbaa75b7e83 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -537,7 +537,8 @@ virtio_user_dev_uninit(struct virtio_user_dev *dev)
 		close(dev->kickfds[i]);
 	}
 
-	close(dev->vhostfd);
+	if (dev->vhostfd >= 0)
+		close(dev->vhostfd);
 
 	if (dev->is_server && dev->listenfd >= 0) {
 		close(dev->listenfd);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-09 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 19:18 [dpdk-stable] [PATCH] net/virtio_user: do not close invalid file descriptor Stephen Hemminger
2020-01-07  1:41 ` Tiwei Bie
2020-01-09 15:51   ` [dpdk-stable] [dpdk-dev] " Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).