btrfs: fix NULL pointer dereference from free_reloc_roots()
authorNaohiro Aota <naohiro.aota@wdc.com>
Fri, 25 Aug 2017 05:15:14 +0000 (14:15 +0900)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Sep 2017 12:51:49 +0000 (14:51 +0200)
commitbb166d7207432d3c7d10c45dc052f12ba3a2121d
treebeee530f91be31d9ad02c62224711652ddbb9b49
parent67c003f90fd68062d92a7ffade36f9b2a9098bd8
btrfs: fix NULL pointer dereference from free_reloc_roots()

__del_reloc_root should be called before freeing up reloc_root->node.
If not, calling __del_reloc_root() dereference reloc_root->node, causing
the system BUG.

Fixes: 6bdf131fac23 ("Btrfs: don't leak reloc root nodes on error")
Cc: <stable@vger.kernel.org> # 4.9
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c