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]
Message-ID: <ZC7tmjwilC5mDzx+@yilunxu-OptiPlex-7050>
Date:   Fri, 7 Apr 2023 00:04:42 +0800
From:   Xu Yilun <yilun.xu@...el.com>
To:     alexis.lothore@...tlin.com
Cc:     mdf@...nel.org, hao.wu@...el.com, trix@...hat.com,
        russell.h.weight@...el.com, linux-fpga@...r.kernel.org,
        linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
        nicolas.carrier@...lia.com
Subject: Re: [PATCH] fpga: bridge: properly initialize bridge device before
 populating children

On 2023-04-04 at 15:31:02 +0200, alexis.lothore@...tlin.com wrote:
> From: Alexis Lothoré <alexis.lothore@...tlin.com>
> 
> The current code path can lead to warnings because of uninitialized device,
> which contains, as a consequence, uninitialized kobject. The uninitialized
> device is passed to of_platform_populate, which will at some point, while
> creating child device, try to get a reference on uninitialized parent,
> resulting in the following warning:
> 
> kobject: '(null)' ((ptrval)): is not initialized, yet kobject_get() is
> being called.
> 
> The warning is observed after migrating a kernel 5.10.x to 6.1.x.
> Reverting commit 0d70af3c2530 ("fpga: bridge: Use standard dev_release for
> class driver") seems to remove the warning.
> This commit aggregates device_initialize() and device_add() into
> device_register() but this new call is done AFTER of_platform_populate
> 
> Fixes: 0d70af3c2530 ("fpga: bridge: Use standard dev_release for class driver")
> Signed-off-by: Alexis Lothoré <alexis.lothore@...tlin.com>
> ---
>  drivers/fpga/fpga-bridge.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> index 727704431f61..13918c8c839e 100644
> --- a/drivers/fpga/fpga-bridge.c
> +++ b/drivers/fpga/fpga-bridge.c
> @@ -360,7 +360,6 @@ fpga_bridge_register(struct device *parent, const char *name,
>  	bridge->dev.parent = parent;
>  	bridge->dev.of_node = parent->of_node;
>  	bridge->dev.id = id;
> -	of_platform_populate(bridge->dev.of_node, NULL, NULL, &bridge->dev);
>  
>  	ret = dev_set_name(&bridge->dev, "br%d", id);
>  	if (ret)
> @@ -372,6 +371,8 @@ fpga_bridge_register(struct device *parent, const char *name,
>  		return ERR_PTR(ret);
>  	}
>  
> +	of_platform_populate(bridge->dev.of_node, NULL, NULL, &bridge->dev);

It makes sense.

Acked-by: Xu Yilun <yilun.xu@...el.com>

Applied

> +
>  	return bridge;
>  
>  error_device:
> -- 
> 2.40.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ