mmc: core: Fix error when SD card is removed
The device reboots when the SD card is removed. This is because the host->claimer resource has been released earlier as part of the SD card removal process. When mmc_try_claim_host tries to check the host->claimer->task, it dereferences a NULL pointer. Change-Id: I8625b17e337248791de6fac2ba5b3a2d5e82894e Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
This commit is contained in:
@@ -1787,12 +1787,13 @@ int mmc_try_claim_host(struct mmc_host *host, unsigned int delay_ms)
|
||||
unsigned long flags;
|
||||
int retry_cnt = delay_ms/10;
|
||||
bool pm = false;
|
||||
struct task_struct *task = current;
|
||||
|
||||
do {
|
||||
spin_lock_irqsave(&host->lock, flags);
|
||||
if (!host->claimed || host->claimer->task == current) {
|
||||
if (!host->claimed || mmc_ctx_matches(host, NULL, task)) {
|
||||
host->claimed = 1;
|
||||
host->claimer->task = current;
|
||||
mmc_ctx_set_claimer(host, NULL, task);
|
||||
host->claim_cnt += 1;
|
||||
claimed_host = 1;
|
||||
if (host->claim_cnt == 1)
|
||||
|
||||
@@ -1197,8 +1197,6 @@ static void mmc_sd_detect(struct mmc_host *host)
|
||||
return;
|
||||
}
|
||||
|
||||
mmc_get_card(host->card, NULL);
|
||||
|
||||
/*
|
||||
* Just check if our card has been removed.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user