mmc: block: fixed NULL pointer dereference
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Jul 2011 08:02:16 +0000 (17:02 +0900)
committerChris Ball <cjb@laptop.org>
Thu, 21 Jul 2011 14:35:00 +0000 (10:35 -0400)
We already check for ongoing async transfers when handling discard
requests, but not in mmc_blk_issue_flush().  This patch fixes that
omission.

Tested with an SDHCI controller and eMMC4.41.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Per Forlin <per.forlin@linaro.org>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/card/block.c

index 38d01492a52bca84afbf034c4d40a8a165545289..1ff5486213fbeb2682b2cad1b96d423a1fb235fa 100644 (file)
@@ -1200,6 +1200,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                else
                        ret = mmc_blk_issue_discard_rq(mq, req);
        } else if (req && req->cmd_flags & REQ_FLUSH) {
+               /* complete ongoing async transfer before issuing flush */
+               if (card->host->areq)
+                       mmc_blk_issue_rw_rq(mq, NULL);
                ret = mmc_blk_issue_flush(mq, req);
        } else {
                ret = mmc_blk_issue_rw_rq(mq, req);