--- kernel/cpuset.c
+++ kernel/cpuset.c
@@ -1525,8 +1525,10 @@ static int cpuset_write_resmask(struct c
return -ENODEV;
trialcs = alloc_trial_cpuset(cs);
- if (!trialcs)
- return -ENOMEM;
+ if (!trialcs) {
+ retval = -ENOMEM;
+ goto out;
+ }
switch (cft->private) {
case FILE_CPULIST:
@@ -1541,6 +1543,7 @@ static int cpuset_write_resmask(struct c
}
free_trial_cpuset(trialcs);
+out:
cgroup_unlock();
return retval;
}