]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: fix null pointer use in mmc_blk_remove_req
authorFranck Jullien <franck.jullien@gmail.com>
Wed, 24 Jul 2013 13:17:48 +0000 (15:17 +0200)
committerChris Ball <cjb@laptop.org>
Sun, 25 Aug 2013 03:22:04 +0000 (23:22 -0400)
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 mmc_cleanup_queue sets mq->card to NULL.

This patch moves the card pointer assignment before mmc_cleanup_queue.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/card/block.c

index bebcb8e11efbc3968da16083d44ca5b401ebfba9..1a3163f1407e2093a43a6a1c61db5a9538f6a329 100644 (file)
@@ -2230,10 +2230,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) &&