diff options
-rw-r--r-- | kernel/cgroup.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b2f203f25ec8..ad8eae5bb801 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/eventfd.h> | 60 | #include <linux/eventfd.h> |
61 | #include <linux/poll.h> | 61 | #include <linux/poll.h> |
62 | #include <linux/flex_array.h> /* used in cgroup_attach_proc */ | 62 | #include <linux/flex_array.h> /* used in cgroup_attach_proc */ |
63 | #include <linux/kthread.h> | ||
63 | 64 | ||
64 | #include <linux/atomic.h> | 65 | #include <linux/atomic.h> |
65 | 66 | ||
@@ -2225,6 +2226,18 @@ retry_find_task: | |||
2225 | 2226 | ||
2226 | if (threadgroup) | 2227 | if (threadgroup) |
2227 | tsk = tsk->group_leader; | 2228 | tsk = tsk->group_leader; |
2229 | |||
2230 | /* | ||
2231 | * Workqueue threads may acquire PF_THREAD_BOUND and become | ||
2232 | * trapped in a cpuset, or RT worker may be born in a cgroup | ||
2233 | * with no rt_runtime allocated. Just say no. | ||
2234 | */ | ||
2235 | if (tsk == kthreadd_task || (tsk->flags & PF_THREAD_BOUND)) { | ||
2236 | ret = -EINVAL; | ||
2237 | rcu_read_unlock(); | ||
2238 | goto out_unlock_cgroup; | ||
2239 | } | ||
2240 | |||
2228 | get_task_struct(tsk); | 2241 | get_task_struct(tsk); |
2229 | rcu_read_unlock(); | 2242 | rcu_read_unlock(); |
2230 | 2243 | ||