Skip to content

Commit eb46bf8

Browse files
committed
cgroup: fix error return value in cgroup_mount()
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 <[email protected]> Acked-by: Li Zefan <[email protected]> Cc: [email protected]
1 parent ab3f5fa commit eb46bf8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/cgroup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,10 +1566,10 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
15661566
mutex_lock(&cgroup_mutex);
15671567
mutex_lock(&cgroup_root_mutex);
15681568

1569-
root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,
1570-
0, 1, GFP_KERNEL);
1571-
if (root_cgrp->id < 0)
1569+
ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL);
1570+
if (ret < 0)
15721571
goto unlock_drop;
1572+
root_cgrp->id = ret;
15731573

15741574
/* Check for name clashes with existing mounts */
15751575
ret = -EBUSY;

0 commit comments

Comments
 (0)