diff mbox series

[1/4] mmc: bcm2835: Fix DMA channel leak on probe error

Message ID 9b09dda9817f61a0cfb3991abf11abb1fe7f41c9.1547911374.git.lukas@wunner.de (mailing list archive)
State New, archived
Headers show
Series [1/4] mmc: bcm2835: Fix DMA channel leak on probe error | expand

Commit Message

Lukas Wunner Jan. 19, 2019, 3:31 p.m. UTC
The BCM2835 MMC host driver requests a DMA channel on probe but neglects
to release the channel in the probe error path.  The channel may
therefore be leaked, in particular if devm_clk_get() causes probe
deferral.  Fix it.

Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org # v4.12+
Cc: Frank Pavlic <f.pavlic@kunbus.de>
---
 drivers/mmc/host/bcm2835.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ulf Hansson Jan. 28, 2019, 12:03 p.m. UTC | #1
On Sat, 19 Jan 2019 at 16:31, Lukas Wunner <lukas@wunner.de> wrote:
>
> The BCM2835 MMC host driver requests a DMA channel on probe but neglects
> to release the channel in the probe error path.  The channel may
> therefore be leaked, in particular if devm_clk_get() causes probe
> deferral.  Fix it.
>
> Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: stable@vger.kernel.org # v4.12+
> Cc: Frank Pavlic <f.pavlic@kunbus.de>

Applied for fixes and added Stefan's tested-by tag, thanks!

For the rest of the series, I am expecting a you to re-post a v2.

Kind regards
Uffe



> ---
>  drivers/mmc/host/bcm2835.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
> index 50293529d6de..c9e7aa50bb0a 100644
> --- a/drivers/mmc/host/bcm2835.c
> +++ b/drivers/mmc/host/bcm2835.c
> @@ -1431,6 +1431,8 @@ static int bcm2835_probe(struct platform_device *pdev)
>
>  err:
>         dev_dbg(dev, "%s -> err %d\n", __func__, ret);
> +       if (host->dma_chan_rxtx)
> +               dma_release_channel(host->dma_chan_rxtx);
>         mmc_free_host(mmc);
>
>         return ret;
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 50293529d6de..c9e7aa50bb0a 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1431,6 +1431,8 @@  static int bcm2835_probe(struct platform_device *pdev)
 
 err:
 	dev_dbg(dev, "%s -> err %d\n", __func__, ret);
+	if (host->dma_chan_rxtx)
+		dma_release_channel(host->dma_chan_rxtx);
 	mmc_free_host(mmc);
 
 	return ret;