Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71b1fb5c authored by Alban Crequy's avatar Alban Crequy Committed by Tejun Heo
Browse files

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: default avatarAlban Crequy <alban.crequy@collabora.co.uk>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
parent 7d1311b9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4543,6 +4543,11 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
	struct cftype *base_files;
	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);
	if (!parent)
		return -ENODEV;