]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mmc: mmc_spi: fix error handling in mmc_spi_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 31 Jan 2023 01:38:35 +0000 (09:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:55:55 +0000 (12:55 +0100)
commit0b3edcb24bd81b3b2e3dac89f4733bfd47d283be
tree59baed4e03139981b2c07dd640d61c5cf38cd9b8
parent30716d9f0fa1766e522cf24c8a456244e4fc9931
mmc: mmc_spi: fix error handling in mmc_spi_probe()

commit cf4c9d2ac1e42c7d18b921bec39486896645b714 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: 15a0580ced08 ("mmc_spi host driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230131013835.3564011-1-yangyingliang@huawei.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/mmc_spi.c