qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize
@ 2021-05-27 12:31 Kunkun Jiang
  2021-05-27 13:44 ` Philippe Mathieu-Daudé
  2021-06-15 11:42 ` Kunkun Jiang
  0 siblings, 2 replies; 5+ messages in thread
From: Kunkun Jiang @ 2021-05-27 12:31 UTC (permalink / raw)
  To: Alex Williamson, Kirti Wankhede, open list:All patches CC here
  Cc: Zenghui Yu, wanghaibin.wang, Kunkun Jiang, Keqian Zhu, ganqixin

In the vfio_migration_init(), the SaveVMHandler is registered for
VFIO device. But it lacks the operation of 'unregister'. It will
lead to 'Segmentation fault (core dumped)' in
qemu_savevm_state_setup(), if performing live migration after a
VFIO device is hot deleted.

Fixes: 7c2f5f75f94 (vfio: Register SaveVMHandlers for VFIO device)
Reported-by: Qixin Gan <ganqixin@huawei.com>
Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
 hw/vfio/migration.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 201642d75e..ef397ebe6c 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -892,6 +892,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev)
 
         remove_migration_state_change_notifier(&migration->migration_state);
         qemu_del_vm_change_state_handler(migration->vm_state);
+        unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev);
         vfio_migration_exit(vbasedev);
     }
 
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-15 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-27 12:31 [PATCH] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize Kunkun Jiang
2021-05-27 13:44 ` Philippe Mathieu-Daudé
2021-05-28  2:04   ` Kunkun Jiang
2021-05-28 18:27     ` Kirti Wankhede
2021-06-15 11:42 ` Kunkun Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).