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]
Message-ID: <aThK3DwGFY1xhvyN@lizhi-Precision-Tower-5810>
Date: Tue, 9 Dec 2025 11:14:20 -0500
From: Frank Li <Frank.li@....com>
To: Wentao Liang <vulab@...as.ac.cn>
Cc: ulf.hansson@...aro.org, shawnguo@...nel.org, s.hauer@...gutronix.de,
	kernel@...gutronix.de, festevam@...il.com, linux-pm@...r.kernel.org,
	imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH v2] pmdomain: imx: Fix reference count leak in
 imx_gpc_probe()

On Tue, Dec 09, 2025 at 08:19:09AM +0000, Wentao Liang wrote:
> of_get_child_by_name() returns a node pointer with refcount incremented,
> we should use the __free() attribute to manage the pgc_node reference.
> This ensures automatic of_node_put() cleanup when pgc_node goes out of
> scope, eliminating the need for explicit error handling paths and
> avoiding reference count leaks.
>
> Fixes: 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")
> Cc: stable@...r.kernel.org
> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
>
> ---
> Change in V2:
> - Use __free() attribute instead of explicit of_node_put() calls
> ---
>  drivers/pmdomain/imx/gpc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
> index f18c7e6e75dd..89d5d68c055d 100644
> --- a/drivers/pmdomain/imx/gpc.c
> +++ b/drivers/pmdomain/imx/gpc.c
> @@ -403,7 +403,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,
>  static int imx_gpc_probe(struct platform_device *pdev)
>  {
>  	const struct imx_gpc_dt_data *of_id_data = device_get_match_data(&pdev->dev);
> -	struct device_node *pgc_node;
> +	struct device_node *pgc_node __free(pgc_node);

struct device_node *pgc_node __free(pgc_node)
	= of_get_child_by_name(pdev->dev.of_node, "pgc");

Make sure pgc_node value assigned when use cleanup. Please see cleanup.h

Frank
>  	struct regmap *regmap;
>  	void __iomem *base;
>  	int ret;
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ