[libvirt] [PATCH 6/6] util: storagefile: Don't pursue backing chain of NULL image

Eric Blake eblake at redhat.com
Fri Mar 28 22:09:09 UTC 2014


On 03/28/2014 04:01 PM, Peter Krempa wrote:
> When virStorageFileGetMetadata is called with NULL path argument, the
> invalid pointer boils down through the recursive worker and is caught by
> virHashAddEntry which is thankfully resistant to NULL arguments. As it
> doesn't make sense to pursue backing chains of NULL volumes, exit
> earlier.
> 
> This was noticed in the virt-aahelper-test with a slightly modified
> codebase.
> ---
>  src/util/virstoragefile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ACK; safe for 1.2.3

> 
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index c7384d1..8370d23 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -1118,7 +1118,7 @@ virStorageFileGetMetadata(const char *path, int format,
>      virHashTablePtr cycle = virHashCreate(5, NULL);
>      virStorageFileMetadataPtr ret;
> 
> -    if (!cycle)
> +    if (!cycle || !path)
>          return NULL;
> 
>      if (format <= VIR_STORAGE_FILE_NONE)
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140328/235814be/attachment-0001.sig>


More information about the libvir-list mailing list