Skip to content

Commit 7159a98

Browse files
Dan Carpentertytso
authored andcommitted
ext4: fix some error pointer dereferences
We can't pass error pointers to brelse(). Fixes: fb265c9 ("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
1 parent 793bc51 commit 7159a98

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ext4/xattr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
829829
bh = ext4_sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl, REQ_PRIO);
830830
if (IS_ERR(bh)) {
831831
ret = PTR_ERR(bh);
832+
bh = NULL;
832833
goto out;
833834
}
834835

@@ -2903,6 +2904,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
29032904
if (error == -EIO)
29042905
EXT4_ERROR_INODE(inode, "block %llu read error",
29052906
EXT4_I(inode)->i_file_acl);
2907+
bh = NULL;
29062908
goto cleanup;
29072909
}
29082910
error = ext4_xattr_check_block(inode, bh);
@@ -3059,6 +3061,7 @@ ext4_xattr_block_cache_find(struct inode *inode,
30593061
if (IS_ERR(bh)) {
30603062
if (PTR_ERR(bh) == -ENOMEM)
30613063
return NULL;
3064+
bh = NULL;
30623065
EXT4_ERROR_INODE(inode, "block %lu read error",
30633066
(unsigned long)ce->e_value);
30643067
} else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) {

0 commit comments

Comments
 (0)