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, 10 Nov 2010 08:56:02 -0800
From:	John Johansen <john.johansen@...onical.com>
To:	wzt.wzt@...il.com
CC:	linux-kernel@...r.kernel.org, apparmor@...ts.ubuntu.com,
	linux-security-module@...r.kernel.org
Subject: Re: [PATCH] APPARMOR: Fix memory leak of apparmor_init()

On 11/10/2010 12:05 AM, wzt.wzt@...il.com wrote:
> set_init_cxt() allocted sizeof(struct aa_task_cxt) bytes for cxt, 
> if register_security() failed, it will cause memory leak.
> 
> Signed-off-by: Zhitong Wang <zhitong.wangzt@...baba-inc.com>
> 
yep, thanks again Zhitong

Signed-off-by: John Johansen <john.johansen@...onical.com>

> ---
>  security/apparmor/lsm.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
> index cf1de44..b7106f1 100644
> --- a/security/apparmor/lsm.c
> +++ b/security/apparmor/lsm.c
> @@ -922,7 +922,7 @@ static int __init apparmor_init(void)
>  	error = register_security(&apparmor_ops);
>  	if (error) {
>  		AA_ERROR("Unable to register AppArmor\n");
> -		goto register_security_out;
> +		goto set_init_cxt_out;
>  	}
>  
>  	/* Report that AppArmor successfully initialized */
> @@ -936,6 +936,9 @@ static int __init apparmor_init(void)
>  
>  	return error;
>  
> +set_init_cxt_out:
> +	aa_free_task_context(current->real_cred->security);
> +
>  register_security_out:
>  	aa_free_root_ns();
>  
> @@ -944,7 +947,6 @@ alloc_out:
>  
>  	apparmor_enabled = 0;
>  	return error;
> -
>  }
>  
>  security_initcall(apparmor_init);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ