Re: [PATCHv2] blockinfo: fix qemu regression in handling disk name

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

 



On 08.09.2011 11:12, Eric Blake wrote:
> Regression introduced in commit 89b6284fd, due to an incorrect
> conversion to the new means of converting disk names back to
> the correct object.
> 
> * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Avoid NULL deref.
> ---
>  src/qemu/qemu_driver.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 1925ba5..f73270f 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7755,8 +7755,8 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
>      virStorageFileMetadata *meta = NULL;
>      virDomainDiskDefPtr disk = NULL;
>      struct stat sb;
> +    int i;
>      int format;
> -    const char *actual;
> 
>      virCheckFlags(0, -1);
> 
> @@ -7778,12 +7778,12 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
>      }
> 
>      /* Check the path belongs to this domain. */
> -    if (!(actual = virDomainDiskPathByName(vm->def, path))) {
> +    if ((i = virDomainDiskIndexByName(vm->def, path, false)) < 0) {
>          qemuReportError(VIR_ERR_INVALID_ARG,
>                          _("invalid path %s not assigned to domain"), path);
>          goto cleanup;
>      }
> -    path = actual;
> +    disk = vm->def->disks[i];
> 
>      /* The path is correct, now try to open it and get its size. */
>      fd = open(path, O_RDONLY);

In fact, we need to update path as well, beacuse we use it later (as can
be seen in context. but that is not the only place).

so ACK with this nit fixed.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]