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

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

 



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(-)

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;
-- 
1.9.1

--
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]