btrfs: fix extent buffer leak after tree mod log failure at split_node()
authorFilipe Manana <fdmanana@suse.com>
Thu, 8 Jun 2023 10:27:38 +0000 (11:27 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:38 +0000 (13:59 +0200)
commitede600e497b1461d06d22a7d17703d9096868bc3
treee50774d777c94039ade4c1581da4c4333224faab
parentd09c51521f22f9cbdfb1cf63e5c456077c622c84
btrfs: fix extent buffer leak after tree mod log failure at split_node()

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@vger.kernel.org # 5.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c