[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Fix the crash in qemuDomainBlockCopyCommon



On Mon, Apr 27, 2015 at 15:38:57 +0800, Shanzhi Yu wrote:
> The crash caused when checking the backing file path of a disk while
> the disk has no backing file, add a check before using disk->src->backingStore->path
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1215569
> ---
>  src/qemu/qemu_driver.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 70bf7aa..175d00b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16816,6 +16816,15 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
>          goto endjob;
>  
>      if ((flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW) &&
> +        !disk->src->backingStore) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("disk '%s' has no backing file, so shallow copy "
> +                         "is not possible"),

Well, we can also discard the SHALLOW flag in case the backing file is
not present since it will behave semantically correctly that way.


> +                       disk->src->path);
> +        goto endjob;
> +    }
> +
> +    if ((flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW) &&
>          mirror->format == VIR_STORAGE_FILE_RAW &&
>          disk->src->backingStore->path) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,

The docs correctly state that for shallow copy the reused file has to
have the same guest visible contents as the backing file of the current
file so this condition can be removed altogether fixing the crash.

I'll post a different approach soon.

Peter

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]