From: Tiwei Bie Date: Thu, 5 Sep 2019 11:01:25 +0000 (+0800) Subject: vhost: fix slave request fd leak X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=761d57651c51365354cefb624883fccf62aee67d;p=dpdk.git 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 --- 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;