cpuset: add a missing unlock in cpuset_write_resmask()
authorLi Zefan <[email protected]>
Sat, 5 Mar 2011 01:36:21 +0000 (17:36 -0800)
committerLinus Torvalds <[email protected]>
Sat, 5 Mar 2011 01:53:38 +0000 (17:53 -0800)
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]>
kernel/cpuset.c

index 4349935c2ad8b1a252e18ce18a2be8b638a6a075..e92e981890321a7cc73beb11a8b32edf19d6a17c 100644 (file)
@@ -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:
@@ -1591,6 +1593,7 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft,
        }
 
        free_trial_cpuset(trialcs);
+out:
        cgroup_unlock();
        return retval;
 }