summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-02-20 14:06:20 -0500
committerChris Mason <chris.mason@fusionio.com>2013-02-20 14:06:20 -0500
commit1cba0cdf5e4dbcd9e5fa5b54d7a028e55e2ca057 (patch)
tree7fb357815f9c0322ef7bee34772533a0342e5737 /fs/btrfs
parente942f883bc6651d50be139477baf6fb0eed3d5bb (diff)
downloadlinux-1cba0cdf5e4dbcd9e5fa5b54d7a028e55e2ca057.tar.bz2
btrfs: Init io_lock after cloning btrfs device struct
__btrfs_close_devices() clones btrfs device structs with memcpy(). Some of the fields in the clone are reinitialized, but it's missing to init io_lock. In mainline this goes unnoticed, but on RT it leaves the plist pointing to the original about to be freed lock struct. Initialize io_lock after cloning, so no references to the original struct are left. Reported-and-tested-by: Mike Galbraith <efault@gmx.de> Cc: stable@vger.kernel.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7992dc4ea4cc..5d6010ba8b7e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -650,6 +650,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
new_device->writeable = 0;
new_device->in_fs_metadata = 0;
new_device->can_discard = 0;
+ spin_lock_init(&new_device->io_lock);
list_replace_rcu(&device->dev_list, &new_device->dev_list);
call_rcu(&device->rcu, free_device);