Commit 8f2faa83 authored by Pan Bian's avatar Pan Bian Committed by Greg Kroah-Hartman

ext4: avoid drop reference to iloc.bh twice

commit 8c380ab4 upstream.

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: fb265c9c("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases")
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: stable@kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e9f94dc2
...@@ -874,6 +874,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment