Commit ccbf8eeb authored by Ye Bin's avatar Ye Bin Committed by Theodore Ts'o
Browse files

ext4: fix miss release buffer head in ext4_fc_write_inode



In 'ext4_fc_write_inode' function first call 'ext4_get_inode_loc' get 'iloc',
after use it miss release 'iloc.bh'.
So just release 'iloc.bh' before 'ext4_fc_write_inode' return.

Cc: stable@kernel.org
Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220914100859.1415196-1-yebin10@huawei.com


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 243d1a5d
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -874,22 +874,25 @@ static int ext4_fc_write_inode(struct inode *inode, u32 *crc)
	tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE);
	tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino));

	ret = -ECANCELED;
	dst = ext4_fc_reserve_space(inode->i_sb,
			sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc);
	if (!dst)
		return -ECANCELED;
		goto err;

	if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc))
		return -ECANCELED;
		goto err;
	dst += sizeof(tl);
	if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc))
		return -ECANCELED;
		goto err;
	dst += sizeof(fc_inode);
	if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc),
					inode_len, crc))
		return -ECANCELED;

	return 0;
		goto err;
	ret = 0;
err:
	brelse(iloc.bh);
	return ret;
}

/*