mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card()
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 30 Apr 2020 09:16:37 +0000 (11:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jun 2020 14:42:08 +0000 (16:42 +0200)
commite0f61e3ab2d8d99f92dac85615b0e962121d6d24
tree4a068fdad8c0bd75982a59f82cafae8fcf2ed065
parent380b60cd3c25d2f1db17ed66ca70ff6fc50baae4
mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card()

commit f04086c225da11ad16d7f9a2fbca6483ab16dded upstream.

During some scenarios mmc_sdio_init_card() runs a retry path for the UHS-I
specific initialization, which leads to removal of the previously allocated
card. A new card is then re-allocated while retrying.

However, in one of the corresponding error paths we may end up to remove an
already removed card, which likely leads to a NULL pointer exception. So,
let's fix this.

Fixes: 5fc3d80ef496 ("mmc: sdio: don't use rocr to check if the card could support UHS mode")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20200430091640.455-2-ulf.hansson@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/sdio.c