]> Gentwo Git Trees - linux/.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)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 21:42:24 +0000 (22:42 +0100)
commite7dd1182fcedee7c6097c9f49eba8de94a4364e3
treeb004500c459e426c60972bc5c91914b39c9a35d0
parent280dd7c106fd4c47756d19f6ae89862bb7bf7225
btrfs: fix leaf leak in an error path in btrfs_del_items()

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>
fs/btrfs/ctree.c