From: Tejun Heo Date: Sat, 8 Feb 2014 15:26:33 +0000 (-0500) Subject: cgroup: fix error return value in cgroup_mount() X-Git-Tag: v3.12.14~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7737f595e8f566d41ef9f91246816bfbed4b7a87;p=thirdparty%2Fkernel%2Fstable.git cgroup: fix error return value in cgroup_mount() commit eb46bf89696972b856a9adb6aebd5c7b65c266e4 upstream. When cgroup_mount() fails to allocate an id for the root, it didn't set ret before jumping to unlock_drop ending up returning 0 after a failure. Fix it. Signed-off-by: Tejun Heo Acked-by: Li Zefan Signed-off-by: Jiri Slaby --- diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b6fd78344c53c..8ea46f2c4b515 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1612,10 +1612,10 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, mutex_lock(&cgroup_mutex); mutex_lock(&cgroup_root_mutex); - root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp, - 0, 1, GFP_KERNEL); - if (root_cgrp->id < 0) + ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL); + if (ret < 0) goto unlock_drop; + root_cgrp->id = ret; /* Check for name clashes with existing mounts */ ret = -EBUSY;