btrfs: Init io_lock after cloning btrfs device struct
authorThomas Gleixner <tglx@linutronix.de>
Wed, 20 Feb 2013 19:06:20 +0000 (14:06 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 20 Mar 2013 15:03:15 +0000 (15:03 +0000)
commit554995ab65f98584d95e06e4d44f0c4d3293cee7
treec2743470f6bdbe8b660e12dd5e912ac0ffe6f949
parentb9d85cc001a1ff099d4870dd36b474e522d543c5
btrfs: Init io_lock after cloning btrfs device struct

commit 1cba0cdf5e4dbcd9e5fa5b54d7a028e55e2ca057 upstream.

__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>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/btrfs/volumes.c