Skip to content

Commit 9972e6b

Browse files
Matthew Mastorulf
authored andcommitted
mmc: core: Fix kernel panic when remove non-standard SDIO card
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: 6f51be3 ("sdio: allow non-standard SDIO cards") Signed-off-by: Matthew Ma <[email protected]> Reviewed-by: Weizhao Ouyang <[email protected]> Reviewed-by: John Wang <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 9dc0033 commit 9972e6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mmc/core/sdio_bus.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ static void sdio_release_func(struct device *dev)
291291
{
292292
struct sdio_func *func = dev_to_sdio_func(dev);
293293

294-
sdio_free_func_cis(func);
294+
if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO))
295+
sdio_free_func_cis(func);
295296

296297
kfree(func->info);
297298
kfree(func->tmpbuf);

0 commit comments

Comments
 (0)