summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2019-12-06 09:37:18 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-31 16:34:43 +0100
commitf4e54ec69b5c0b67c2490b8b56762bd82e0d1c8c (patch)
tree08a496012ed02c0c45529f13d6ff5a8c86693350 /fs
parentf5c97350e552b87b97094a03f38f1b509a3e060d (diff)
downloadlinux-stable-f4e54ec69b5c0b67c2490b8b56762bd82e0d1c8c.tar.gz
linux-stable-f4e54ec69b5c0b67c2490b8b56762bd82e0d1c8c.tar.bz2
linux-stable-f4e54ec69b5c0b67c2490b8b56762bd82e0d1c8c.zip
btrfs: do not leak reloc root if we fail to read the fs root
commit ca1aa2818a53875cfdd175fb5e9a2984e997cce9 upstream. If we fail to read the fs root corresponding with a reloc root we'll just break out and free the reloc roots. But we remove our current reloc_root from this list higher up, which means we'll leak this reloc_root. Fix this by adding ourselves back to the reloc_roots list so we are properly cleaned up. CC: stable@vger.kernel.org # 4.4+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/relocation.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index b4958f724ce5..f98913061a40 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4474,6 +4474,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
fs_root = read_fs_root(fs_info, reloc_root->root_key.offset);
if (IS_ERR(fs_root)) {
err = PTR_ERR(fs_root);
+ list_add_tail(&reloc_root->root_list, &reloc_roots);
goto out_free;
}