]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: prevent SIGSEGV in qemuProcessHandleDumpCompleted
authorNikolai Barybin <nikolai.barybin@virtuozzo.com>
Tue, 27 Jun 2023 08:43:58 +0000 (11:43 +0300)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 27 Jun 2023 10:39:50 +0000 (12:39 +0200)
If VIR_ASYNC_JOB_NONE flag is present, job.current is equal
to NULL, which leads to SIGSEGV. Thus, this check should be
moved up.

Fixes: v8.0.0-427-gf304de0df6
Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_process.c

index d3b1bdf6a4fa0ecc3010460fb455c68f9201364a..db069914502609ff6b3cd7be92e2149dec9833c4 100644 (file)
@@ -1601,11 +1601,11 @@ qemuProcessHandleDumpCompleted(qemuMonitor *mon G_GNUC_UNUSED,
               vm, vm->def->name, stats, NULLSTR(error));
 
     jobPriv = vm->job->privateData;
-    privJobCurrent = vm->job->current->privateData;
     if (vm->job->asyncJob == VIR_ASYNC_JOB_NONE) {
         VIR_DEBUG("got DUMP_COMPLETED event without a dump_completed job");
         goto cleanup;
     }
+    privJobCurrent = vm->job->current->privateData;
     jobPriv->dumpCompleted = true;
     privJobCurrent->stats.dump = *stats;
     vm->job->error = g_strdup(error);