[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4CDACD74.7090502@canonical.com>
Date: Wed, 10 Nov 2010 08:51:00 -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 alloc_namespace()
On 11/09/2010 07:31 PM, wzt.wzt@...il.com wrote:
> policy->name is a substring of policy->hname, if prefix is not NULL, it will
> allocted strlen(prefix) + strlen(name) + 3 bytes to policy->hname in policy_init().
> use kzfree(ns->base.name) will casue memory leak if alloc_namespace() failed.
>
> Signed-off-by: Zhitong Wang <zhitong.wangzt@...baba-inc.com>
yes, thank you.
Signed-off-by: John Johansen <john.johansen@...onical.com>
>
> ---
> security/apparmor/policy.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
> index 52cc865..4f0eade 100644
> --- a/security/apparmor/policy.c
> +++ b/security/apparmor/policy.c
> @@ -306,7 +306,7 @@ static struct aa_namespace *alloc_namespace(const char *prefix,
> return ns;
>
> fail_unconfined:
> - kzfree(ns->base.name);
> + kzfree(ns->base.hname);
> fail_ns:
> kzfree(ns);
> return NULL;
--
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