]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
migration: vmstate_save_state_v(): fix error path
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Tue, 28 Oct 2025 13:07:37 +0000 (16:07 +0300)
committerPeter Xu <peterx@redhat.com>
Mon, 3 Nov 2025 21:04:10 +0000 (16:04 -0500)
In case of pre_save_errp, on error, we continue processing fields,
unlike case of pre_save, where we return immediately. Behavior
for pre_save_errp case is wrong, we must return here, like for
pre_save.

 "migration: Add error-parameterized function variants in VMSD struct"

Fixes: 40de712a89
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Link: https://lore.kernel.org/r/20251028130738.29037-2-vsementsov@yandex-team.ru
Signed-off-by: Peter Xu <peterx@redhat.com>
migration/vmstate.c

index 81eadde553dd21a788cf1b06df9025a6097742d5..fd066f910e7d076fd345e52e6dfb7a462285cbdc 100644 (file)
@@ -443,6 +443,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
         if (ret < 0) {
             error_prepend(errp, "pre-save for %s failed, ret: %d: ",
                           vmsd->name, ret);
+            return ret;
         }
     } else if (vmsd->pre_save) {
         ret = vmsd->pre_save(opaque);