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

Tycho Andersen tycho.andersen at canonical.com
Tue Sep 13 07:58:14 PDT 2016


On Tue, Sep 13, 2016 at 03:26:09PM +0300, Cyrill Gorcunov wrote:
> 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>

Acked-by: Tycho Andersen <tycho.andersen at canonical.com>

Whoops, thanks :)

> 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