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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 4 Feb 2016 12:11:37 +0100
From:	Ulf Hansson <ulf.hansson@...aro.org>
To:	Robert Jarzmik <robert.jarzmik@...e.fr>
Cc:	linux-mmc <linux-mmc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc: pxamci: fix the device-tree probe deferral path

On 3 February 2016 at 23:19, Robert Jarzmik <robert.jarzmik@...e.fr> wrote:
> When the gpio driver is probed after the mmc one, the read/write gpio
> and card detection one return -EPROBE_DEFER. Unfortunately, the memory
> region remains requested, and upon the next probe, the probe will fail
> anyway with -EBUSY.
>
> Fix this by releasing the memory resource upon probe failure.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@...e.fr>
> ---
>  drivers/mmc/host/pxamci.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
> index 28a057fae0a1..405ec339a1b8 100644
> --- a/drivers/mmc/host/pxamci.c
> +++ b/drivers/mmc/host/pxamci.c
> @@ -657,7 +657,7 @@ static int pxamci_probe(struct platform_device *pdev)
>         if (!r || irq < 0)
>                 return -ENXIO;
>
> -       r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
> +       r = devm_request_mem_region(&pdev->dev, r->start, SZ_4K, DRIVER_NAME);

I suggest you replace also the ioremap call, thus using
devm_ioremap_resource() is convenient.

>         if (!r)
>                 return -EBUSY;
>
> @@ -840,7 +840,6 @@ out:
>         }
>         if (mmc)
>                 mmc_free_host(mmc);
> -       release_resource(r);

This looks wrong.

>         return ret;
>  }
>
> --
> 2.1.4
>

Perhaps it's just easier to convert the probe function to use all
devm_* functions, as for example irqs isn't freed either.

In that way, you will solve all problems of also leaking memory in one go.

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ