public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: fix null pointer use in mmc_blk_remove_req
@ 2013-07-24 13:17 franck.jullien
  2013-07-25  7:20 ` Franck Jullien
  2013-08-25  3:22 ` Chris Ball
  0 siblings, 2 replies; 7+ messages in thread
From: franck.jullien @ 2013-07-24 13:17 UTC (permalink / raw)
  To: linux-mmc; +Cc: Franck Jullien

From: Franck Jullien <franck.jullien@gmail.com>

A previous commit (fdfa20c1631210d0) reordered the
shutdown sequence in mmc_blk_remove_req. However,
mmc_cleanup_queue is now called before we get the
card pointer and, sadly, mmc_cleanup_queue set
mq->card to NULL.

This patch moves the card pointer assignment before
mmc_cleanup_queue.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 drivers/mmc/card/block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index cd0b7f4..f4a0bea 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2191,10 +2191,10 @@ static void mmc_blk_remove_req(struct mmc_blk_data *md)
 		 * is freeing the queue that stops new requests
 		 * from being accepted.
 		 */
+		card = md->queue.card;
 		mmc_cleanup_queue(&md->queue);
 		if (md->flags & MMC_BLK_PACKED_CMD)
 			mmc_packed_clean(&md->queue);
-		card = md->queue.card;
 		if (md->disk->flags & GENHD_FL_UP) {
 			device_remove_file(disk_to_dev(md->disk), &md->force_ro);
 			if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) &&
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-10-10 23:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 13:17 [PATCH] mmc: fix null pointer use in mmc_blk_remove_req franck.jullien
2013-07-25  7:20 ` Franck Jullien
2013-08-25  3:22 ` Chris Ball
2013-10-07  8:48   ` Adrian Hunter
2013-10-07  8:50   ` Adrian Hunter
2013-10-07  8:54   ` Adrian Hunter
2013-10-10 23:18     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox