From: Alex Williamson Date: Thu, 23 Aug 2018 16:45:58 +0000 (-0600) Subject: vfio/pci: Fix failure to close file descriptor on error X-Git-Tag: v3.1.0-rc0~111^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8709b3954d4161bad30ccc435408ec50e10f53cc;p=thirdparty%2Fqemu.git vfio/pci: Fix failure to close file descriptor on error 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 --- diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 3f31f80b128..7c185e5a2e7 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1432,6 +1432,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; }