lkml.org 
[lkml]   [2018]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 32/49] getname_kernel() needs to make sure that ->name != ->iname in long case
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

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

    From: Al Viro <viro@zeniv.linux.org.uk>

    commit 30ce4d1903e1d8a7ccd110860a5eef3c638ed8be upstream.

    missed it in "kill struct filename.separate" several years ago.

    Cc: stable@vger.kernel.org
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/namei.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/fs/namei.c
    +++ b/fs/namei.c
    @@ -222,9 +222,10 @@ getname_kernel(const char * filename)
    if (len <= EMBEDDED_NAME_MAX) {
    result->name = (char *)result->iname;
    } else if (len <= PATH_MAX) {
    + const size_t size = offsetof(struct filename, iname[1]);
    struct filename *tmp;

    - tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
    + tmp = kmalloc(size, GFP_KERNEL);
    if (unlikely(!tmp)) {
    __putname(result);
    return ERR_PTR(-ENOMEM);

    \
     
     \ /
      Last update: 2018-04-17 18:33    [W:3.619 / U:0.148 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site