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:   Wed, 11 May 2022 06:19:50 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Miaoqian Lin <linmq006@...il.com>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Damien Riegel <damien.riegel@...oirfairelinux.com>,
        Rob Herring <robh@...nel.org>, linux-watchdog@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: ts4800_wdt: Fix refcount leak in
 ts4800_wdt_probe

On 5/11/22 04:42, Miaoqian Lin wrote:
> of_parse_phandle() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add  missing of_node_put() in some error paths.
> 
> Fixes: bf9006399939 ("watchdog: ts4800: add driver for TS-4800 watchdog")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>

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

> ---
>   drivers/watchdog/ts4800_wdt.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c
> index c137ad2bd5c3..0ea554c7cda5 100644
> --- a/drivers/watchdog/ts4800_wdt.c
> +++ b/drivers/watchdog/ts4800_wdt.c
> @@ -125,13 +125,16 @@ static int ts4800_wdt_probe(struct platform_device *pdev)
>   	ret = of_property_read_u32_index(np, "syscon", 1, &reg);
>   	if (ret < 0) {
>   		dev_err(dev, "no offset in syscon\n");
> +		of_node_put(syscon_np);
>   		return ret;
>   	}
>   
>   	/* allocate memory for watchdog struct */
>   	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
> -	if (!wdt)
> +	if (!wdt) {
> +		of_node_put(syscon_np);
>   		return -ENOMEM;
> +	}
>   
>   	/* set regmap and offset to know where to write */
>   	wdt->feed_offset = reg;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ