ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
Subsystems (2)
PATCH v2 1/1 ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
From: Sohei Koyama <[email protected]>
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().
--- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/xattr.c +3 -1
@@ -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); }/*
Signature · 1 line
2.39.3 (Apple Git-146)
Quoted 5 lines · On 2026/4/6 15:48, [email protected] wrote:
From: Sohei Koyama <[email protected]>
The commit
c8e008b60492("ext4: ignore xattrs past end") introduced a refcount leak in whenblock_csumis false.
Quoted 8 lines
ext4_xattr_inode_dec_ref_all()callsext4_get_inode_loc()to get iloc.bh, but never releases it withbrelse().Fixes c8e008b60492 ("ext4: ignore xattrs past end")Signed-off-by Sohei Koyama <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Ritesh Harjani (IBM) <[email protected]>
Looks good, feel free to add:
Quoted 26 lines
--- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ext4/xattr.c +3
-1@@ -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); }/*
Quoted 5 lines · On 4/6/2026 3:48 PM, [email protected] wrote:
From: Sohei Koyama <[email protected]>
The commit
c8e008b60492("ext4: ignore xattrs past end") introduced a refcount leak in whenblock_csumis false.
Quoted 8 lines
ext4_xattr_inode_dec_ref_all()callsext4_get_inode_loc()to get iloc.bh, but never releases it withbrelse().Fixes c8e008b60492 ("ext4: ignore xattrs past end")Signed-off-by Sohei Koyama <[email protected]>Reviewed-by Andreas Dilger <[email protected]>Reviewed-by Ritesh Harjani (IBM) <[email protected]>
Looks good to me.
Quoted 26 lines
--- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/ext4/xattr.c +3
-1@@ -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); }/*
Quoted 8 lines · On Mon, 06 Apr 2026 16:48:30 +0900, [email protected] wrote:
The commit
c8e008b60492("ext4: ignore xattrs past end") introduced a refcount leak in whenblock_csumis false.
ext4_xattr_inode_dec_ref_all()callsext4_get_inode_loc()to get iloc.bh, but never releases it withbrelse().[...]
Applied, thanks!
[1/1] ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()
commit: 77d059519382bd66283e6a4e83ee186e87e7708f
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>