From f591667964ca0d0681d2e44c5cd92f6643a8ec2e Mon Sep 17 00:00:00 2001 From: "dongx.yi" Date: Thu, 2 Jan 2020 11:33:12 -0500 Subject: [PATCH] virtio: Close fds when abnormal return. Here should add close(kickfd) and close(callfd) when abnornal return of failed to send VHOST_USER_SET_VRING_ENABLE. Do this as the same with upper abnormal return. Signed-off-by: dongx.yi Change-Id: Ic61fc3f398f582f64da6b3f6ca7e237a3d411a8f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479123 Community-CI: SPDK CI Jenkins Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- lib/virtio/virtio_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/virtio/virtio_user.c b/lib/virtio/virtio_user.c index 44c87681d..ab8efa2e1 100644 --- a/lib/virtio/virtio_user.c +++ b/lib/virtio/virtio_user.c @@ -483,6 +483,8 @@ virtio_user_setup_queue(struct virtio_dev *vdev, struct virtqueue *vq) if (rc < 0) { SPDK_ERRLOG("failed to send VHOST_USER_SET_VRING_ENABLE: %s\n", spdk_strerror(-rc)); + close(kickfd); + close(callfd); spdk_free(queue_mem); return -rc; }