thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-vfio-pci-Fix-failure-to-close-file-descriptor-on-err.patch

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