[PATCH openEuler-1.0-LTS] mmc: core: Fix kernel panic when remove non-standard SDIO card
From: Matthew Ma <mahongwei@zeku.com> stable inclusion from stable-v4.19.264 commit 1fb79478695d92bab1c120ad3dad05252b02a29d category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IDBMTC CVE: CVE-2022-50640 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=... -------------------------------- 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@zeku.com> Reviewed-by: Weizhao Ouyang <ouyangweizhao@zeku.com> Reviewed-by: John Wang <wangdayu@zeku.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221014034951.2300386-1-ouyangweizhao@zeku.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Conflicts: drivers/mmc/core/sdio_bus.c [Only context conflicts since the commit 605d9fb9556 ("mmc: sdio: fix possible resource leaks in some error paths") is merged.] Signed-off-by: Cai Xinchen <caixinchen1@huawei.com> --- drivers/mmc/core/sdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 2ee4822c9285..dd73e8e83c72 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -264,7 +264,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); /* * We have now removed the link to the tuples in the -- 2.34.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/19658 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/J3F... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/19658 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/J3F...
participants (2)
-
Cai Xinchen -
patchwork bot