Skip to contentSkip to conversation

mmc: core: sdio_bus: call sdio_free_func_cis only for standard SDIO card

PATCH New Peter Chen 1 participant 1 message Feb 5, 2021

Subsystems (2)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH 1/1 mmc: core: sdio_bus: call sdio_free_func_cis only for standard SDIO card

From: Hongwei Ma <[email protected]>

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.

---
 drivers/mmc/core/sdio_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/sdio_bus.c +2 -1
index 3d709029e07c..50279f805a53 100644
@@ -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);
Signature · 1 line
2.17.1