aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDing Wang <justin.wang@spreadtrum.com>2015-05-18 08:14:15 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-06-16 02:58:36 -0400
commit29535f7b797df35cc9b6b3bca635591cdd3dd2a8 (patch)
treec09f2eef4aa08d88634eeb0863aa993bc8518273
parent62a7f368ffbc13d9aedfdd7aeae711b177db69ac (diff)
mmc: card: Fixup request missing in mmc_blk_issue_rw_rq
The current handler of MMC_BLK_CMD_ERR in mmc_blk_issue_rw_rq function may cause new coming request permanent missing when the ongoing request (previoulsy started) complete end. The problem scenario is as follows: (1) Request A is ongoing; (2) Request B arrived, and finally mmc_blk_issue_rw_rq() is called; (3) Request A encounters the MMC_BLK_CMD_ERR error; (4) In the error handling of MMC_BLK_CMD_ERR, suppose mmc_blk_cmd_err() end request A completed and return zero. Continue the error handling, suppose mmc_blk_reset() reset device success; (5) Continue the execution, while loop completed because variable ret is zero now; (6) Finally, mmc_blk_issue_rw_rq() return without processing request B. The process related to the missing request may wait that IO request complete forever, possibly crashing the application or hanging the system. Fix this issue by starting new request when reset success. Signed-off-by: Ding Wang <justin.wang@spreadtrum.com> Fixes: 67716327eec7 ("mmc: block: add eMMC hardware reset support") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/card/block.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index fc0317124276..c9c3d20b784b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1920,9 +1920,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
1920 break; 1920 break;
1921 case MMC_BLK_CMD_ERR: 1921 case MMC_BLK_CMD_ERR:
1922 ret = mmc_blk_cmd_err(md, card, brq, req, ret); 1922 ret = mmc_blk_cmd_err(md, card, brq, req, ret);
1923 if (!mmc_blk_reset(md, card->host, type)) 1923 if (mmc_blk_reset(md, card->host, type))
1924 break; 1924 goto cmd_abort;
1925 goto cmd_abort; 1925 if (!ret)
1926 goto start_new_req;
1927 break;
1926 case MMC_BLK_RETRY: 1928 case MMC_BLK_RETRY:
1927 retune_retry_done = brq->retune_retry_done; 1929 retune_retry_done = brq->retune_retry_done;
1928 if (retry++ < 5) 1930 if (retry++ < 5)