]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Check virGetLastError return value for migration finish failure
authorJohn Ferlan <jferlan@redhat.com>
Tue, 1 Sep 2015 10:47:55 +0000 (06:47 -0400)
committerCole Robinson <crobinso@redhat.com>
Tue, 22 Sep 2015 00:18:04 +0000 (20:18 -0400)
Commit id '2e7cea243' added a check for an error from Finish instead
of 'unexpected error'; however, if for some reason there wasn't an
error, then virGetLastError could return NULL resulting in the
NULL pointer deref to err->domain.

(cherry picked from commit ea3c5f25eb94f08d2a54385362c7ad60c6b1854e)

src/libvirt-domain.c
src/qemu/qemu_migration.c

index 837933f31a21b1634a5e91c1319d9113d982759a..5cd1ca6df7f5d2e532d803bbc4e029dae8eacfae 100644 (file)
@@ -3195,7 +3195,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
                 orig_err->domain == VIR_FROM_QEMU &&
                 orig_err->code == VIR_ERR_OPERATION_FAILED) {
                 virErrorPtr err = virGetLastError();
-                if (err->domain == VIR_FROM_QEMU &&
+                if (err &&
+                    err->domain == VIR_FROM_QEMU &&
                     err->code != VIR_ERR_MIGRATE_FINISH_OK) {
                     virFreeError(orig_err);
                     orig_err = NULL;
index ff89ab5f1e77907ee70709f0cce90e10712ecc38..d50d3675d7afb41e75fadab9655bec3484079b01 100644 (file)
@@ -5023,7 +5023,8 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
                 orig_err->domain == VIR_FROM_QEMU &&
                 orig_err->code == VIR_ERR_OPERATION_FAILED) {
                 virErrorPtr err = virGetLastError();
-                if (err->domain == VIR_FROM_QEMU &&
+                if (err &&
+                    err->domain == VIR_FROM_QEMU &&
                     err->code != VIR_ERR_MIGRATE_FINISH_OK) {
                     virFreeError(orig_err);
                     orig_err = NULL;