summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaya Erez <merez@codeaurora.org>2014-12-09 23:31:55 +0200
committerSubhash Jadavani <subhashj@codeaurora.org>2016-05-31 15:26:01 -0700
commit4bc12fc78cd0c2fdd3e7d8ffdd4ec93c306a41af (patch)
tree81a9921ab62bd01377fed6b4c2b0a3a6418e227c
parentc6cc59c4358c423be099b5517319c5da5ef0f752 (diff)
mmc: block: Fix an invalid use of req->cmd_flag in DISCARD operation
When handling a DISCARD operation, the MMC request data structure may be freed in memory. Therefore, it can't be used to retrieve the cmd_flags for checking if MMC_REQ_NOREINSERT_MASK is set: (!(mq->mqrq_cur->req->cmd_flags & MMC_REQ_NOREINSERT_MASK)))). To prevent the issue we should use the local variable of cmd_flags. Change-Id: Idef53d5bd66fa6f1faaf79644c8efb5177c75e89 Signed-off-by: Maya Erez <merez@codeaurora.org> Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org> [merez@codeaurora.org: fix conflicts due to removal of stop transmission] Signed-off-by: Maya Erez <merez@codeaurora.org>
-rw-r--r--drivers/mmc/card/block.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 56cb49d8d256..b587f301dc94 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2685,7 +2685,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
/* complete ongoing async transfer before issuing discard */
if (card->host->areq)
mmc_blk_issue_rw_rq(mq, NULL);
- if (req->cmd_flags & REQ_SECURE)
+ if (cmd_flags & REQ_SECURE &&
+ !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN))
ret = mmc_blk_issue_secdiscard_rq(mq, req);
else
ret = mmc_blk_issue_discard_rq(mq, req);