提交 67e627fb 编写于 作者: D Dan Carpenter 提交者: Xie XiuQi

ext4: fix some error pointer dereferences

mainline inclusion
from mainline-5.1-rc1
commit 7159a986b4202343f6cca3bb8079ecace5816fd6
category: bugfix
bugzilla: 12934
CVE: NA

-------------------------------------------------

We can't pass error pointers to brelse().

Fixes: fb265c9cb49e ("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
Reviewed-by: NJan Kara <jack@suse.cz>
Signed-off-by: Nkoulihong <koulihong@huawei.com>
Reviewed-by: Nyangerkun <yangerkun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3165579d
...@@ -829,6 +829,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage) ...@@ -829,6 +829,7 @@ int ext4_get_inode_usage(struct inode *inode, qsize_t *usage)
bh = ext4_sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl, REQ_PRIO); bh = ext4_sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl, REQ_PRIO);
if (IS_ERR(bh)) { if (IS_ERR(bh)) {
ret = PTR_ERR(bh); ret = PTR_ERR(bh);
bh = NULL;
goto out; goto out;
} }
...@@ -2907,6 +2908,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode, ...@@ -2907,6 +2908,7 @@ int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode,
if (error == -EIO) if (error == -EIO)
EXT4_ERROR_INODE(inode, "block %llu read error", EXT4_ERROR_INODE(inode, "block %llu read error",
EXT4_I(inode)->i_file_acl); EXT4_I(inode)->i_file_acl);
bh = NULL;
goto cleanup; goto cleanup;
} }
error = ext4_xattr_check_block(inode, bh); error = ext4_xattr_check_block(inode, bh);
...@@ -3063,6 +3065,7 @@ ext4_xattr_block_cache_find(struct inode *inode, ...@@ -3063,6 +3065,7 @@ ext4_xattr_block_cache_find(struct inode *inode,
if (IS_ERR(bh)) { if (IS_ERR(bh)) {
if (PTR_ERR(bh) == -ENOMEM) if (PTR_ERR(bh) == -ENOMEM)
return NULL; return NULL;
bh = NULL;
EXT4_ERROR_INODE(inode, "block %lu read error", EXT4_ERROR_INODE(inode, "block %lu read error",
(unsigned long)ce->e_value); (unsigned long)ce->e_value);
} else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) { } else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册