diff options
author | Pan Bian <bianpan2016@163.com> | 2018-11-25 03:58:02 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-13 11:22:28 +0300 |
commit | 4dde2f5f7bcd80920193cb624e977d6cb30a52b8 (patch) | |
tree | 467ce629a0246ed566b459029811df49d38d5e82 /fs | |
parent | 9198b5bacc9e945bece211a3e383da135db60dd7 (diff) | |
download | linux-4dde2f5f7bcd80920193cb624e977d6cb30a52b8.tar.xz |
ext2: fix potential use after free
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.
CC: stable@vger.kernel.org
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/xattr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 91426141c33a..d5d6ec134d5c 100644 --- 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; |