Skip to content

Commit 53692ec

Browse files
vaverintytso
authored andcommitted
ext4: fix buffer leak in ext4_expand_extra_isize_ea() on error path
Fixes: de05ca8 ("ext4: move call to ext4_error() into ...") Signed-off-by: Vasily Averin <vvs@virtuozzo.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org # 4.17
1 parent 6bdc997 commit 53692ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/ext4/xattr.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,6 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
26982698
struct ext4_inode *raw_inode, handle_t *handle)
26992699
{
27002700
struct ext4_xattr_ibody_header *header;
2701-
struct buffer_head *bh;
27022701
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
27032702
static unsigned int mnt_count;
27042703
size_t min_offs;
@@ -2739,13 +2738,17 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
27392738
* EA block can hold new_extra_isize bytes.
27402739
*/
27412740
if (EXT4_I(inode)->i_file_acl) {
2741+
struct buffer_head *bh;
2742+
27422743
bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
27432744
error = -EIO;
27442745
if (!bh)
27452746
goto cleanup;
27462747
error = ext4_xattr_check_block(inode, bh);
2747-
if (error)
2748+
if (error) {
2749+
brelse(bh);
27482750
goto cleanup;
2751+
}
27492752
base = BHDR(bh);
27502753
end = bh->b_data + bh->b_size;
27512754
min_offs = end - base;

0 commit comments

Comments
 (0)