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:   Fri, 11 Mar 2022 18:01:11 -0800 (PST)
From:   Stefano Stabellini <sstabellini@...nel.org>
To:     Miaoqian Lin <linmq006@...il.com>
cc:     Stefano Stabellini <sstabellini@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Catalin Marinas <catalin.marinas@....com>,
        Shannon Zhao <shannon.zhao@...aro.org>,
        Julien Grall <julien.grall@....com>,
        xen-devel@...ts.xenproject.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm/xen: Fix refcount leak in xen_dt_guest_init

On Wed, 9 Mar 2022, Miaoqian Lin wrote:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 9b08aaa3199a ("ARM: XEN: Move xen_early_init() before efi_init()")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>

Thanks for the patch!


> ---
>  arch/arm/xen/enlighten.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
> index ec5b082f3de6..262f45f686b6 100644
> --- a/arch/arm/xen/enlighten.c
> +++ b/arch/arm/xen/enlighten.c
> @@ -424,6 +424,7 @@ static void __init xen_dt_guest_init(void)
>  
>  	if (of_address_to_resource(xen_node, GRANT_TABLE_INDEX, &res)) {
>  		pr_err("Xen grant table region is not found\n");
> +		of_node_put(xen_node);
>  		return;
>  	}

This is adding a call to of_node_put on the error path. Shouldn't it
be called also in the non-error path?

Also, there is another instance of of_address_to_resource being called
in this file (in arch_xen_unpopulated_init), does it make sense to call
of_node_put there too?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ