From: Tejun Heo Date: Sat, 8 Feb 2014 15:26:33 +0000 (-0500) Subject: cgroup: fix error return from cgroup_create() X-Git-Tag: v3.13.6~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a68fc0c2390d7a9da761733976bef093e9ae7e11;p=thirdparty%2Fkernel%2Fstable.git cgroup: fix error return from cgroup_create() commit b58c89986a77a23658682a100eb15d8edb571ebb upstream. cgroup_create() was returning 0 after allocation failures. Fix it. Signed-off-by: Tejun Heo Acked-by: Li Zefan Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 46ba3ebeed4d3..42c4ea3531c98 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4348,7 +4348,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, struct cgroup *cgrp; struct cgroup_name *name; struct cgroupfs_root *root = parent->root; - int err = 0; + int err; struct cgroup_subsys *ss; struct super_block *sb = root->sb; @@ -4358,8 +4358,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, return -ENOMEM; name = cgroup_alloc_name(dentry); - if (!name) + if (!name) { + err = -ENOMEM; goto err_free_cgrp; + } rcu_assign_pointer(cgrp->name, name); /* @@ -4367,8 +4369,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, * a half-baked cgroup. */ cgrp->id = idr_alloc(&root->cgroup_idr, NULL, 1, 0, GFP_KERNEL); - if (cgrp->id < 0) + if (cgrp->id < 0) { + err = -ENOMEM; goto err_free_name; + } /* * Only live parents can have children. Note that the liveliness