Patch "btrfs: fix extent buffer leak after tree mod log failure at split_node()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.4-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-fail.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 45c5e4d407f87700bc6e8a37f44eb31c6ee2d1cb
Author: Filipe Manana <fdmanana@xxxxxxxx>
Date:   Thu Jun 8 11:27:38 2023 +0100

    btrfs: fix extent buffer leak after tree mod log failure at split_node()
    
    [ Upstream commit ede600e497b1461d06d22a7d17703d9096868bc3 ]
    
    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: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 1420df997485a..608e41b61689c 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3589,6 +3589,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
 
 	ret = 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;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux