All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: linux-mmc@vger.kernel.org, Ulf Hansson <ulf.hansson@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Douglas Anderson <dianders@chromium.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Yong Mao <yong.mao@mediatek.com>,
	Chaotian Jing <chaotian.jing@mediatek.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/4] mmc: sdio: Fix potential NULL pointer error in mmc_sdio_init_card()
Date: Thu, 30 Apr 2020 11:16:37 +0200	[thread overview]
Message-ID: <20200430091640.455-2-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20200430091640.455-1-ulf.hansson@linaro.org>

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>
---
 drivers/mmc/core/sdio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index ebb387aa5158..d35679e6e6aa 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -718,9 +718,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.20.1


  reply	other threads:[~2020-04-30  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  9:16 [PATCH 0/4] mmc: sdio: Fix various issues in mmc_sdio_init_card() Ulf Hansson
2020-04-30  9:16 ` Ulf Hansson [this message]
2020-04-30  9:16 ` [PATCH 2/4] mmc: sdio: Fix several potential memory leaks " Ulf Hansson
2020-05-01  2:55   ` Sasha Levin
2020-04-30  9:16 ` [PATCH 3/4] mmc: sdio: Re-use negotiated OCR mask when re-sending CMD8 Ulf Hansson
2020-04-30  9:16 ` [PATCH 4/4] mmc: sdio: Align the initialization commands in retry path for UHS-I Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200430091640.455-2-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=chaotian.jing@mediatek.com \
    --cc=dianders@chromium.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=stable@vger.kernel.org \
    --cc=yong.mao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.