[libvirt] [PATCH] qemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader

Michal Privoznik posted 1 patch 6 years, 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/fa3b51071157885c40d76e3f18a7fdb2e6e74b39.1490875582.git.mprivozn@redhat.com
src/qemu/qemu_driver.c | 1 +
1 file changed, 1 insertion(+)
[libvirt] [PATCH] qemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader
Posted by Michal Privoznik 6 years, 12 months ago
In 9e2465834 a check that denies internal snapshots when pflash
based loader is configured for the domain. However, if there's
none and an user tries to do an internal snapshot they will
witness daemon crash as in that case vm->def->os.loader is NULL
and we dereference it unconditionally.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 40c2eab..3cc4f4d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13889,6 +13889,7 @@ qemuDomainSnapshotPrepare(virConnectPtr conn,
      * Avoid the issues by forbidding internal snapshot with pflash completely.
      */
     if (found_internal &&
+        vm->def->os.loader &&
         vm->def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("internal snapshots of a VM with pflash based "
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader
Posted by Peter Krempa 6 years, 12 months ago
On Thu, Mar 30, 2017 at 14:06:22 +0200, Michal Privoznik wrote:
> In 9e2465834 a check that denies internal snapshots when pflash
> based loader is configured for the domain. However, if there's
> none and an user tries to do an internal snapshot they will
> witness daemon crash as in that case vm->def->os.loader is NULL
> and we dereference it unconditionally.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_driver.c | 1 +
>  1 file changed, 1 insertion(+)

OOPS, ACK, safe for freeze.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list