aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-03-30 01:03:33 -0400
committerTejun Heo <tj@kernel.org>2012-03-30 01:03:33 -0400
commit8f121918f2e49f852de1acdc5255cc1ef440d85b (patch)
tree552dbbc407189e45b6941cf117b39681dc1f7e40 /kernel
parentad50c15919e8aca7ea30f9dcf4bac52448c9ab46 (diff)
cgroup: cgroup_attach_task() could return -errno after success
61d1d219c4 "cgroup: remove extra calls to find_existing_css_set" made cgroup_task_migrate() return void. An unfortunate side effect was that cgroup_attach_task() was depending on that function's return value to clear its @retval on the success path. On cgroup mounts without any subsystem with ->can_attach() callback, cgroup_attach_task() ended up returning @retval without initializing it on success. For some reason, gcc failed to warn about it and it didn't cause cgroup_attach_task() to return non-zero value in many cases, probably due to difference in register allocation. When the problem materializes, systemd fails to populate /systemd cgroup mount and fails to boot. Fix it by initializing @retval to zero on declaration. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Jiri Kosina <jkosina@suse.cz> LKML-Reference: <alpine.LNX.2.00.1203282354440.25526@pobox.suse.cz> Reviewed-by: Mandeep Singh Baines <msb@chromium.org> Acked-by: Li Zefan <lizefan@huawei.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f4ea4b6f3cf1..ed64ccac67c9 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1883,7 +1883,7 @@ static void cgroup_task_migrate(struct cgroup *cgrp, struct cgroup *oldcgrp,
1883 */ 1883 */
1884int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) 1884int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1885{ 1885{
1886 int retval; 1886 int retval = 0;
1887 struct cgroup_subsys *ss, *failed_ss = NULL; 1887 struct cgroup_subsys *ss, *failed_ss = NULL;
1888 struct cgroup *oldcgrp; 1888 struct cgroup *oldcgrp;
1889 struct cgroupfs_root *root = cgrp->root; 1889 struct cgroupfs_root *root = cgrp->root;