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:   Mon, 20 Dec 2021 07:41:30 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Jiasheng Jiang <jiasheng@...as.ac.cn>, wim@...ux-watchdog.org
Cc:     linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] watchdog: ie6xx_wdt: Check for null res pointer

On 12/19/21 10:21 PM, Jiasheng Jiang wrote:
> The return value of platform_get_resource() needs to be checked.
> To avoid use of error pointer in case that there is no suitable resource.
> 

How would that resource disappear since the probe function ?

That driver could use a lot of cleanup (use devm_request_region(),
use watchdog_stop_on_unregister(), stop using a static data structure,
use devm_add_action_or_reset to trigger the call to debugfs_remove,
use devm_watchdog_register_device and drop the remove function),
but this change addresses a non-existing problem.

Guenter

> Fixes: 101ce87b3bdd ("watchdog: Add watchdog driver for Intel Atom E6XX")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> ---
> Changelog:
> 
> v1 -> v2
> 
> *Change 1. Correct the commit message.
> ---
>   drivers/watchdog/ie6xx_wdt.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c
> index 8f28993fab8b..ee5b68d2e271 100644
> --- a/drivers/watchdog/ie6xx_wdt.c
> +++ b/drivers/watchdog/ie6xx_wdt.c
> @@ -271,6 +271,9 @@ static int ie6xx_wdt_remove(struct platform_device *pdev)
>   	struct resource *res;
>   
>   	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> +	if (!res)
> +		return -EINVAL;
> +
>   	ie6xx_wdt_stop(NULL);
>   	watchdog_unregister_device(&ie6xx_wdt_dev);
>   	ie6xx_wdt_debugfs_exit();
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ