Skip to content

Commit

Permalink
mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
Browse files Browse the repository at this point in the history
mmc_suspend_host() tries to claim host during suspend
and release it only when the bus suspend operation is
compeleted. If CONFIG_MMC_UNSAFE_RESUME is defined and
the host is flagged as removable, mmc_suspend_host()
tries to remove the card. In this process, the file system
sync can get blocked trying to acquire host which is already
claimed by mmc_suspend_host() causing deadlock.

Fix this deadlock by releasing host before ->remove() is called.

Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Acked-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Sujit Reddy Thumma authored and Chris Ball committed Dec 10, 2011
1 parent 524bfca commit 49df780
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2333,6 +2333,8 @@ int mmc_suspend_host(struct mmc_host *host)
mmc_poweroff_notify(host);
err = host->bus_ops->suspend(host);
}
mmc_do_release_host(host);

if (err == -ENOSYS || !host->bus_ops->resume) {
/*
* We simply "remove" the card in this case.
Expand All @@ -2347,7 +2349,6 @@ int mmc_suspend_host(struct mmc_host *host)
host->pm_flags = 0;
err = 0;
}
mmc_do_release_host(host);
} else {
err = -EBUSY;
}
Expand Down

0 comments on commit 49df780

Please sign in to comment.