btrfs: prevent NULL pointer dereference in extent_io_tree_panic
authorSu Yue <l@damenly.su>
Sun, 3 Jan 2021 09:28:03 +0000 (17:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:27:17 +0000 (18:27 +0100)
commitf37fba66a437677141d829e7969ae2e35bc146dd
tree9ddc14a999c33a0fcfeae5dfb246cb1f77bff05a
parente883eb5d1567f146cd7143800799f3286cc04a9a
btrfs: prevent NULL pointer dereference in extent_io_tree_panic

commit 29b665cc51e8b602bf2a275734349494776e3dbc upstream.

Some extent io trees are initialized with NULL private member (e.g.
btrfs_device::alloc_state and btrfs_fs_info::excluded_extents).
Dereference of a NULL tree->private as inode pointer will cause panic.

Pass tree->fs_info as it's known to be valid in all cases.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=208929
Fixes: 05912a3c04eb ("btrfs: drop extent_io_ops::tree_fs_info callback")
CC: stable@vger.kernel.org # 4.19+
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Su Yue <l@damenly.su>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c