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] [day] [month] [year] [list]
Date:   Fri, 27 Jan 2023 19:05:47 +0000
From:   Mark Brown <broonie@...ian.org>
To:     Rob Herring <robh+dt@...nel.org>
Cc:     Frank Rowand <frowand.list@...il.com>, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Luca Di Stefano <luca.distefano@...aro.org>,
        993612@...s.debian.org, stable@...nel.org
Subject: Re: [PATCH] of/address: Return an error when no valid dma-ranges are
 found

On Fri, Jan 27, 2023 at 12:37:35PM -0600, Rob Herring wrote:

> Looks to me like we are leaking 'r' with this change.

Oh, probably now that you mention it.  Usually the OF code keeps
track of more things than I expect...

> Wouldn't this change work:

> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index c34ac33b7338..f43311f01c32 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -968,6 +968,11 @@ int of_dma_get_range(struct device_node *np,
> const struct bus_dma_region **map)
>         for_each_of_range(&parser, &range)
>                 num_ranges++;
> 
> +       if (!num_ranges) {
> +               ret = -EINVAL;
> +               goto out;
> +       }
> +

Not as-is, there is a range counted by that first loop but it's
then rejected by the check in the second loop for cpu_addr ==
OF_BAD_ADDR.  We'd need to add a similar check in the first loop.
It should work otherwise though and avoids doing the allocation
in this case.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ