Commit 0551b3d1 authored by Yang Yingliang's avatar Yang Yingliang Committed by Li Nan
Browse files

mmc: mmc_spi: fix error handling in mmc_spi_probe()

stable inclusion
from stable-v5.10.169
commit 0b3edcb24bd81b3b2e3dac89f4733bfd47d283be
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9R4N9
CVE: CVE-2023-52708

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



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

commit cf4c9d2a upstream.

If mmc_add_host() fails, it doesn't need to call mmc_remove_host(),
or it will cause null-ptr-deref, because of deleting a not added
device in mmc_remove_host().

To fix this, goto label 'fail_glue_init', if mmc_add_host() fails,
and change the label 'fail_add_host' to 'fail_gpiod_request'.

Fixes: 15a0580c ("mmc_spi host driver")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230131013835.3564011-1-yangyingliang@huawei.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
Conflicts:
	drivers/mmc/host/mmc_spi.c
[ Context conflict ]
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
parent 0a378cfa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment