[CRIU] [PATCH] mount: cgroup -- Fix nil dereference

Cyrill Gorcunov gorcunov at openvz.org
Tue Sep 13 05:26:09 PDT 2016


In case if there is no CLONE_NEWCGROUP on root
namespace mask the @private member remains nil
and comparision in mounts_sb_equal leads to nil
dereference.

CC: Tycho Andersen <tycho.andersen at canonical.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/mount.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/criu/mount.c b/criu/mount.c
index fe120a17ca69..ca757562da96 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -296,7 +296,9 @@ static bool mounts_sb_equal(struct mount_info *a, struct mount_info *b)
 			return false;
 	}
 
-	if (a->fstype->code == FSTYPE__CGROUP && strcmp(a->private, b->private))
+	if (a->fstype->code == FSTYPE__CGROUP &&
+	    a->private && b->private &&
+	    strcmp(a->private, b->private))
 		return false;
 
 	return a->s_dev == b->s_dev && !strcmp(a->source, b->source);
-- 
2.7.4



More information about the CRIU mailing list