All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] mmc: fix return value check of mmc_add_host()
@ 2022-11-01  6:30 Yang Yingliang
  2022-11-01  6:30 ` [PATCH 1/9] mmc: alcor: " Yang Yingliang
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, but it was ignored in some drivers, if we
ignore it, the memory that allocated in mmc_alloc_host() will be leaked and
it will lead a kernel crash because of deleting not added device in the remove
path.

So fix this by checking the return value and calling mmc_free_host() in error
path.

Yang Yingliang (9):
  mmc: alcor: fix return value check of mmc_add_host()
  mmc: moxart: fix return value check of mmc_add_host()
  mmc: mxcmmc: fix return value check of mmc_add_host()
  mmc: pxamci: fix return value check of mmc_add_host()
  mmc: rtsx_pci: fix return value check of mmc_add_host()
  mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
  mmc: toshsd: fix return value check of mmc_add_host()
  mmc: vub300: fix return value check of mmc_add_host()
  mmc: wmt-sdmmc: fix return value check of mmc_add_host()

 drivers/mmc/host/alcor.c          |  5 ++++-
 drivers/mmc/host/moxart-mmc.c     |  4 +++-
 drivers/mmc/host/mxcmmc.c         |  4 +++-
 drivers/mmc/host/pxamci.c         |  7 ++++++-
 drivers/mmc/host/rtsx_pci_sdmmc.c |  9 ++++++++-
 drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++++++++-
 drivers/mmc/host/toshsd.c         |  6 +++++-
 drivers/mmc/host/vub300.c         | 11 ++++++++---
 drivers/mmc/host/wmt-sdmmc.c      |  6 +++++-
 9 files changed, 52 insertions(+), 11 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/9] mmc: alcor: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 2/9] mmc: moxart: " Yang Yingliang
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and calling mmc_free_host() in the
error path.

Fixes: c5413ad815a6 ("mmc: add new Alcor Micro Cardreader SD/MMC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/alcor.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index bfb8efeb7eb8..d01df01d4b4d 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1114,7 +1114,10 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	alcor_hw_init(host);
 
 	dev_set_drvdata(&pdev->dev, host);
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto free_host;
+
 	return 0;
 
 free_host:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/9] mmc: moxart: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
  2022-11-01  6:30 ` [PATCH 1/9] mmc: alcor: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 3/9] mmc: mxcmmc: " Yang Yingliang
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host().

Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/moxart-mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index dfc3ffd5b1f8..52ed30f2d9f4 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -665,7 +665,9 @@ static int moxart_probe(struct platform_device *pdev)
 		goto out;
 
 	dev_set_drvdata(dev, mmc);
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto out;
 
 	dev_dbg(dev, "IRQ=%d, FIFO is %d bytes\n", irq, host->fifo_width);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/9] mmc: mxcmmc: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
  2022-11-01  6:30 ` [PATCH 1/9] mmc: alcor: " Yang Yingliang
  2022-11-01  6:30 ` [PATCH 2/9] mmc: moxart: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 4/9] mmc: pxamci: " Yang Yingliang
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host().

Fixes: d96be879ff46 ("mmc: Add a MX2/MX3 specific SDHC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/mxcmmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 2cf0413407ea..668f865f3efb 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1143,7 +1143,9 @@ static int mxcmci_probe(struct platform_device *pdev)
 
 	timer_setup(&host->watchdog, mxcmci_watchdog, 0);
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto out_free_dma;
 
 	return 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/9] mmc: pxamci: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (2 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 3/9] mmc: mxcmmc: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 5/9] mmc: rtsx_pci: " Yang Yingliang
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host(), besides, ->exit() need be called to uninit the pdata.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/pxamci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index e4003f6058eb..2a988f942b6c 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -763,7 +763,12 @@ static int pxamci_probe(struct platform_device *pdev)
 			dev_warn(dev, "gpio_ro and get_ro() both defined\n");
 	}
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret) {
+		if (host->pdata && host->pdata->exit)
+			host->pdata->exit(dev, mmc);
+		goto out;
+	}
 
 	return 0;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/9] mmc: rtsx_pci: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (3 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 4/9] mmc: pxamci: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 6/9] mmc: rtsx_usb_sdmmc: " Yang Yingliang
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and calling mmc_free_host() in the
error path, beside, runtime PM also needs be disabled.

Fixes: ff984e57d36e ("mmc: Add realtek pcie sdmmc host driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index e1580f78c6b2..8098726dcc0b 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1474,6 +1474,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	struct realtek_pci_sdmmc *host;
 	struct rtsx_pcr *pcr;
 	struct pcr_handle *handle = pdev->dev.platform_data;
+	int ret;
 
 	if (!handle)
 		return -ENXIO;
@@ -1511,7 +1512,13 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
 	pm_runtime_mark_last_busy(&pdev->dev);
 	pm_runtime_use_autosuspend(&pdev->dev);
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret) {
+		pm_runtime_dont_use_autosuspend(&pdev->dev);
+		pm_runtime_disable(&pdev->dev);
+		mmc_free_host(mmc);
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/9] mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (4 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 5/9] mmc: rtsx_pci: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 7/9] mmc: toshsd: " Yang Yingliang
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and calling mmc_free_host() in the
error path, besides, led_classdev_unregister() and pm_runtime_disable() also
need be called.

Fixes: c7f6558d84af ("mmc: Add realtek USB sdmmc host driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 5798aee06653..2c650cd58693 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -1329,6 +1329,7 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
 #ifdef RTSX_USB_USE_LEDS_CLASS
 	int err;
 #endif
+	int ret;
 
 	ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent));
 	if (!ucr)
@@ -1365,7 +1366,15 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
 	INIT_WORK(&host->led_work, rtsx_usb_update_led);
 
 #endif
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret) {
+#ifdef RTSX_USB_USE_LEDS_CLASS
+		led_classdev_unregister(&host->led);
+#endif
+		mmc_free_host(mmc);
+		pm_runtime_disable(&pdev->dev);
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 7/9] mmc: toshsd: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (5 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 6/9] mmc: rtsx_usb_sdmmc: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 8/9] mmc: vub300: " Yang Yingliang
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host(), besides, free_irq() also needs be called.

Fixes: a5eb8bbd66cc ("mmc: add Toshiba PCI SD controller driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/toshsd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/toshsd.c b/drivers/mmc/host/toshsd.c
index 8d037c2071ab..497791ffada6 100644
--- a/drivers/mmc/host/toshsd.c
+++ b/drivers/mmc/host/toshsd.c
@@ -651,7 +651,9 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto unmap;
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto free_irq;
 
 	base = pci_resource_start(pdev, 0);
 	dev_dbg(&pdev->dev, "MMIO %pa, IRQ %d\n", &base, pdev->irq);
@@ -660,6 +662,8 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	return 0;
 
+free_irq:
+	free_irq(pdev->irq, host);
 unmap:
 	pci_iounmap(pdev, host->ioaddr);
 release:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 8/9] mmc: vub300: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (6 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 7/9] mmc: toshsd: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-01  6:30 ` [PATCH 9/9] mmc: wmt-sdmmc: " Yang Yingliang
  2022-11-08 16:05 ` [PATCH 0/9] mmc: " Ulf Hansson
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host(), besides, the timer added before mmc_add_host() needs be del.

And this patch fixes another missing call mmc_free_host() if usb_control_msg()
fails.

Fixes: 88095e7b473a ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/vub300.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index 97beece62fec..ab36ec479747 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2299,14 +2299,14 @@ static int vub300_probe(struct usb_interface *interface,
 				0x0000, 0x0000, &vub300->system_port_status,
 				sizeof(vub300->system_port_status), 1000);
 	if (retval < 0) {
-		goto error4;
+		goto error5;
 	} else if (sizeof(vub300->system_port_status) == retval) {
 		vub300->card_present =
 			(0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
 		vub300->read_only =
 			(0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
 	} else {
-		goto error4;
+		goto error5;
 	}
 	usb_set_intfdata(interface, vub300);
 	INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
@@ -2329,8 +2329,13 @@ static int vub300_probe(struct usb_interface *interface,
 			 "USB vub300 remote SDIO host controller[%d]"
 			 "connected with no SD/SDIO card inserted\n",
 			 interface_to_InterfaceNumber(interface));
-	mmc_add_host(mmc);
+	retval = mmc_add_host(mmc);
+	if (retval)
+		goto error6;
+
 	return 0;
+error6:
+	del_timer_sync(&vub300->inactivity_timer);
 error5:
 	mmc_free_host(mmc);
 	/*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 9/9] mmc: wmt-sdmmc: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (7 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 8/9] mmc: vub300: " Yang Yingliang
@ 2022-11-01  6:30 ` Yang Yingliang
  2022-11-08 16:05 ` [PATCH 0/9] mmc: " Ulf Hansson
  9 siblings, 0 replies; 11+ messages in thread
From: Yang Yingliang @ 2022-11-01  6:30 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, yangyingliang

mmc_add_host() may return error, if we ignore its return value, the memory
that allocated in mmc_alloc_host() will be leaked and it will lead a kernel
crash because of deleting not added device in the remove path.

So fix this by checking the return value and goto error path which will call
mmc_free_host(), besides, clk_disable_unprepare() also needs be called.

Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mmc/host/wmt-sdmmc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 9b5c503e3a3f..9aa3027ca25e 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -856,11 +856,15 @@ static int wmt_mci_probe(struct platform_device *pdev)
 	/* configure the controller to a known 'ready' state */
 	wmt_reset_hardware(mmc);
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto fail7;
 
 	dev_info(&pdev->dev, "WMT SDHC Controller initialized\n");
 
 	return 0;
+fail7:
+	clk_disable_unprepare(priv->clk_sdmmc);
 fail6:
 	clk_put(priv->clk_sdmmc);
 fail5_and_a_half:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/9] mmc: fix return value check of mmc_add_host()
  2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
                   ` (8 preceding siblings ...)
  2022-11-01  6:30 ` [PATCH 9/9] mmc: wmt-sdmmc: " Yang Yingliang
@ 2022-11-08 16:05 ` Ulf Hansson
  9 siblings, 0 replies; 11+ messages in thread
From: Ulf Hansson @ 2022-11-08 16:05 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-mmc

On Tue, 1 Nov 2022 at 07:32, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> mmc_add_host() may return error, but it was ignored in some drivers, if we
> ignore it, the memory that allocated in mmc_alloc_host() will be leaked and
> it will lead a kernel crash because of deleting not added device in the remove
> path.
>
> So fix this by checking the return value and calling mmc_free_host() in error
> path.
>
> Yang Yingliang (9):
>   mmc: alcor: fix return value check of mmc_add_host()
>   mmc: moxart: fix return value check of mmc_add_host()
>   mmc: mxcmmc: fix return value check of mmc_add_host()
>   mmc: pxamci: fix return value check of mmc_add_host()
>   mmc: rtsx_pci: fix return value check of mmc_add_host()
>   mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
>   mmc: toshsd: fix return value check of mmc_add_host()
>   mmc: vub300: fix return value check of mmc_add_host()
>   mmc: wmt-sdmmc: fix return value check of mmc_add_host()
>
>  drivers/mmc/host/alcor.c          |  5 ++++-
>  drivers/mmc/host/moxart-mmc.c     |  4 +++-
>  drivers/mmc/host/mxcmmc.c         |  4 +++-
>  drivers/mmc/host/pxamci.c         |  7 ++++++-
>  drivers/mmc/host/rtsx_pci_sdmmc.c |  9 ++++++++-
>  drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++++++++-
>  drivers/mmc/host/toshsd.c         |  6 +++++-
>  drivers/mmc/host/vub300.c         | 11 ++++++++---
>  drivers/mmc/host/wmt-sdmmc.c      |  6 +++++-
>  9 files changed, 52 insertions(+), 11 deletions(-)
>

Applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-11-08 16:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  6:30 [PATCH 0/9] mmc: fix return value check of mmc_add_host() Yang Yingliang
2022-11-01  6:30 ` [PATCH 1/9] mmc: alcor: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 2/9] mmc: moxart: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 3/9] mmc: mxcmmc: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 4/9] mmc: pxamci: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 5/9] mmc: rtsx_pci: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 6/9] mmc: rtsx_usb_sdmmc: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 7/9] mmc: toshsd: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 8/9] mmc: vub300: " Yang Yingliang
2022-11-01  6:30 ` [PATCH 9/9] mmc: wmt-sdmmc: " Yang Yingliang
2022-11-08 16:05 ` [PATCH 0/9] mmc: " Ulf Hansson

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.