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>] [day] [month] [year] [list]
Date:   Tue, 9 Nov 2021 11:43:08 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Rob Herring <robh@...nel.org>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Sudeep Holla <sudeep.holla@....com>,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org, Frank Rowand <frowand.list@...il.com>
Subject: Re: [PATCH 1/2] of: Support using 'mask' in making device bus id

On Tue, Nov 09, 2021 at 10:46:49AM -0600, Rob Herring wrote:
> Commit 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes
> 'reg' and node names") added a 'reg' property to nodes. This change has
> the side effect of changing how the kernel generates the device name.
> The assumption was a translatable 'reg' address is unique. However, in
> the case of the register-bit-led binding (and a few others) that is not
> the case. The 'mask' property must also be used in this case to make a
> unique device name.
> 
> Fixes: 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names")
> Reported-by: Guenter Roeck <linux@...ck-us.net>
> Cc: stable@...r.kernel.org
> Cc: Frank Rowand <frowand.list@...il.com>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Signed-off-by: Rob Herring <robh@...nel.org>

Tested-by: Guenter Roeck <linux@...ck-us.net>

> ---
> This should be applied to stable to minimize DT ABI breakage.
> ---
>  drivers/of/platform.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 07813fb1ef37..b3faf89744aa 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -76,6 +76,7 @@ static void of_device_make_bus_id(struct device *dev)
>  	struct device_node *node = dev->of_node;
>  	const __be32 *reg;
>  	u64 addr;
> +	u32 mask;
>  
>  	/* Construct the name, using parent nodes if necessary to ensure uniqueness */
>  	while (node->parent) {
> @@ -85,8 +86,13 @@ static void of_device_make_bus_id(struct device *dev)
>  		 */
>  		reg = of_get_property(node, "reg", NULL);
>  		if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) {
> -			dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn",
> -				     addr, node, dev_name(dev));
> +			if (!of_property_read_u32(node, "mask", &mask))
> +				dev_set_name(dev, dev_name(dev) ? "%llx.%x.%pOFn:%s" : "%llx.%x.%pOFn",
> +					     addr, ffs(mask) - 1, node, dev_name(dev));
> +
> +			else
> +				dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn",
> +					     addr, node, dev_name(dev));
>  			return;
>  		}
>  
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ