All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: mahongwei@zeku.com
Cc: wangqinyuan@zeku.com, chengwei@zeku.com,
	Hongwei Ma <mahongwei_123@126.com>,
	stable@vger.kernel.org, Peter Chen <peter.chen@kernel.org>
Subject: [PATCH 1/1] mmc: core: sdio_bus: call sdio_free_func_cis only for standard SDIO card
Date: Fri,  5 Feb 2021 22:18:45 +0800	[thread overview]
Message-ID: <20210205141845.21701-1-peter.chen@kernel.org> (raw)

From: Hongwei Ma <mahongwei_123@126.com>

tuple is only allcated for standard SDIO card, especially it causes memory
corruption issue when the non-standard SDIO card has removed since the card
device's reference counter does not increase for it at sdio_init_func, but
all SDIO card device reference counter has decreased at sdio_release_func.

Cc: <stable@vger.kernel.org> #v5.4+
Signed-off-by: Peter Chen <peter.chen@kernel.org>
---
 drivers/mmc/core/sdio_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 3d709029e07c..50279f805a53 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -292,7 +292,8 @@ static void sdio_release_func(struct device *dev)
 {
 	struct sdio_func *func = dev_to_sdio_func(dev);
 
-	sdio_free_func_cis(func);
+	if (!(card->quirks & MMC_QUIRK_NONSTD_SDIO))
+		sdio_free_func_cis(func);
 
 	kfree(func->info);
 	kfree(func->tmpbuf);
-- 
2.17.1


                 reply	other threads:[~2021-02-05 17:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210205141845.21701-1-peter.chen@kernel.org \
    --to=peter.chen@kernel.org \
    --cc=chengwei@zeku.com \
    --cc=mahongwei@zeku.com \
    --cc=mahongwei_123@126.com \
    --cc=stable@vger.kernel.org \
    --cc=wangqinyuan@zeku.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.