| From 912ebb0d7b111b7230bc74caaa5e4a209f18b33c Mon Sep 17 00:00:00 2001 |
| From: Ulf Hansson <ulf.hansson@linaro.org> |
| Date: Thu, 30 Apr 2020 11:16:37 +0200 |
| Subject: [PATCH] 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: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c |
| index 712a7742765e..8d93b668e897 100644 |
| --- a/drivers/mmc/core/sdio.c |
| +++ b/drivers/mmc/core/sdio.c |
| @@ -720,9 +720,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, |
| /* Retry init sequence, but without R4_18V_PRESENT. */ |
| retries = 0; |
| goto try_again; |
| - } else { |
| - goto remove; |
| } |
| + return err; |
| } |
| |
| /* |
| -- |
| 2.27.0 |
| |