vhost: fix slave request fd leak

We need to close the old slave request fd if any first
before taking the new one.

Fixes: 275c3f9447 ("vhost: support slave requests channel")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
Tiwei Bie 2019-09-05 19:01:25 +08:00 committed by Ferruh Yigit
parent 039253166a
commit 761d57651c

View File

@ -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;