btrfs: fix root leak if its reloc root is unexpected in merge_reloc_roots()
Subsystems (2)
PATCH 1/1 btrfs: fix root leak if its reloc root is unexpected in merge_reloc_roots()
From: Filipe Manana <[email protected]>
commit ce6050bafb4e33377dc17fcc357736bfc351180c upstream.
If we have an unexpected reloc_root for our root, we jump to the out label but never drop the reference we obtained for root, resulting in a leak. Add a missing btrfs_put_root() call.
Fixes 24213fa46c70 ("btrfs: do proper error handling in merge_reloc_roots")
Reviewed-by Qu Wenruo <[email protected]>
Reviewed-by Johannes Thumshirn <[email protected]>
Signed-off-by Filipe Manana <[email protected]>
Reviewed-by David Sterba <[email protected]>
Signed-off-by David Sterba <[email protected]>
Signed-off-by Dmitriy Okunev <[email protected]>
--- fs/btrfs/relocation.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/relocation.c +1 -0
@@ -1956,6 +1956,7 @@ void merge_reloc_roots(struct reloc_control *rc)* corruption, e.g. bad reloc tree key offset. */ ret = -EINVAL ; +btrfs_put_root (root); goto out; } ret =merge_reloc_root (rc, root);
Signature · 1 line
2.53.0