From: "Bao D. Nguyen" <nguyenb@codeaurora.org>
To: ulf.hansson@linaro.org, robh+dt@kernel.org, linux-scsi@vger.kernel.org
Cc: linux-mmc@vger.kernel.org, asutoshd@codeaurora.org,
cang@codeaurora.org, Ritesh Harjani <riteshh@codeaurora.org>,
linux-arm-msm@vger.kernel.org,
"Bao D. Nguyen" <nguyenb@codeaurora.org>
Subject: [PATCH v2 3/4] mmc: core: Make host->card as NULL when card is removed
Date: Thu, 5 Mar 2020 20:58:17 -0800 [thread overview]
Message-ID: <17f39df2f08f6d40b829d115255ddb2d2ef4bc2a.1583470026.git.nguyenb@codeaurora.org> (raw)
In-Reply-To: <cover.1583470026.git.nguyenb@codeaurora.org>
In-Reply-To: <cover.1583470026.git.nguyenb@codeaurora.org>
From: Ritesh Harjani <riteshh@codeaurora.org>
Make host->card as NULL when card is removed otherwise
we do see some kernel crashes in async contexts,
where host->card is referred (as dangling pointer).
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
---
drivers/mmc/core/bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 74de3f2..e83821c 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -247,12 +247,15 @@ void mmc_unregister_driver(struct mmc_driver *drv)
static void mmc_release_card(struct device *dev)
{
struct mmc_card *card = mmc_dev_to_card(dev);
+ struct mmc_host *host = card->host;
sdio_free_common_cis(card);
kfree(card->info);
kfree(card);
+ if (host)
+ host->card = NULL;
}
/*
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2020-03-06 4:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-06 4:58 [PATCH v2 0/4] SD card bug fixes Bao D. Nguyen
2020-03-06 4:58 ` [PATCH v2 1/4] mmc: core: Add check for NULL pointer access Bao D. Nguyen
2020-03-06 10:34 ` Ulf Hansson
2020-03-06 4:58 ` [PATCH v2 2/4] mmc: core: Attribute the IO wait time properly in mmc_wait_for_req_done() Bao D. Nguyen
2020-03-06 4:58 ` Bao D. Nguyen [this message]
2020-03-06 4:58 ` [PATCH v2 4/4] mmc: core: update host->card after getting RCA for SD card Bao D. Nguyen
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=17f39df2f08f6d40b829d115255ddb2d2ef4bc2a.1583470026.git.nguyenb@codeaurora.org \
--to=nguyenb@codeaurora.org \
--cc=asutoshd@codeaurora.org \
--cc=cang@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=riteshh@codeaurora.org \
--cc=robh+dt@kernel.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