[PATCH 5/6] lxc: Avoid possible NULL dereference on *root prior to opendir().

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

 



If running on older Linux without mounted cgroups then its possible that
*root would be NULL.
---
 src/lxc/lxc_container.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index d3a2968..d234426 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1762,6 +1762,12 @@ static int lxcContainerIdentifyCGroups(struct lxcContainerCGroup **mountsret,
         VIR_DEBUG("Grabbed '%s'", mntent.mnt_dir);
     }
 
+    if (!*root) {
+        VIR_DEBUG("No mounted cgroups found");
+        ret = 0;
+        goto cleanup;
+    }
+
     VIR_DEBUG("Checking for symlinks in %s", *root);
     if (!(dh = opendir(*root))) {
         virReportSystemError(errno,
-- 
1.7.11.7

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