[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] vfio: Fix unregister SaveVMHandler in vfio_migration_finaliz
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize |
Date: |
Thu, 27 May 2021 15:44:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 5/27/21 2:31 PM, Kunkun Jiang wrote:
> 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>
Cc: qemu-stable@nongnu.org
> ---
> 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);
Hmm what about devices using "%s/vfio" id?
> vfio_migration_exit(vbasedev);
> }
>
>