Commit 9972e6b4 authored by Matthew Ma's avatar Matthew Ma Committed by Ulf Hansson

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: 6f51be3d ("sdio: allow non-standard SDIO cards")
Signed-off-by: default avatarMatthew Ma <mahongwei@zeku.com>
Reviewed-by: default avatarWeizhao Ouyang <ouyangweizhao@zeku.com>
Reviewed-by: default avatarJohn Wang <wangdayu@zeku.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@zeku.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 9dc0033e
......@@ -291,7 +291,8 @@ static void sdio_release_func(struct device *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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment