Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sh_mmcif: sg_miter must not be atomic

All the sglist iterations happen in the *threaded* interrupt handler and
that context is not atomic, so don't request an atomic sglist miter. Using
an atomic miter results in "BUG: scheduling while atomic" splats.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 27b57277d9ba ("mmc: sh_mmcif: Use sg_miter for PIO")
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240221-fix-sh-mmcif-v2-1-5e521eb25ae4@linaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Linus Walleij and committed by
Ulf Hansson
727cba70 44d41bf6

+4 -4
+4 -4
drivers/mmc/host/sh_mmcif.c
··· 607 607 BLOCK_SIZE_MASK) + 3; 608 608 609 609 sg_miter_start(&host->sg_miter, data->sg, data->sg_len, 610 - SG_MITER_ATOMIC | SG_MITER_TO_SG); 610 + SG_MITER_TO_SG); 611 611 612 612 host->wait_for = MMCIF_WAIT_FOR_READ; 613 613 ··· 662 662 BLOCK_SIZE_MASK; 663 663 664 664 sg_miter_start(&host->sg_miter, data->sg, data->sg_len, 665 - SG_MITER_ATOMIC | SG_MITER_TO_SG); 665 + SG_MITER_TO_SG); 666 666 667 667 host->wait_for = MMCIF_WAIT_FOR_MREAD; 668 668 ··· 710 710 BLOCK_SIZE_MASK) + 3; 711 711 712 712 sg_miter_start(&host->sg_miter, data->sg, data->sg_len, 713 - SG_MITER_ATOMIC | SG_MITER_FROM_SG); 713 + SG_MITER_FROM_SG); 714 714 715 715 host->wait_for = MMCIF_WAIT_FOR_WRITE; 716 716 ··· 765 765 BLOCK_SIZE_MASK; 766 766 767 767 sg_miter_start(&host->sg_miter, data->sg, data->sg_len, 768 - SG_MITER_ATOMIC | SG_MITER_FROM_SG); 768 + SG_MITER_FROM_SG); 769 769 770 770 host->wait_for = MMCIF_WAIT_FOR_MWRITE; 771 771