diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-10-05 16:51:32 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-10-05 16:51:32 +0200 |
commit | 1329dfc8bb8932976844438cd5e757c720d6f1ff (patch) | |
tree | 3ee7f40236ee5fc7961e285089da255caddab38a /fs/btrfs/volumes.c | |
parent | Linux 3.12-rc3 (diff) | |
parent | Btrfs: fix a use-after-free bug in btrfs_dev_replace_finishing (diff) | |
download | linux-1329dfc8bb8932976844438cd5e757c720d6f1ff.tar.xz linux-1329dfc8bb8932976844438cd5e757c720d6f1ff.zip |
Merge branch 'for-linus' into for-linus-3.12
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a10645830223..043b215769c2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1716,6 +1716,7 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, struct btrfs_device *srcdev) { WARN_ON(!mutex_is_locked(&fs_info->fs_devices->device_list_mutex)); + list_del_rcu(&srcdev->dev_list); list_del_rcu(&srcdev->dev_alloc_list); fs_info->fs_devices->num_devices--; @@ -1725,9 +1726,13 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info, } if (srcdev->can_discard) fs_info->fs_devices->num_can_discard--; - if (srcdev->bdev) + if (srcdev->bdev) { fs_info->fs_devices->open_devices--; + /* zero out the old super */ + btrfs_scratch_superblock(srcdev); + } + call_rcu(&srcdev->rcu, free_device); } |