Skip to content

Commit d862b13

Browse files
maximlevitskytorvalds
authored andcommitted
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>
1 parent 21fd049 commit d862b13

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/memstick/core/mspro_block.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,13 +1339,14 @@ static void mspro_block_remove(struct memstick_dev *card)
13391339
struct mspro_block_data *msb = memstick_get_drvdata(card);
13401340
unsigned long flags;
13411341

1342-
del_gendisk(msb->disk);
1343-
dev_dbg(&card->dev, "mspro block remove\n");
13441342
spin_lock_irqsave(&msb->q_lock, flags);
13451343
msb->eject = 1;
13461344
blk_start_queue(msb->queue);
13471345
spin_unlock_irqrestore(&msb->q_lock, flags);
13481346

1347+
del_gendisk(msb->disk);
1348+
dev_dbg(&card->dev, "mspro block remove\n");
1349+
13491350
blk_cleanup_queue(msb->queue);
13501351
msb->queue = NULL;
13511352

0 commit comments

Comments
 (0)