Commit 77d05951 authored by Sohei Koyama's avatar Sohei Koyama Committed by Theodore Ts'o
Browse files

ext4: fix missing brelse() in ext4_xattr_inode_dec_ref_all()



The commit c8e008b6 ("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: c8e008b6 ("ext4: ignore xattrs past end")
Signed-off-by: default avatarSohei Koyama <skoyama@ddn.com>
Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Reviewed-by: default avatarRitesh Harjani (IBM) <ritesh.list@gmail.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Reviewed-by: default avatarBaokun Li <libaokun@linux.alibaba.com>
Link: https://patch.msgid.link/20260406074830.8480-1-skoyama@ddn.com


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 22f53f08
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
}

/*