qemu/hw/vfio
Alex Williamson 85b6d2b5fc vfio/common: Fix vfio_iommu_type1_info use after free
On error, vfio_get_iommu_info() frees and clears *info, but
vfio_connect_container() continues to use the pointer regardless
of the return value.  Restructure the code such that a failure
of this function triggers an error and clean up the remainder of
the function, including updating an outdated comment that had
drifted from its relevant line of code and using host page size
for a default for better compatibility on non-4KB systems.

Reported-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/all/20220910004245.2878-1-nicolinc@nvidia.com/
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Link: https://lore.kernel.org/r/166326219630.3388898.12882473157184946072.stgit@omen
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2022-09-27 14:26:42 -06:00
..
amd-xgbe.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ap.c target/s390x: move kvm files into kvm/ 2021-07-07 14:01:59 +02:00
calxeda-xgmac.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ccw.c vfio-ccw: forward halt/clear errors 2021-09-06 16:22:54 +02:00
common.c vfio/common: Fix vfio_iommu_type1_info use after free 2022-09-27 14:26:42 -06:00
display.c ui/console: Do not return a value with ui_info 2022-06-14 10:34:37 +02:00
igd.c Mark remaining global TypeInfo instances as const 2022-02-21 13:30:20 +00:00
Kconfig hw/vfio: Move the IGD quirk code to a separate file 2020-02-06 11:55:42 -07:00
meson.build vfio: Add migration region initialization and finalize function 2020-11-01 12:30:50 -07:00
migration.c vfio/migration: Fix incorrect initialization value for parameters in VFIOMigration 2022-09-27 14:26:39 -06:00
pci-quirks.c hw/vfio/pci-quirks: Resolve redundant property getters 2022-05-24 10:38:50 +10:00
pci.c vfio/pci: Use vbasedev local variable in vfio_realize() 2022-05-06 09:06:50 -06:00
pci.h vfio: defer to commit kvm irq routing when enable msi/msix 2022-05-06 09:06:50 -06:00
platform.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
spapr.c Replace qemu_real_host_page variables with inlined functions 2022-04-06 10:50:38 +02:00
trace-events vfio/common: remove spurious warning on vfio_listener_region_del 2022-06-08 08:44:19 -06:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00