[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1588348794-4511-1-git-send-email-yanxiaoyong5@gmail.com>
Date: Fri, 1 May 2020 08:59:54 -0700
From: yanxiaoyong5 <yanxiaoyong5@...il.com>
To: ulf.hansson@...aro.org, rrangel@...omium.org, avri.altman@....com,
kstewart@...uxfoundation.org, tglx@...utronix.de
Cc: linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
yanxiaoyong5 <yanxiaoyong5@...il.com>
Subject: [PATCH] mmc/core:fix mmc_sd_hw_reset oops mmc_sd_hw_reset function may be oops if the ejection of sd and the reset of sd simultaneously occur
Signed-off-by: yanxiaoyong5 <yanxiaoyong5@...il.com>
---
drivers/mmc/core/sd.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index fe914ff..73a1e68 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -1247,8 +1247,13 @@ static int mmc_sd_runtime_resume(struct mmc_host *host)
static int mmc_sd_hw_reset(struct mmc_host *host)
{
- mmc_power_cycle(host, host->card->ocr);
- return mmc_sd_init_card(host, host->card->ocr, host->card);
+ struct mmc_card *card;
+
+ card = host->card;
+ if (!card)
+ return -EINVAL;
+ mmc_power_cycle(host, card->ocr);
+ return mmc_sd_init_card(host, card->ocr, host->card);
}
static const struct mmc_bus_ops mmc_sd_ops = {
--
2.7.4
Powered by blists - more mailing lists