26ba25
From 25e634bffca2048bc0df66ff00a9c46f00d1c3c2 Mon Sep 17 00:00:00 2001
26ba25
From: Alex Williamson <alex.williamson@redhat.com>
26ba25
Date: Mon, 3 Dec 2018 22:02:16 +0000
26ba25
Subject: [PATCH 15/16] vfio/pci: Fix failure to close file descriptor on error
26ba25
26ba25
RH-Author: Alex Williamson <alex.williamson@redhat.com>
26ba25
Message-id: <154387453688.27651.6584558037969560928.stgit@gimli.home>
26ba25
Patchwork-id: 83240
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 6/7] vfio/pci: Fix failure to close file descriptor on error
26ba25
Bugzilla: 1650272
26ba25
RH-Acked-by: Peter Xu <peterx@redhat.com>
26ba25
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
26ba25
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
26ba25
RH-Acked-by: David Hildenbrand <david@redhat.com>
26ba25
26ba25
Bugzilla: 1650272
26ba25
26ba25
A new error path fails to close the device file descriptor when
26ba25
triggered by a ballooning incompatibility within the group.  Fix it.
26ba25
26ba25
Fixes: 238e91728503 ("vfio/ccw/pci: Allow devices to opt-in for ballooning")
26ba25
Reviewed-by: Peter Xu <peterx@redhat.com>
26ba25
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
26ba25
(cherry picked from commit 8709b3954d4161bad30ccc435408ec50e10f53cc)
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 hw/vfio/common.c | 1 +
26ba25
 1 file changed, 1 insertion(+)
26ba25
26ba25
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
26ba25
index cda2d1f..3ab92bd 100644
26ba25
--- a/hw/vfio/common.c
26ba25
+++ b/hw/vfio/common.c
26ba25
@@ -1424,6 +1424,7 @@ int vfio_get_device(VFIOGroup *group, const char *name,
26ba25
         if (!QLIST_EMPTY(&group->device_list)) {
26ba25
             error_setg(errp,
26ba25
                        "Inconsistent device balloon setting within group");
26ba25
+            close(fd);
26ba25
             return -1;
26ba25
         }
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25