Patch "btrfs: fix extent buffer leak after tree mod log failure at split_node()" has been added to the 4.19-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 4.19-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-4.19 subdirectory.

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



commit f8efa6348227e1871a5524dbf5e438effd121ff6
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 34d56f0fa7501..e48c6d7a860f4 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3590,6 +3590,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
 
 	ret = tree_mod_log_eb_copy(fs_info, 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