]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.0.11/ext4-fix-some-error-pointer-dereferences.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 5.0.11 / ext4-fix-some-error-pointer-dereferences.patch
CommitLineData
cc4eb9ca
GKH
1From 7159a986b4202343f6cca3bb8079ecace5816fd6 Mon Sep 17 00:00:00 2001
2From: Dan Carpenter <dan.carpenter@oracle.com>
3Date: Thu, 21 Feb 2019 11:17:34 -0500
4Subject: ext4: fix some error pointer dereferences
5
6From: Dan Carpenter <dan.carpenter@oracle.com>
7
8commit 7159a986b4202343f6cca3bb8079ecace5816fd6 upstream.
9
10We can't pass error pointers to brelse().
11
12Fixes: fb265c9cb49e ("ext4: add ext4_sb_bread() to disambiguate ENOMEM cases")
13Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
14Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15Reviewed-by: Jan Kara <jack@suse.cz>
16Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18---
19 fs/ext4/xattr.c | 3 +++
20 1 file changed, 3 insertions(+)
21
22--- a/fs/ext4/xattr.c
23+++ b/fs/ext4/xattr.c
24@@ -829,6 +829,7 @@ int ext4_get_inode_usage(struct inode *i
25 bh = ext4_sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl, REQ_PRIO);
26 if (IS_ERR(bh)) {
27 ret = PTR_ERR(bh);
28+ bh = NULL;
29 goto out;
30 }
31
32@@ -2903,6 +2904,7 @@ int ext4_xattr_delete_inode(handle_t *ha
33 if (error == -EIO)
34 EXT4_ERROR_INODE(inode, "block %llu read error",
35 EXT4_I(inode)->i_file_acl);
36+ bh = NULL;
37 goto cleanup;
38 }
39 error = ext4_xattr_check_block(inode, bh);
40@@ -3059,6 +3061,7 @@ ext4_xattr_block_cache_find(struct inode
41 if (IS_ERR(bh)) {
42 if (PTR_ERR(bh) == -ENOMEM)
43 return NULL;
44+ bh = NULL;
45 EXT4_ERROR_INODE(inode, "block %lu read error",
46 (unsigned long)ce->e_value);
47 } else if (ext4_xattr_cmp(header, BHDR(bh)) == 0) {