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: <20180228113042.6a2f5177.cohuck@redhat.com>
Date:   Wed, 28 Feb 2018 11:30:42 +0100
From:   Cornelia Huck <cohuck@...hat.com>
To:     Arvind Yadav <arvind.yadav.cs@...il.com>
Cc:     jwi@...ux.vnet.ibm.com, ubraun@...ux.vnet.ibm.com,
        davem@...emloft.net, linux-kernel@...r.kernel.org,
        linux-s390@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: iucv: Free memory obtained by kzalloc

On Wed, 28 Feb 2018 15:24:16 +0530
Arvind Yadav <arvind.yadav.cs@...il.com> wrote:

> Free memory, if afiucv_iucv_init is not successful and
> removing a IUCV driver.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
> ---
>  net/iucv/af_iucv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
> index 1e8cc7b..eb0995a 100644
> --- a/net/iucv/af_iucv.c
> +++ b/net/iucv/af_iucv.c
> @@ -2433,9 +2433,11 @@ static int afiucv_iucv_init(void)
>  	af_iucv_dev->driver = &af_iucv_driver;
>  	err = device_register(af_iucv_dev);
>  	if (err)
> -		goto out_driver;
> +		goto out_iucv_dev;
>  	return 0;
>  
> +out_iucv_dev:
> +	kfree(af_iucv_dev);
>  out_driver:
>  	driver_unregister(&af_iucv_driver);
>  out_iucv:
> @@ -2496,6 +2498,7 @@ static void __exit afiucv_exit(void)
>  {
>  	if (pr_iucv) {
>  		device_unregister(af_iucv_dev);
> +		kfree(af_iucv_dev);
>  		driver_unregister(&af_iucv_driver);
>  		pr_iucv->iucv_unregister(&af_iucv_handler, 0);
>  		symbol_put(iucv_if);

No, you must not use kfree() after you called device_register() (even
if it was not successful!) -- see the comment for device_register().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ