]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix extent buffer leak on failure to copy root
authorFilipe Manana <fdmanana@suse.com>
Thu, 4 Feb 2021 14:35:44 +0000 (14:35 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:59:04 +0000 (22:59 +0100)
commit39461a83c92ee0047b0532c2f9345a2e656f3db6
tree26882a36fd7ca6502ef0df88b5f72f4e3803d5cf
parent6f39fa66f649194282d2dde303d78aa5f49a9f46
btrfs: fix extent buffer leak on failure to copy root

At btrfs_copy_root(), if the call to btrfs_inc_ref() fails we end up
returning without unlocking and releasing our reference on the extent
buffer named "cow" we previously allocated with btrfs_alloc_tree_block().

So fix that by unlocking the extent buffer and dropping our reference on
it before returning.

Fixes: be20aa9dbadc8c ("Btrfs: Add mount option to turn off data cow")
CC: stable@vger.kernel.org # 4.4+
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