cgroup: reject cgroup names with '\n'
/proc/<pid>/cgroup contains one cgroup path on each line. If cgroup names are allowed to contain "\n", applications cannot parse /proc/<pid>/cgroup safely. Signed-off-by: Alban Crequy <alban.crequy@collabora.co.uk> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
This commit is contained in:
parent
7d1311b93e
commit
71b1fb5c44
@ -4543,6 +4543,11 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
|
|||||||
struct cftype *base_files;
|
struct cftype *base_files;
|
||||||
int ssid, ret;
|
int ssid, ret;
|
||||||
|
|
||||||
|
/* Do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable.
|
||||||
|
*/
|
||||||
|
if (strchr(name, '\n'))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
parent = cgroup_kn_lock_live(parent_kn);
|
parent = cgroup_kn_lock_live(parent_kn);
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
Loading…
Reference in New Issue
Block a user