From 5676c71c6348d806bf7eb7766073aa36c5b960de Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 31 Oct 2022 07:45:13 +0100 Subject: [PATCH] 4.19-stable patches added patches: mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch --- ...c-when-remove-non-standard-sdio-card.patch | 39 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 40 insertions(+) create mode 100644 queue-4.19/mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch diff --git a/queue-4.19/mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch b/queue-4.19/mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch new file mode 100644 index 00000000000..ea4efd294c8 --- /dev/null +++ b/queue-4.19/mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch @@ -0,0 +1,39 @@ +From 9972e6b404884adae9eec7463e30d9b3c9a70b18 Mon Sep 17 00:00:00 2001 +From: Matthew Ma +Date: Fri, 14 Oct 2022 11:49:51 +0800 +Subject: mmc: core: Fix kernel panic when remove non-standard SDIO card + +From: Matthew Ma + +commit 9972e6b404884adae9eec7463e30d9b3c9a70b18 upstream. + +SDIO tuple is only allocated for standard SDIO card, especially it causes +memory corruption issues when the non-standard SDIO card has removed, which +is because the card device's reference counter does not increase for it at +sdio_init_func(), but all SDIO card device reference counter gets decreased +at sdio_release_func(). + +Fixes: 6f51be3d37df ("sdio: allow non-standard SDIO cards") +Signed-off-by: Matthew Ma +Reviewed-by: Weizhao Ouyang +Reviewed-by: John Wang +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@zeku.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/core/sdio_bus.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/mmc/core/sdio_bus.c ++++ b/drivers/mmc/core/sdio_bus.c +@@ -264,7 +264,8 @@ static void sdio_release_func(struct dev + { + struct sdio_func *func = dev_to_sdio_func(dev); + +- sdio_free_func_cis(func); ++ if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO)) ++ sdio_free_func_cis(func); + + kfree(func->info); + kfree(func->tmpbuf); diff --git a/queue-4.19/series b/queue-4.19/series index fe39802414e..f3d7f6d6ad0 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -38,3 +38,4 @@ fbdev-smscufx-fix-several-use-after-free-bugs.patch mac802154-fix-lqi-recording.patch drm-msm-dsi-fix-memory-corruption-with-too-many-bridges.patch drm-msm-hdmi-fix-memory-corruption-with-too-many-bridges.patch +mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch -- 2.47.3