]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix leaf leak in an error path in btrfs_del_items()
authorFilipe Manana <fdmanana@suse.com>
Thu, 13 Nov 2025 12:52:45 +0000 (12:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 12:55:06 +0000 (13:55 +0100)
commit14dd377ab65f10da567166599bc545f6010eda53
treec68a21d9842096dee38add1dc5f97c0fc8ddfe6e
parent1b1284e4f30e81f54fd7c295cc01d9bc3c359cb0
btrfs: fix leaf leak in an error path in btrfs_del_items()

[ Upstream commit e7dd1182fcedee7c6097c9f49eba8de94a4364e3 ]

If the call to btrfs_del_leaf() fails we return without decrementing the
extra ref we took on the leaf, therefore leaking it. Fix this by ensuring
we drop the ref count before returning the error.

Fixes: 751a27615dda ("btrfs: do not BUG_ON() on tree mod log failures at btrfs_del_ptr()")
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/ctree.c