mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
ext2: fix potential use after free
commit ecebf55d27
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>
This commit is contained in:
parent
9c4a8f6f62
commit
4e443d70a1
1 changed files with 1 additions and 1 deletions
|
@ -609,9 +609,9 @@ bad_block: ext2_error(sb, "ext2_xattr_set",
|
|||
}
|
||||
|
||||
cleanup:
|
||||
brelse(bh);
|
||||
if (!(bh && header == HDR(bh)))
|
||||
kfree(header);
|
||||
brelse(bh);
|
||||
up_write(&EXT2_I(inode)->xattr_sem);
|
||||
|
||||
return error;
|
||||
|
|
Loading…
Reference in a new issue