Skip to contentSkip to conversation

mmc: block: fix null pointer use in mmc_blk_remove_req

PATCH RESEND New Franck Jullien 1 participant 1 message Aug 7, 2013 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 mmc: block: fix null pointer use in mmc_blk_remove_req

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.

---
 drivers/mmc/card/block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/card/block.c +1 -1
index cd0b7f4..f4a0bea 100644
@@ -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) &&
Signature · 1 line
1.7.1