From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alban Crequy , Tejun Heo Subject: [PATCH 3.16 206/357] cgroup: reject cgroup names with \n Date: Fri, 3 Oct 2014 14:29:52 -0700 Message-Id: <20141003212939.725161035@linuxfoundation.org> In-Reply-To: <20141003212933.458851516@linuxfoundation.org> References: <20141003212933.458851516@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alban Crequy commit 71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 upstream. /proc//cgroup contains one cgroup path on each line. If cgroup names are allowed to contain "\n", applications cannot parse /proc//cgroup safely. Signed-off-by: Alban Crequy Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- kernel/cgroup.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4393,6 +4393,11 @@ static int cgroup_mkdir(struct kernfs_no struct kernfs_node *kn; int ssid, ret; + /* Do not accept '\n' to prevent making /proc//cgroup unparsable. + */ + if (strchr(name, '\n')) + return -EINVAL; + parent = cgroup_kn_lock_live(parent_kn); if (!parent) return -ENODEV;