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:   Sun, 20 Sep 2020 18:21:03 +0200
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Pavel Machek <pavel@....cz>
Cc:     linux-kernel@...r.kernel.org, linux-watchdog@...r.kernel.org,
        linux@...ck-us.net, wim@...ux-watchdog.org
Subject: Re: [PATCH] watchdog: fix memory leak in error path

Pavel Machek <pavel@....cz> a écrit :

> Fix memory leak in error path.
>
> Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>
>
> diff --git a/drivers/watchdog/watchdog_dev.c  
> b/drivers/watchdog/watchdog_dev.c
> index 6798addabd5a..785270ee337c 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -994,8 +994,10 @@ static int watchdog_cdev_register(struct  
> watchdog_device *wdd)
>  	wd_data->wdd = wdd;
>  	wdd->wd_data = wd_data;
>
> -	if (IS_ERR_OR_NULL(watchdog_kworker))

Maybe it would be better to move this check before the kzalloc as the  
wd_data is not needed for doing that check.

Christophe

> +	if (IS_ERR_OR_NULL(watchdog_kworker)) {
> +		kfree(wd_data);
>  		return -ENODEV;
> +	}
>
>  	device_initialize(&wd_data->dev);
>  	wd_data->dev.devt = MKDEV(MAJOR(watchdog_devt), wdd->id);
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures)  
> http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Powered by blists - more mailing lists