提交 ecebf55d 编写于 作者: P Pan Bian 提交者: Jan Kara

ext2: fix potential use after free

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: NPan Bian <bianpan2016@163.com>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 e5f5b717
...@@ -612,9 +612,9 @@ bad_block: ext2_error(sb, "ext2_xattr_set", ...@@ -612,9 +612,9 @@ bad_block: ext2_error(sb, "ext2_xattr_set",
} }
cleanup: cleanup:
brelse(bh);
if (!(bh && header == HDR(bh))) if (!(bh && header == HDR(bh)))
kfree(header); kfree(header);
brelse(bh);
up_write(&EXT2_I(inode)->xattr_sem); up_write(&EXT2_I(inode)->xattr_sem);
return error; return error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册