summaryrefslogtreecommitdiffstats
path: root/drivers/memstick/core
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-08-11 14:17:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 08:43:31 -0700
commitd862b13bc8cbab9692fbe0ef44c40d0488b81af1 (patch)
treee8eeff7c7d8759cd6c812a895d2234ddf16d94c7 /drivers/memstick/core
parent21fd0495ea61d53e0ebe575330e343ce4e6d2a61 (diff)
downloadblackbird-op-linux-d862b13bc8cbab9692fbe0ef44c40d0488b81af1.tar.gz
blackbird-op-linux-d862b13bc8cbab9692fbe0ef44c40d0488b81af1.zip
memstick: fix hangs on unexpected device removal in mspro_blk
mspro_block_remove() is called from detect thread that first calls the mspro_block_stop(), which stops the request queue. If we call del_gendisk() with the queue stopped we get a deadlock. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Alex Dubov <oakad@yahoo.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick/core')
-rw-r--r--drivers/memstick/core/mspro_block.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index aa5ac6efd9b9..d3f1a087eced 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -1339,13 +1339,14 @@ static void mspro_block_remove(struct memstick_dev *card)
struct mspro_block_data *msb = memstick_get_drvdata(card);
unsigned long flags;
- del_gendisk(msb->disk);
- dev_dbg(&card->dev, "mspro block remove\n");
spin_lock_irqsave(&msb->q_lock, flags);
msb->eject = 1;
blk_start_queue(msb->queue);
spin_unlock_irqrestore(&msb->q_lock, flags);
+ del_gendisk(msb->disk);
+ dev_dbg(&card->dev, "mspro block remove\n");
+
blk_cleanup_queue(msb->queue);
msb->queue = NULL;
OpenPOWER on IntegriCloud