aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-08-25 10:59:06 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-08-25 10:59:06 +0100
commit17182bb47fe62ac6a005b325a7007488056f3a2d (patch)
treeac4f5763a32e64df66f900ce1f14f33bd2a6ff64 /hw
parentcc9821fa9ac43728a7ece0a5e42e0147e6aadbf4 (diff)
parent154304cd6e99e4222ed762976f9d9aca33c094d3 (diff)
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20180823.1' into staging
VFIO fixes 2018-08-23 - Fix coverity reported issue with use of realpath (Alex Williamson) - Cleanup file descriptor in error path (Alex Williamson) - Fix postcopy use of new balloon inhibitor (Alex Williamson) # gpg: Signature made Thu 23 Aug 2018 17:46:41 BST # gpg: using RSA key 239B9B6E3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" # Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B 8A90 239B 9B6E 3BB0 8B22 * remotes/awilliam/tags/vfio-fixes-20180823.1: postcopy: Synchronize usage of the balloon inhibitor vfio/pci: Fix failure to close file descriptor on error vfio/pci: Handle subsystem realpath() returning NULL Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/vfio/common.c1
-rw-r--r--hw/vfio/pci.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 3f31f80b12..7c185e5a2e 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;
}
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 056f3a887a..866f0deeb7 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2879,7 +2879,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
tmp = g_strdup_printf("%s/subsystem", vdev->vbasedev.sysfsdev);
subsys = realpath(tmp, NULL);
g_free(tmp);
- is_mdev = (strcmp(subsys, "/sys/bus/mdev") == 0);
+ is_mdev = subsys && (strcmp(subsys, "/sys/bus/mdev") == 0);
free(subsys);
trace_vfio_mdev(vdev->vbasedev.name, is_mdev);