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