Skip to content

Commit

Permalink
cgroup: fix error return value in cgroup_mount()
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
htejun committed Feb 8, 2014
1 parent ab3f5fa commit eb46bf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,10 +1566,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;
Expand Down

0 comments on commit eb46bf8

Please sign in to comment.