All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mmc: core: sdio_bus: call sdio_free_func_cis only for standard SDIO card
@ 2021-02-05 14:18 Peter Chen
  0 siblings, 0 replies; only message in thread
From: Peter Chen @ 2021-02-05 14:18 UTC (permalink / raw)
  To: mahongwei; +Cc: wangqinyuan, chengwei, Hongwei Ma, stable, Peter Chen

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-05 17:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 14:18 [PATCH 1/1] mmc: core: sdio_bus: call sdio_free_func_cis only for standard SDIO card Peter Chen

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.