Skip to content

Commit

Permalink
cpuset: add a missing unlock in cpuset_write_resmask()
Browse files Browse the repository at this point in the history
Don't forget to release cgroup_mutex if alloc_trial_cpuset() fails.

[[email protected]: avoid multiple return points]
Signed-off-by: Li Zefan <[email protected]>
Cc: Paul Menage <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: Miao Xie <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Li Zefan authored and torvalds committed Mar 5, 2011
1 parent 2ec38a0 commit b75f38d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,8 +1575,10 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,
return -ENODEV;

trialcs = alloc_trial_cpuset(cs);
if (!trialcs)
return -ENOMEM;
if (!trialcs) {
retval = -ENOMEM;
goto out;
}

switch (cft->private) {
case FILE_CPULIST:
Expand All @@ -1591,6 +1593,7 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,
}

free_trial_cpuset(trialcs);
out:
cgroup_unlock();
return retval;
}
Expand Down

0 comments on commit b75f38d

Please sign in to comment.