Skip to content

Commit 77d0595

Browse files
KoyamaSoheitytso
authored andcommitted
ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
The commit c8e008b ("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: c8e008b ("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>
1 parent 22f53f0 commit 77d0595

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/ext4/xattr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
11651165
{
11661166
struct inode *ea_inode;
11671167
struct ext4_xattr_entry *entry;
1168-
struct ext4_iloc iloc;
1168+
struct ext4_iloc iloc = { .bh = NULL };
11691169
bool dirty = false;
11701170
unsigned int ea_ino;
11711171
int err;
@@ -1260,6 +1260,8 @@ ext4_xattr_inode_dec_ref_all(handle_t *handle, struct inode *parent,
12601260
ext4_warning_inode(parent,
12611261
"handle dirty metadata err=%d", err);
12621262
}
1263+
1264+
brelse(iloc.bh);
12631265
}
12641266

12651267
/*

0 commit comments

Comments
 (0)