]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
authorSohei Koyama <skoyama@ddn.com>
Mon, 6 Apr 2026 07:48:30 +0000 (16:48 +0900)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 10 Apr 2026 02:06:12 +0000 (22:06 -0400)
The commit c8e008b60492 ("ext4: ignore xattrs past end")
introduced a refcount leak in when block_csum is false.

ext4_xattr_inode_dec_ref_all() calls ext4_get_inode_loc() to
get iloc.bh, but never releases it with brelse().

Fixes: c8e008b60492 ("ext4: ignore xattrs past end")
Signed-off-by: Sohei Koyama <skoyama@ddn.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
Link: https://patch.msgid.link/20260406074830.8480-1-skoyama@ddn.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/xattr.c

index c6205b405efe435602f649e3db25211eb617a5f7..a4eaee58e54503cb26b4609db1ddc7e314991a41 100644 (file)
@@ -1165,7 +1165,7 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
 {
        struct inode *ea_inode;
        struct ext4_xattr_entry *entry;
-       struct ext4_iloc iloc;
+       struct ext4_iloc iloc = { .bh = NULL };
        bool dirty = false;
        unsigned int ea_ino;
        int err;
@@ -1260,6 +1260,8 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
                        ext4_warning_inode(parent,
                                           "handle dirty metadata err=%d", err);
        }
+
+       brelse(iloc.bh);
 }
 
 /*