From 761d57651c51365354cefb624883fccf62aee67d Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Thu, 5 Sep 2019 19:01:25 +0800 Subject: [PATCH] vhost: fix slave request fd leak We need to close the old slave request fd if any first before taking the new one. Fixes: 275c3f944730 ("vhost: support slave requests channel") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 0b72648a5a..f468436103 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1564,6 +1564,9 @@ vhost_user_set_req_fd(struct virtio_net **pdev, struct VhostUserMsg *msg, return RTE_VHOST_MSG_RESULT_ERR; } + if (dev->slave_req_fd >= 0) + close(dev->slave_req_fd); + dev->slave_req_fd = fd; return RTE_VHOST_MSG_RESULT_OK; -- 2.20.1