]> Git Repo - linux.git/commitdiff
btrfs: prevent NULL pointer dereference in extent_io_tree_panic
authorSu Yue <[email protected]>
Sun, 3 Jan 2021 09:28:03 +0000 (17:28 +0800)
committerDavid Sterba <[email protected]>
Thu, 7 Jan 2021 16:25:05 +0000 (17:25 +0100)
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: [email protected] # 4.19+
Reviewed-by: Anand Jain <[email protected]>
Signed-off-by: Su Yue <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>
fs/btrfs/extent_io.c

index 6e3b72e63e4226d50014f5058da3b3cabd2c31a8..c9cee458e001bf8bfe5bd00d2aa8e5c68d51bcdd 100644 (file)
@@ -676,9 +676,7 @@ alloc_extent_state_atomic(struct extent_state *prealloc)
 
 static void extent_io_tree_panic(struct extent_io_tree *tree, int err)
 {
-       struct inode *inode = tree->private_data;
-
-       btrfs_panic(btrfs_sb(inode->i_sb), err,
+       btrfs_panic(tree->fs_info, err,
        "locking error: extent tree was modified by another thread while locked");
 }
 
This page took 0.057443 seconds and 4 git commands to generate.