diff mbox series

vfio/pci: Fix failure to close file descriptor on error

Message ID 153487789207.20513.6642364712339067528.stgit@gimli.home
State New
Headers show
Series vfio/pci: Fix failure to close file descriptor on error | expand

Commit Message

Alex Williamson Aug. 21, 2018, 6:58 p.m. UTC
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")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 hw/vfio/common.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Peter Xu Aug. 22, 2018, 2:49 a.m. UTC | #1
On Tue, Aug 21, 2018 at 12:58:53PM -0600, Alex Williamson wrote:
> 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")
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

Regards,
diff mbox series

Patch

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 3f31f80b1280..7c185e5a2e79 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;
         }