summary refs log tree commit diff stats
path: root/hw/vfio/common.c
diff options
context:
space:
mode:
authorAvihai Horon <avihaih@nvidia.com>2023-02-16 16:36:21 +0200
committerAlex Williamson <alex.williamson@redhat.com>2023-02-16 12:13:46 -0700
commit5c4dbcb7489463b8862d3e4fa2490f5fd3d683fe (patch)
tree7caf2b3dfe9c84763f501acfada192bfede1ce7e /hw/vfio/common.c
parent93d7620c251059c08ffb9cf09b27ec6497081b48 (diff)
downloadfocaccia-qemu-5c4dbcb7489463b8862d3e4fa2490f5fd3d683fe.tar.gz
focaccia-qemu-5c4dbcb7489463b8862d3e4fa2490f5fd3d683fe.zip
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: 02a7e71b1e5b ("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>
Diffstat (limited to 'hw/vfio/common.c')
0 files changed, 0 insertions, 0 deletions