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

Peter Krempa pkrempa at redhat.com
Mon Apr 27 09:57:51 UTC 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150427/4c1e3eba/attachment-0001.sig>


More information about the libvir-list mailing list