]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
btrfs: relocation: Only remove reloc rb_trees if reloc control has been initialized
authorQu Wenruo <wqu@suse.com>
Tue, 3 Jul 2018 09:10:07 +0000 (17:10 +0800)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:46:49 +0000 (19:46 -0600)
commit8cbcaea56f1a787232e693e6bb313e0121ebfa49
tree614e21af5e87a4fe5d69b39f4c58caf6ce34bbb6
parent1b10d9e8e8ea370b71e3f4610dc5adc847595e0b
btrfs: relocation: Only remove reloc rb_trees if reloc control has been initialized

BugLink: https://bugs.launchpad.net/bugs/1835972
[ Upstream commit 389305b2aa68723c754f88d9dbd268a400e10664 ]

Invalid reloc tree can cause kernel NULL pointer dereference when btrfs
does some cleanup of the reloc roots.

It turns out that fs_info::reloc_ctl can be NULL in
btrfs_recover_relocation() as we allocate relocation control after all
reloc roots have been verified.
So when we hit: note, we haven't called set_reloc_control() thus
fs_info::reloc_ctl is still NULL.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=199833
Reported-by: Xu Wen <wen.xu@gatech.edu>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Tested-by: Gu Jinxiang <gujx@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/btrfs/relocation.c