diff options
Diffstat (limited to 'kernel/cgroup/cgroup.c')
-rw-r--r-- | kernel/cgroup/cgroup.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 0b1ffe147f24..7e4c44538119 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c | |||
@@ -1397,7 +1397,7 @@ static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft, | |||
1397 | cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name, | 1397 | cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name, |
1398 | cft->name); | 1398 | cft->name); |
1399 | else | 1399 | else |
1400 | strncpy(buf, cft->name, CGROUP_FILE_NAME_MAX); | 1400 | strlcpy(buf, cft->name, CGROUP_FILE_NAME_MAX); |
1401 | return buf; | 1401 | return buf; |
1402 | } | 1402 | } |
1403 | 1403 | ||
@@ -1864,9 +1864,9 @@ void init_cgroup_root(struct cgroup_root *root, struct cgroup_sb_opts *opts) | |||
1864 | 1864 | ||
1865 | root->flags = opts->flags; | 1865 | root->flags = opts->flags; |
1866 | if (opts->release_agent) | 1866 | if (opts->release_agent) |
1867 | strcpy(root->release_agent_path, opts->release_agent); | 1867 | strlcpy(root->release_agent_path, opts->release_agent, PATH_MAX); |
1868 | if (opts->name) | 1868 | if (opts->name) |
1869 | strcpy(root->name, opts->name); | 1869 | strlcpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN); |
1870 | if (opts->cpuset_clone_children) | 1870 | if (opts->cpuset_clone_children) |
1871 | set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags); | 1871 | set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags); |
1872 | } | 1872 | } |
@@ -4125,26 +4125,24 @@ static void css_task_iter_advance_css_set(struct css_task_iter *it) | |||
4125 | 4125 | ||
4126 | static void css_task_iter_advance(struct css_task_iter *it) | 4126 | static void css_task_iter_advance(struct css_task_iter *it) |
4127 | { | 4127 | { |
4128 | struct list_head *l = it->task_pos; | 4128 | struct list_head *next; |
4129 | 4129 | ||
4130 | lockdep_assert_held(&css_set_lock); | 4130 | lockdep_assert_held(&css_set_lock); |
4131 | WARN_ON_ONCE(!l); | ||
4132 | |||
4133 | repeat: | 4131 | repeat: |
4134 | /* | 4132 | /* |
4135 | * Advance iterator to find next entry. cset->tasks is consumed | 4133 | * Advance iterator to find next entry. cset->tasks is consumed |
4136 | * first and then ->mg_tasks. After ->mg_tasks, we move onto the | 4134 | * first and then ->mg_tasks. After ->mg_tasks, we move onto the |
4137 | * next cset. | 4135 | * next cset. |
4138 | */ | 4136 | */ |
4139 | l = l->next; | 4137 | next = it->task_pos->next; |
4140 | 4138 | ||
4141 | if (l == it->tasks_head) | 4139 | if (next == it->tasks_head) |
4142 | l = it->mg_tasks_head->next; | 4140 | next = it->mg_tasks_head->next; |
4143 | 4141 | ||
4144 | if (l == it->mg_tasks_head) | 4142 | if (next == it->mg_tasks_head) |
4145 | css_task_iter_advance_css_set(it); | 4143 | css_task_iter_advance_css_set(it); |
4146 | else | 4144 | else |
4147 | it->task_pos = l; | 4145 | it->task_pos = next; |
4148 | 4146 | ||
4149 | /* if PROCS, skip over tasks which aren't group leaders */ | 4147 | /* if PROCS, skip over tasks which aren't group leaders */ |
4150 | if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos && | 4148 | if ((it->flags & CSS_TASK_ITER_PROCS) && it->task_pos && |
@@ -4449,6 +4447,7 @@ static struct cftype cgroup_base_files[] = { | |||
4449 | }, | 4447 | }, |
4450 | { | 4448 | { |
4451 | .name = "cgroup.threads", | 4449 | .name = "cgroup.threads", |
4450 | .flags = CFTYPE_NS_DELEGATABLE, | ||
4452 | .release = cgroup_procs_release, | 4451 | .release = cgroup_procs_release, |
4453 | .seq_start = cgroup_threads_start, | 4452 | .seq_start = cgroup_threads_start, |
4454 | .seq_next = cgroup_procs_next, | 4453 | .seq_next = cgroup_procs_next, |