Fix generic cgroup subsystem permission checks
authorChristian Poetzsch <christian.potzsch@imgtec.com>
Wed, 3 Jun 2015 11:07:33 +0000 (12:07 +0100)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:53:45 +0000 (13:53 -0800)
In 53b5e2f generic cgroup subsystem permission checks have been added.
When this is been done within procs_write an empty taskset is added to
the tasks css set. When a task later on migrates to a new group we see a
dmesg warning cause the mg_node isn't empty (cgroup.c:2086). Cause this
happens all the time this spams dmesg.

I am not really familiar with this code, but it looks to me like adding
the taskset is just a temporary action in this context. Therefore this
taskset should be removed after the actual check. This is what this fix
does.

This problem was seen and the fix tested on x86 using l-mr1 and master.

Change-Id: I9894d39e8b5692ef65149002b07e65a84a33ffea
Signed-off-by: Christian Poetzsch <christian.potzsch@imgtec.com>
kernel/cgroup.c

index de6515d19279b0da17b45ff8cc938b325366e667..ad495f0f59bb4f701a048ef59a09c274cdb83a22 100644 (file)
@@ -2729,6 +2729,7 @@ static int cgroup_procs_write_permission(struct task_struct *task,
                cset = task_css_set(task);
                list_add(&cset->mg_node, &tset.src_csets);
                ret = cgroup_allow_attach(dst_cgrp, &tset);
+               list_del(&tset.src_csets);
                if (ret)
                        ret = -EACCES;
        }