Skip to content

Commit 95efbc2

Browse files
htejungregkh
authored andcommitted
cgroup: fix error return value in cgroup_mount()
commit eb46bf8 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 <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3a9c76c commit 95efbc2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎kernel/cgroup.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,10 +1580,10 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
15801580
mutex_lock(&cgroup_mutex);
15811581
mutex_lock(&cgroup_root_mutex);
15821582

1583-
root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
1584-
0, 1, GFP_KERNEL);
1585-
if (root_cgrp->id < 0)
1583+
ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL);
1584+
if (ret < 0)
15861585
goto unlock_drop;
1586+
root_cgrp->id = ret;
15871587

15881588
/* Check for name clashes with existing mounts */
15891589
ret = -EBUSY;

0 commit comments

Comments
 (0)