From: John Johansen <john.johansen@canonical.com>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org, apparmor@lists.ubuntu.com,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH] APPARMOR: Fix memory leak of alloc_namespace()
Date: Wed, 10 Nov 2010 08:51:00 -0800 [thread overview]
Message-ID: <4CDACD74.7090502@canonical.com> (raw)
In-Reply-To: <20101110033155.GA2873@localhost.localdomain>
On 11/09/2010 07:31 PM, wzt.wzt@gmail.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@alibaba-inc.com>
yes, thank you.
Signed-off-by: John Johansen <john.johansen@canonical.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;
prev parent reply other threads:[~2010-11-10 16:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 3:31 [PATCH] APPARMOR: Fix memory leak of alloc_namespace() wzt.wzt
2010-11-10 16:51 ` John Johansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CDACD74.7090502@canonical.com \
--to=john.johansen@canonical.com \
--cc=apparmor@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=wzt.wzt@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.