Skip to content

Commit

Permalink
memstick: fix hangs on unexpected device removal in mspro_blk
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Alex Dubov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
maximlevitsky authored and torvalds committed Aug 12, 2010
1 parent 21fd049 commit d862b13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/memstick/core/mspro_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d862b13

Please sign in to comment.