提交 691034e6 编写于 作者: M Matthew Ma 提交者: Lipeng Sang

mmc: core: Fix kernel panic when remove non-standard SDIO card

stable inclusion
from stable-v5.10.153
commit 8bf037279b5869ae9331c42bb1527d2680ebba96
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I64YCA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8bf037279b5869ae9331c42bb1527d2680ebba96

--------------------------------

commit 9972e6b4 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: 6f51be3d ("sdio: allow non-standard SDIO cards")
Signed-off-by: NMatthew Ma <mahongwei@zeku.com>
Reviewed-by: NWeizhao Ouyang <ouyangweizhao@zeku.com>
Reviewed-by: NJohn Wang <wangdayu@zeku.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@zeku.comSigned-off-by: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
上级 a9024e2d
......@@ -292,7 +292,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册