This is a note to let you know that I've just added the patch titled btrfs: fix extent buffer leak after tree mod log failure at split_node() 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: btrfs-fix-extent-buffer-leak-after-tree-mod-log-failure-at-split_node.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 ede600e497b1461d06d22a7d17703d9096868bc3 Mon Sep 17 00:00:00 2001 From: Filipe Manana <fdmanana@xxxxxxxx> Date: Thu, 8 Jun 2023 11:27:38 +0100 Subject: btrfs: fix extent buffer leak after tree mod log failure at split_node() From: Filipe Manana <fdmanana@xxxxxxxx> commit ede600e497b1461d06d22a7d17703d9096868bc3 upstream. At split_node(), if we fail to log the tree mod log copy operation, we return without unlocking the split extent buffer we just allocated and without decrementing the reference we own on it. Fix this by unlocking it and decrementing the ref count before returning. Fixes: 5de865eebb83 ("Btrfs: fix tree mod logging") CC: stable@xxxxxxxxxxxxxxx # 5.4+ Reviewed-by: Qu Wenruo <wqu@xxxxxxxx> Signed-off-by: Filipe Manana <fdmanana@xxxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/ctree.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2637,6 +2637,8 @@ static noinline int split_node(struct bt ret = btrfs_tree_mod_log_eb_copy(split, c, 0, mid, c_nritems - mid); if (ret) { + btrfs_tree_unlock(split); + free_extent_buffer(split); btrfs_abort_transaction(trans, ret); return ret; } Patches currently in stable-queue which might be from fdmanana@xxxxxxxx are queue-5.15/btrfs-bail-out-reclaim-process-if-filesystem-is-read-only.patch queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch queue-5.15/btrfs-fix-extent-buffer-leak-after-tree-mod-log-failure-at-split_node.patch queue-5.15/btrfs-move-out-now-unused-bg-from-the-reclaim-list.patch queue-5.15/btrfs-fix-race-when-deleting-quota-root-from-the-dirty-cow-roots-list.patch queue-5.15/btrfs-delete-unused-bgs-while-reclaiming-bgs.patch queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-__btrfs_cow_block.patch