aboutsummaryrefslogtreecommitdiff
path: root/drivers/memstick
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2010-08-11 14:17:52 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-26 16:45:42 -0700
commite9eee0b456fee111f5d6def1e562dd17e39f2b65 (patch)
treedc4ba8c3c2da3a5db3dd70936cb104cf266841d6 /drivers/memstick
parentda6827e8b0e9b7c43b25396017a5198040cbc2f6 (diff)
memstick: fix hangs on unexpected device removal in mspro_blk
commit d862b13bc8cbab9692fbe0ef44c40d0488b81af1 upstream. 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/memstick')
-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 369313fa359..300ec1595f1 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -1331,13 +1331,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;