This is a note to let you know that I've just added the patch titled ext4: fix miss release buffer head in ext4_fc_write_inode to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-fix-miss-release-buffer-head-in-ext4_fc_write_inode.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ccbf8eeb39f2ff00b54726a2b20b35d788c4ecb5 Mon Sep 17 00:00:00 2001 From: Ye Bin <yebin10@xxxxxxxxxx> Date: Wed, 14 Sep 2022 18:08:59 +0800 Subject: ext4: fix miss release buffer head in ext4_fc_write_inode From: Ye Bin <yebin10@xxxxxxxxxx> commit ccbf8eeb39f2ff00b54726a2b20b35d788c4ecb5 upstream. 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@xxxxxxxxxx Signed-off-by: Ye Bin <yebin10@xxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Link: https://lore.kernel.org/r/20220914100859.1415196-1-yebin10@xxxxxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/fast_commit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -794,22 +794,25 @@ static int ext4_fc_write_inode(struct in 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; } /* Patches currently in stable-queue which might be from yebin10@xxxxxxxxxx are queue-5.15/ext4-update-state-fc_regions_size-after-successful-memory-allocation.patch queue-5.15/jbd2-fix-potential-buffer-head-reference-count-leak.patch queue-5.15/ext4-fix-miss-release-buffer-head-in-ext4_fc_write_inode.patch queue-5.15/jbd2-fix-potential-use-after-free-in-jbd2_fc_wait_bufs.patch queue-5.15/btrfs-fix-race-between-quota-enable-and-quota-rescan-ioctl.patch queue-5.15/ext4-fix-potential-memory-leak-in-ext4_fc_record_modified_inode.patch queue-5.15/ext4-fix-potential-memory-leak-in-ext4_fc_record_regions.patch queue-5.15/jbd2-add-miss-release-buffer-head-in-fc_do_one_pass.patch