qemu-e2k/hw
Avihai Horon 5c4dbcb748 vfio/migration: Fix NULL pointer dereference bug
As part of its error flow, vfio_vmstate_change() accesses
MigrationState->to_dst_file without any checks. This can cause a NULL
pointer dereference if the error flow is taken and
MigrationState->to_dst_file is not set.

For example, this can happen if VM is started or stopped not during
migration and vfio_vmstate_change() error flow is taken, as
MigrationState->to_dst_file is not set at that time.

Fix it by checking that MigrationState->to_dst_file is set before using
it.

Fixes: 02a7e71b1e ("vfio: Add VM state change handler to know state of VM")
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Link: https://lore.kernel.org/r/20230216143630.25610-3-avihaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2023-02-16 12:13:46 -07:00
..
9pfs Don't include headers already included by qemu/osdep.h 2023-02-08 07:28:05 +01:00
acpi Drop duplicate #include 2023-02-08 07:28:05 +01:00
adc
alpha Drop duplicate #include 2023-02-08 07:28:05 +01:00
arm Drop duplicate #include 2023-02-08 07:28:05 +01:00
audio
avr
block virtio-blk: add missing AioContext lock 2023-02-09 10:21:23 -05:00
char include/hw: Do not include "hw/registerfields.h" in headers that don't need it 2023-02-14 09:02:42 +01:00
core Drop duplicate #include 2023-02-08 07:28:05 +01:00
cpu hw/cpu: Mark arm11 and realview mpcore as target-independent code 2023-01-16 17:51:20 +01:00
cris
cxl hw/cxl/cxl-host: Fix an error message typo 2023-01-17 10:02:37 +01:00
display Do not include "qemu/error-report.h" in headers that do not need it 2023-02-14 09:11:27 +01:00
dma bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
gpio
hppa Drop duplicate #include 2023-02-08 07:28:05 +01:00
hyperv Fix non-first inclusions of qemu/osdep.h 2023-02-08 07:28:05 +01:00
i2c Don't include headers already included by qemu/osdep.h 2023-02-08 07:28:05 +01:00
i386 hw/misc/sga: Remove the deprecated "sga" device 2023-02-14 09:02:42 +01:00
ide
input hw/input: Clean up includes 2023-02-08 07:16:23 +01:00
intc target/arm: Mark up sysregs for HFGRTR bits 36..63 2023-02-03 12:59:23 +00:00
ipack
ipmi
isa hw/isa/isa-bus: Turn isa_build_aml() into qbus_build_aml() 2023-01-27 11:47:02 -05:00
loongarch Drop duplicate #include 2023-02-08 07:28:05 +01:00
m68k
mem
microblaze
mips hw/mips/boston: Rename MachineState 'mc' pointer to 'ms' 2023-01-13 16:22:57 +01:00
misc Do not include "qemu/error-report.h" in headers that do not need it 2023-02-14 09:11:27 +01:00
net Drop duplicate #include 2023-02-08 07:28:05 +01:00
nios2
nubus
nvme
nvram aspeed queue: 2023-02-07 20:13:38 +00:00
openrisc
pci pci: make sure pci_bus_is_express() won't error out with "discards ‘const’ qualifier" 2023-01-28 06:21:29 -05:00
pci-bridge pci: acpi hotplug: rename x-native-hotplug to x-do-not-expose-native-hotplug-cap 2023-01-28 06:21:29 -05:00
pci-host ppc/pnv/pci: Fix PHB xscom registers memory region name 2023-02-05 06:40:28 -03:00
pcmcia
ppc Drop duplicate #include 2023-02-08 07:28:05 +01:00
rdma Drop duplicate #include 2023-02-08 07:28:05 +01:00
remote Drop duplicate #include 2023-02-08 07:28:05 +01:00
riscv hw/riscv: virt: Simplify virt_{get,set}_aclint() 2023-02-07 08:21:32 +10:00
rtc Drop duplicate #include 2023-02-08 07:28:05 +01:00
rx
s390x migration: Rename res_{postcopy,precopy}_only 2023-02-15 20:04:30 +01:00
scsi block: Convert bdrv_refresh_total_sectors() to co_wrapper_mixed 2023-02-01 16:52:32 +01:00
sd
sensor Don't include headers already included by qemu/osdep.h 2023-02-08 07:28:05 +01:00
sh4 bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
smbios
sparc
sparc64 hw/sparc64/niagara: Use blk_name() instead of open-coding it 2023-01-20 07:25:01 +01:00
ssi include/hw: Do not include "hw/registerfields.h" in headers that don't need it 2023-02-14 09:02:42 +01:00
timer bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
tpm hw/tpm: Move tpm_ppi.c out of target-specific source set 2023-01-16 17:51:20 +01:00
tricore
usb Don't include headers already included by qemu/osdep.h 2023-02-08 07:28:05 +01:00
vfio vfio/migration: Fix NULL pointer dereference bug 2023-02-16 12:13:46 -07:00
virtio vhost-user-fs: Back up vqs before cleaning up vhost_dev 2023-02-09 10:21:11 -05:00
watchdog hw/watchdog/wdt_aspeed: Log unimplemented registers as UNIMP level 2023-02-07 09:02:05 +01:00
xen bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
xenpv
xtensa
Kconfig
meson.build