Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cd659f2 authored by Venkat Gopalakrishnan's avatar Venkat Gopalakrishnan
Browse files

mmc: block: fix DCMD timeout err handling



DCMD requests don't have data, check for the data pointer before
accessing it to prevent null pointer dereference in case of DCMD
timeout err. Also signal a completion event for non flush requests
like discard that wait for the completion of DCMD request.

Change-Id: Ia71a5f1e278a039ba22f6ac42614d9ae79dba7e9
Signed-off-by: default avatarVenkat Gopalakrishnan <venkatg@codeaurora.org>
parent ea0c0d74
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2965,7 +2965,7 @@ static void mmc_blk_cmdq_err(struct mmc_queue *mq)
		goto reset;
	}

	if (mrq->data->error) {
	if (mrq->data && mrq->data->error) {
		blk_end_request_all(mrq->req, mrq->data->error);
		for (; retry < MAX_RETRIES; retry++) {
			err = get_card_status(card, &status, 0);
@@ -2998,8 +2998,18 @@ static void mmc_blk_cmdq_err(struct mmc_queue *mq)
	}

	/* DCMD commands */
	if (mrq->cmd->error)
	if (mrq->cmd && mrq->cmd->error) {
		/*
		 * Notify completion for non flush commands like discard
		 * that wait for DCMD finish.
		 */
		if (!(mrq->req->cmd_flags & REQ_FLUSH)) {
			complete(&mrq->completion);
			goto reset;
		}
		clear_bit(CMDQ_STATE_DCMD_ACTIVE, &ctx_info->curr_state);
		blk_end_request_all(mrq->req, mrq->cmd->error);
	}

reset:
	spin_lock_irq(mq->queue->queue_lock);