mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
ext4: avoid drop reference to iloc.bh twice
The reference to iloc.bh has been dropped in ext4_mark_iloc_dirty. However, the reference is dropped again if error occurs during ext4_handle_dirty_metadata, which may result in use-after-free bugs. Fixes: fb265c9cb49e("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases") Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz> Cc: stable@kernel.org
This commit is contained in:
parent
e5d01196c0
commit
8c380ab4b7
1 changed files with 1 additions and 0 deletions
|
@ -874,6 +874,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
|
||||||
err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh);
|
err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
ext4_std_error(sb, err);
|
ext4_std_error(sb, err);
|
||||||
|
iloc.bh = NULL;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
brelse(dind);
|
brelse(dind);
|
||||||
|
|
Loading…
Reference in a new issue