]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.16/btrfs-don-t-leak-reloc-root-nodes-on-error.patch
Drop watchdog patch
[thirdparty/kernel/stable-queue.git] / releases / 4.8.16 / btrfs-don-t-leak-reloc-root-nodes-on-error.patch
1 From 6bdf131fac2336adb1a628f992ba32384f653a55 Mon Sep 17 00:00:00 2001
2 From: Josef Bacik <jbacik@fb.com>
3 Date: Fri, 2 Sep 2016 15:25:43 -0400
4 Subject: Btrfs: don't leak reloc root nodes on error
5
6 From: Josef Bacik <jbacik@fb.com>
7
8 commit 6bdf131fac2336adb1a628f992ba32384f653a55 upstream.
9
10 We don't track the reloc roots in any sort of normal way, so the only way the
11 root/commit_root nodes get free'd is if the relocation finishes successfully and
12 the reloc root is deleted. Fix this by free'ing them in free_reloc_roots.
13 Thanks,
14
15 Signed-off-by: Josef Bacik <jbacik@fb.com>
16 Signed-off-by: David Sterba <dsterba@suse.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 fs/btrfs/relocation.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 --- a/fs/btrfs/relocation.c
24 +++ b/fs/btrfs/relocation.c
25 @@ -2366,6 +2366,10 @@ void free_reloc_roots(struct list_head *
26 while (!list_empty(list)) {
27 reloc_root = list_entry(list->next, struct btrfs_root,
28 root_list);
29 + free_extent_buffer(reloc_root->node);
30 + free_extent_buffer(reloc_root->commit_root);
31 + reloc_root->node = NULL;
32 + reloc_root->commit_root = NULL;
33 __del_reloc_root(reloc_root);
34 }
35 }