From: Greg Kroah-Hartman Date: Sun, 25 Jan 2015 17:45:59 +0000 (-0800) Subject: 3.10-stable patches X-Git-Tag: v3.10.66~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f19ac3c4c846b7fcd12400e0f477dca76ef0c9d3;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: mmc-sdhci-fix-sleep-in-atomic-after-inserting-sd-card.patch --- diff --git a/queue-3.10/mmc-sdhci-fix-sleep-in-atomic-after-inserting-sd-card.patch b/queue-3.10/mmc-sdhci-fix-sleep-in-atomic-after-inserting-sd-card.patch new file mode 100644 index 00000000000..48dbee787ac --- /dev/null +++ b/queue-3.10/mmc-sdhci-fix-sleep-in-atomic-after-inserting-sd-card.patch @@ -0,0 +1,79 @@ +From 2836766a9d0bd02c66073f8dd44796e6cc23848d Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 5 Jan 2015 10:50:15 +0100 +Subject: mmc: sdhci: Fix sleep in atomic after inserting SD card + +From: Krzysztof Kozlowski + +commit 2836766a9d0bd02c66073f8dd44796e6cc23848d upstream. + +Sleep in atomic context happened on Trats2 board after inserting or +removing SD card because mmc_gpio_get_cd() was called under spin lock. + +Fix this by moving card detection earlier, before acquiring spin lock. +The mmc_gpio_get_cd() call does not have to be protected by spin lock +because it does not access any sdhci internal data. +The sdhci_do_get_cd() call access host flags (SDHCI_DEVICE_DEAD). After +moving it out side of spin lock it could theoretically race with driver +removal but still there is no actual protection against manual card +eject. + +Dmesg after inserting SD card: +[ 41.663414] BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1511 +[ 41.670469] in_atomic(): 1, irqs_disabled(): 128, pid: 30, name: kworker/u8:1 +[ 41.677580] INFO: lockdep is turned off. +[ 41.681486] irq event stamp: 61972 +[ 41.684872] hardirqs last enabled at (61971): [] _raw_spin_unlock_irq+0x24/0x5c +[ 41.693118] hardirqs last disabled at (61972): [] _raw_spin_lock_irq+0x18/0x54 +[ 41.701190] softirqs last enabled at (61648): [] __do_softirq+0x234/0x2c8 +[ 41.708914] softirqs last disabled at (61631): [] irq_exit+0xd0/0x114 +[ 41.716206] Preemption disabled at:[< (null)>] (null) +[ 41.721500] +[ 41.722985] CPU: 3 PID: 30 Comm: kworker/u8:1 Tainted: G W 3.18.0-rc5-next-20141121 #883 +[ 41.732111] Workqueue: kmmcd mmc_rescan +[ 41.735945] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) +[ 41.743661] [] (show_stack) from [] (dump_stack+0x70/0xbc) +[ 41.750867] [] (dump_stack) from [] (gpiod_get_raw_value_cansleep+0x18/0x30) +[ 41.759628] [] (gpiod_get_raw_value_cansleep) from [] (mmc_gpio_get_cd+0x38/0x58) +[ 41.768821] [] (mmc_gpio_get_cd) from [] (sdhci_request+0x50/0x1a4) +[ 41.776808] [] (sdhci_request) from [] (mmc_start_request+0x138/0x268) +[ 41.785051] [] (mmc_start_request) from [] (mmc_wait_for_req+0x58/0x1a0) +[ 41.793469] [] (mmc_wait_for_req) from [] (mmc_wait_for_cmd+0x58/0x78) +[ 41.801714] [] (mmc_wait_for_cmd) from [] (mmc_io_rw_direct_host+0x98/0x124) +[ 41.810480] [] (mmc_io_rw_direct_host) from [] (sdio_reset+0x2c/0x64) +[ 41.818641] [] (sdio_reset) from [] (mmc_rescan+0x254/0x2e4) +[ 41.826028] [] (mmc_rescan) from [] (process_one_work+0x180/0x3f4) +[ 41.833920] [] (process_one_work) from [] (worker_thread+0x34/0x4b0) +[ 41.841991] [] (worker_thread) from [] (kthread+0xe4/0x104) +[ 41.849285] [] (kthread) from [] (ret_from_fork+0x14/0x2c) +[ 42.038276] mmc0: new high speed SDHC card at address 1234 + +Signed-off-by: Krzysztof Kozlowski +Fixes: 94144a465dd0 ("mmc: sdhci: add get_cd() implementation") +Cc: +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/sdhci.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -1316,6 +1316,8 @@ static void sdhci_request(struct mmc_hos + + sdhci_runtime_pm_get(host); + ++ present = mmc_gpio_get_cd(host->mmc); ++ + spin_lock_irqsave(&host->lock, flags); + + WARN_ON(host->mrq != NULL); +@@ -1344,7 +1346,6 @@ static void sdhci_request(struct mmc_hos + * zero: cd-gpio is used, and card is removed + * one: cd-gpio is used, and card is present + */ +- present = mmc_gpio_get_cd(host->mmc); + if (present < 0) { + /* If polling, assume that the card is always present. */ + if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) diff --git a/queue-3.10/series b/queue-3.10/series index fe51b8eb65f..c8aa63f25d2 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -43,3 +43,4 @@ decompress_bunzip2-off-by-one-in-get_next_block.patch um-skip-futex_atomic_cmpxchg_inatomic-test.patch x86-um-actually-mark-system-call-tables-readonly.patch lockd-fix-a-race-when-initialising-nlmsvc_timeout.patch +mmc-sdhci-fix-sleep-in-atomic-after-inserting-sd-card.patch