diff options
author | Tejun Heo <tj@kernel.org> | 2014-02-08 10:26:33 -0500 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-03-05 17:13:43 +0100 |
commit | 35fcf4dd2296b06b0ef042f203246dc73e6e3f02 (patch) | |
tree | b245855b9f187d4d78eb6fb4ed4a202db1fd580b /kernel/cgroup.c | |
parent | 7737f595e8f566d41ef9f91246816bfbed4b7a87 (diff) |
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 <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 8ea46f2c4b51..8103e8b66221 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4395,7 +4395,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; @@ -4405,8 +4405,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); /* @@ -4414,8 +4416,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 |