lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200109071945.6iabyp5ohevztene@M43218.corp.atmel.com>
Date:   Thu, 9 Jan 2020 08:19:45 +0100
From:   Ludovic Desroches <ludovic.desroches@...rochip.com>
To:     Michał Mirosław <mirq-linux@...e.qmqm.pl>
CC:     <linux-mmc@...r.kernel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        "Ulf Hansson" <ulf.hansson@...aro.org>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc: sdhci-of-at91: fix memleak on clk_get failure

On Thu, Jan 02, 2020 at 11:42:16AM +0100, Michał Mirosław wrote:
> sdhci_alloc_host() does its work not using managed infrastructure, so
> needs explicit free on error path. Add it where needed.
> 
> Cc: <stable@...r.kernel.org>
> Fixes: bb5f8ea4d514 ("mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC")
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>

Acked-by: Ludovic Desroches <ludovic.desroches@...rochip.com>

Thanks

> ---
>  drivers/mmc/host/sdhci-of-at91.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index b2a8c45c9c23..ab2bd314a390 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -345,20 +345,23 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>                         priv->mainck = NULL;
>                 } else {
>                         dev_err(&pdev->dev, "failed to get baseclk\n");
> -                       return PTR_ERR(priv->mainck);
> +                       ret = PTR_ERR(priv->mainck);
> +                       goto sdhci_pltfm_free;
>                 }
>         }
> 
>         priv->hclock = devm_clk_get(&pdev->dev, "hclock");
>         if (IS_ERR(priv->hclock)) {
>                 dev_err(&pdev->dev, "failed to get hclock\n");
> -               return PTR_ERR(priv->hclock);
> +               ret = PTR_ERR(priv->hclock);
> +               goto sdhci_pltfm_free;
>         }
> 
>         priv->gck = devm_clk_get(&pdev->dev, "multclk");
>         if (IS_ERR(priv->gck)) {
>                 dev_err(&pdev->dev, "failed to get multclk\n");
> -               return PTR_ERR(priv->gck);
> +               ret = PTR_ERR(priv->gck);
> +               goto sdhci_pltfm_free;
>         }
> 
>         ret = sdhci_at91_set_clks_presets(&pdev->dev);
> --
> 2.20.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ