diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2014-05-11 23:14:59 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-09 17:20:47 -0700 |
commit | 29cc83f69c8338ff8fd1383c9be263d4bdf52d73 (patch) | |
tree | 287e90273db0c42776c9adb024c8d4700e2d9166 /fs/btrfs/volumes.c | |
parent | f017f15f7c1893cb518ddae796f3a75c0c413a92 (diff) | |
download | linux-29cc83f69c8338ff8fd1383c9be263d4bdf52d73.tar.gz linux-29cc83f69c8338ff8fd1383c9be263d4bdf52d73.tar.bz2 linux-29cc83f69c8338ff8fd1383c9be263d4bdf52d73.zip |
Btrfs: fix NULL pointer crash of deleting a seed device
Same as normal devices, seed devices should be initialized with
fs_info->dev_root as well, otherwise we'll get a NULL pointer crash.
Cc: Chris Murphy <lists@colorremedies.com>
Reported-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ee71622088f9..018cde61cf9d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6146,10 +6146,14 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info) struct btrfs_fs_devices *fs_devices = fs_info->fs_devices; struct btrfs_device *device; - mutex_lock(&fs_devices->device_list_mutex); - list_for_each_entry(device, &fs_devices->devices, dev_list) - device->dev_root = fs_info->dev_root; - mutex_unlock(&fs_devices->device_list_mutex); + while (fs_devices) { + mutex_lock(&fs_devices->device_list_mutex); + list_for_each_entry(device, &fs_devices->devices, dev_list) + device->dev_root = fs_info->dev_root; + mutex_unlock(&fs_devices->device_list_mutex); + + fs_devices = fs_devices->seed; + } } static void __btrfs_reset_dev_stats(struct btrfs_device *dev) |