mmc: moxart: Fix null pointer dereference on pointer host
authorColin Ian King <colin.king@canonical.com>
Wed, 13 Oct 2021 10:00:52 +0000 (11:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:20 +0000 (19:17 +0100)
commit32d126ac68f574432959fe938f06e257678b2ae5
tree216d7ea43fa3baaa5349ce1ac81b47342107c064
parent6f11f2096b2c752aea7e5c72d602626e893867ef
mmc: moxart: Fix null pointer dereference on pointer host

commit 0eab756f8821d255016c63bb55804c429ff4bdb1 upstream.

There are several error return paths that dereference the null pointer
host because the pointer has not yet been set to a valid value.
Fix this by adding a new out_mmc label and exiting via this label
to avoid the host clean up and hence the null pointer dereference.

Addresses-Coverity: ("Explicit null dereference")
Fixes: 8105c2abbf36 ("mmc: moxart: Fix reference count leaks in moxart_probe")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20211013100052.125461-1-colin.king@canonical.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/moxart-mmc.c