[02/91] memstick: fix hangs on unexpected device removal in mspro_blk

Previous thread: [04/91] ASoC: Remove DSP mode support for WM8776 by Greg KH on Tuesday, August 24, 2010 - 3:41 pm. (1 message)

Next thread: [43/59] fixes for using make 3.82 by Greg KH on Tuesday, August 24, 2010 - 3:24 pm. (1 message)
From: Greg KH
Date: Tuesday, August 24, 2010 - 3:41 pm

2.6.34-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Maxim Levitsky <maximlevitsky@gmail.com>

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>

---
 drivers/memstick/core/mspro_block.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -1331,13 +1331,14 @@ static void mspro_block_remove(struct me
 	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;
 


--

Previous thread: [04/91] ASoC: Remove DSP mode support for WM8776 by Greg KH on Tuesday, August 24, 2010 - 3:41 pm. (1 message)

Next thread: [43/59] fixes for using make 3.82 by Greg KH on Tuesday, August 24, 2010 - 3:24 pm. (1 message)