This is a note to let you know that I've just added the patch titled mmc: core: Fix kernel panic when remove non-standard SDIO card to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9972e6b404884adae9eec7463e30d9b3c9a70b18 Mon Sep 17 00:00:00 2001 From: Matthew Ma <mahongwei@xxxxxxxx> Date: Fri, 14 Oct 2022 11:49:51 +0800 Subject: mmc: core: Fix kernel panic when remove non-standard SDIO card From: Matthew Ma <mahongwei@xxxxxxxx> 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 <mahongwei@xxxxxxxx> Reviewed-by: Weizhao Ouyang <ouyangweizhao@xxxxxxxx> Reviewed-by: John Wang <wangdayu@xxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@xxxxxxxx Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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 @@ -290,7 +290,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); Patches currently in stable-queue which might be from mahongwei@xxxxxxxx are queue-5.15/mmc-core-fix-kernel-panic-when-remove-non-standard-sdio-card.patch