* [PATCH 6.1] btrfs: fix root leak if its reloc root is unexpected in merge_reloc_roots()
@ 2026-08-17 10:48 Dmitriy Okunev
0 siblings, 0 replies; only message in thread
From: Dmitriy Okunev @ 2026-08-17 10:48 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, Sasha Levin, lvc-project, Chris Mason,
David Sterba, Josef Bacik, linux-btrfs, linux-kernel
From: Filipe Manana <fdmanana@suse.com>
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 <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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: Dmitriy Okunev <dokunevdmitriy@gmail.com>
---
fs/btrfs/relocation.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 43e8c331168e..d2a1323e8b10 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -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);
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-17 10:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 10:48 [PATCH 6.1] btrfs: fix root leak if its reloc root is unexpected in merge_reloc_roots() Dmitriy Okunev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox