]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Avoid possible NULL dereference on *root prior to opendir().
authorJohn Ferlan <jferlan@redhat.com>
Mon, 7 Jan 2013 17:09:33 +0000 (12:09 -0500)
committerEric Blake <eblake@redhat.com>
Tue, 8 Jan 2013 00:11:57 +0000 (17:11 -0700)
If running on older Linux without mounted cgroups then its possible that
*root would be NULL.

src/lxc/lxc_container.c

index d3a2968d3bb84df41673a924f7b08b92c15d6df0..d234426ff88d586de6b034aab4ae0f603cb37f83 100644 (file)
@@ -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,