Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: "Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>
To: linux-mmc@vger.kernel.org
Cc: "Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>,
	Ram Muthiah <rammuthiah@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ritesh Harjani <riteshh@codeaurora.org>,
	Asutosh Das <asutoshd@codeaurora.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: [PATCH 1/1] mmc: sdhci: check host->cmd is null or not in sdhci_cqe_irq()
Date: Wed, 31 Aug 2022 20:43:59 +0800	[thread overview]
Message-ID: <20220831124359.2005165-2-paulliu@debian.org> (raw)
In-Reply-To: <20220831124359.2005165-1-paulliu@debian.org>

From: "Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>

If we don't check host->cmd. We will get the following oops
when booting from eMMC on RockPi4.

 Unable to handle kernel read from unreadable memory at
   virtual address 0000000000000000
 Call trace:
   sdhci_cqe_irq+0x40/0x254

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ritesh Harjani <riteshh@codeaurora.org>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/sdhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7689ffec5ad1..e0e7768bd6c0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3928,7 +3928,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
 
 	if (intmask & (SDHCI_INT_INDEX | SDHCI_INT_END_BIT | SDHCI_INT_CRC)) {
 		*cmd_error = -EILSEQ;
-		if (!mmc_op_tuning(host->cmd->opcode))
+		if (host->cmd && !mmc_op_tuning(host->cmd->opcode))
 			sdhci_err_stats_inc(host, CMD_CRC);
 	} else if (intmask & SDHCI_INT_TIMEOUT) {
 		*cmd_error = -ETIMEDOUT;
@@ -3938,7 +3938,7 @@ bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
 
 	if (intmask & (SDHCI_INT_DATA_END_BIT | SDHCI_INT_DATA_CRC)) {
 		*data_error = -EILSEQ;
-		if (!mmc_op_tuning(host->cmd->opcode))
+		if (host->cmd && !mmc_op_tuning(host->cmd->opcode))
 			sdhci_err_stats_inc(host, DAT_CRC);
 	} else if (intmask & SDHCI_INT_DATA_TIMEOUT) {
 		*data_error = -ETIMEDOUT;
-- 
2.35.1


  reply	other threads:[~2022-08-31 12:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 12:43 [PATCH 0/1] mmc: sdhci: check host->cmd is null or not in sdhci_cqe_irq() Ying-Chun Liu (PaulLiu)
2022-08-31 12:43 ` Ying-Chun Liu (PaulLiu) [this message]
2022-09-07  7:05   ` [PATCH 1/1] " Adrian Hunter
2022-09-07 10:03     ` Ulf Hansson
2022-09-07 11:03       ` Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220831124359.2005165-2-paulliu@debian.org \
    --to=paul.liu@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=asutoshd@codeaurora.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rammuthiah@google.com \
    --cc=riteshh@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox