[libvirt] [PATCH] qemu: fix operation job association when qemuCaps is NULL.

Jiri Denemark jdenemar at redhat.com
Mon Sep 23 10:25:00 UTC 2019


On Sat, Sep 21, 2019 at 13:55:22 -0300, jcfaracco at gmail.com wrote:
> From: Julio Faracco <jcfaracco at gmail.com>
> 
> Function qemuMigrationEatCookie() calls
> qemuMigrationCookieXMLParseStr(), when qemuCaps is not set, function
> assumes priv as a NULL pointer. At the end, function tries to set
> job info operation to the same current job. But, if priv is NULL due to
> missing qemuCaps, code returns a Null Pointer Exception. This commit
> adds an extra check to verify it.
> 
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
>  src/qemu/qemu_migration_cookie.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
> index 25d3fecd74..945b640e2c 100644
> --- a/src/qemu/qemu_migration_cookie.c
> +++ b/src/qemu/qemu_migration_cookie.c
> @@ -1538,7 +1538,8 @@ qemuMigrationEatCookie(virQEMUDriverPtr driver,
>          }
>      }
>  
> -    if (flags & QEMU_MIGRATION_COOKIE_STATS && mig->jobInfo)
> +    if (flags & QEMU_MIGRATION_COOKIE_STATS && mig->jobInfo &&
> +        priv && priv->job.current)
>          mig->jobInfo->operation = priv->job.current->operation;

Did you actually hit this somehow? If so, please provide a full
backtrace as the problem lies somewhere else and it should be fixed in a
different way. This would just hide incorrect usage of
qemuMigrationEatCookie, in which case it's better to crash.

Jirka




More information about the libvir-list mailing list