lkml.org 
[lkml]   [2014]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.13 005/163] cgroup: reject cgroup names with '\n'
    Date
    3.13.11.9 -stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Alban Crequy <alban.crequy@collabora.co.uk>

    commit 71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 upstream.

    /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>
    [ kamal: backport to 3.13-stable: fixed in cgroup_create() ]
    Signed-off-by: Kamal Mostafa <kamal@canonical.com>
    ---
    kernel/cgroup.c | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/kernel/cgroup.c b/kernel/cgroup.c
    index b44dd49..8e5e0a9 100644
    --- a/kernel/cgroup.c
    +++ b/kernel/cgroup.c
    @@ -4350,6 +4350,11 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
    struct cgroup_subsys *ss;
    struct super_block *sb = root->sb;

    + /* Do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable.
    + */
    + if (strchr(dentry->d_name.name, '\n'))
    + return -EINVAL;
    +
    /* allocate the cgroup and its ID, 0 is reserved for the root */
    cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
    if (!cgrp)
    --
    1.9.1


    \
     
     \ /
      Last update: 2014-10-09 23:41    [W:4.089 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site