lkml.org 
[lkml]   [2019]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 240/305] ext2: fix potential use after free
    3.16.63-rc1 review patch.  If anyone has any objections, please let me know.

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

    From: Pan Bian <bianpan2016@163.com>

    commit ecebf55d27a11538ea84aee0be643dd953f830d5 upstream.

    The function ext2_xattr_set calls brelse(bh) to drop the reference count
    of bh. After that, bh may be freed. However, following brelse(bh),
    it reads bh->b_data via macro HDR(bh). This may result in a
    use-after-free bug. This patch moves brelse(bh) after reading field.

    Signed-off-by: Pan Bian <bianpan2016@163.com>
    Signed-off-by: Jan Kara <jack@suse.cz>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    fs/ext2/xattr.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/fs/ext2/xattr.c
    +++ b/fs/ext2/xattr.c
    @@ -606,9 +606,9 @@ skip_replace:
    }

    cleanup:
    - brelse(bh);
    if (!(bh && header == HDR(bh)))
    kfree(header);
    + brelse(bh);
    up_write(&EXT2_I(inode)->xattr_sem);

    return error;
    \
     
     \ /
      Last update: 2019-02-03 15:29    [W:5.523 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site