[libvirt] [PATCH 5/6] storage: gluster: Fix crash when initialization of storage backend fails

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


On 03/28/2014 04:01 PM, Peter Krempa wrote:
> The libgfapi function glfs_fini doesn't tolerate NULL pointers. Add a
> check on the error paths as it's possible to crash libvirtd if the
> gluster volume can't be initialized.
> ---
>  src/storage/storage_backend_gluster.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

ACK; safe for 1.2.3

> 
> diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
> index 5b79146..fe92f15 100644
> --- a/src/storage/storage_backend_gluster.c
> +++ b/src/storage/storage_backend_gluster.c
> @@ -548,7 +548,8 @@ virStorageFileBackendGlusterDeinit(virStorageFilePtr file)
>                file, file->hosts[0].name, file->path);
>      virStorageFileBackendGlusterPrivPtr priv = file->priv;
> 
> -    glfs_fini(priv->vol);
> +    if (priv->vol)
> +        glfs_fini(priv->vol);
>      VIR_FREE(priv->volname);
> 
>      VIR_FREE(priv);
> @@ -621,7 +622,8 @@ virStorageFileBackendGlusterInit(virStorageFilePtr file)
> 
>   error:
>      VIR_FREE(priv->volname);
> -    glfs_fini(priv->vol);
> +    if (priv->vol)
> +        glfs_fini(priv->vol);
>      VIR_FREE(priv);
> 
>      return -1;
> 

-- 
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/4339c9ba/attachment-0001.sig>


More information about the libvir-list mailing list