From: "Serge E. Hallyn" <serge@hallyn.com>
To: Colin King <colin.king@canonical.com>
Cc: Paul Moore <paul@paul-moore.com>,
Stephen Smalley <sds@tycho.nsa.gov>,
Eric Paris <eparis@parisplace.org>,
James Morris <james.l.morris@oracle.com>,
"Serge E . Hallyn" <serge@hallyn.com>,
Nick Kralevich <nnk@google.com>,
Jeff Vander Stoep <jeffv@google.com>,
selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selinux: fix memory leak on node_ptr on error return path
Date: Tue, 22 Mar 2016 15:28:17 -0500 [thread overview]
Message-ID: <20160322202817.GA9459@mail.hallyn.com> (raw)
In-Reply-To: <1458601213-5835-1-git-send-email-colin.king@canonical.com>
Quoting Colin King (colin.king@canonical.com):
> From: Colin Ian King <colin.king@canonical.com>
>
> node_ptr is not being free'd if the list allocation fails, fix
> this by kfree'ing it before exiting on the error path.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Hi,
I'm not very familiar with this code any more, but are you sure
this is needed and doesn't cause a new bug? It *looks* like
the avtab_insert_nonunique() actually inserts the node_ptr
into the policydb, and the policydb is the one that should
eventually free it.
> ---
> security/selinux/ss/conditional.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
> index 456e1a9..5d010ef 100644
> --- a/security/selinux/ss/conditional.c
> +++ b/security/selinux/ss/conditional.c
> @@ -332,6 +332,7 @@ static int cond_insertf(struct avtab *a, struct avtab_key *k, struct avtab_datum
> list = kzalloc(sizeof(struct cond_av_list), GFP_KERNEL);
> if (!list) {
> rc = -ENOMEM;
> + kfree(node_ptr);
> goto err;
> }
>
> --
> 2.7.3
next prev parent reply other threads:[~2016-03-22 20:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 23:00 [PATCH] selinux: fix memory leak on node_ptr on error return path Colin King
2016-03-22 20:28 ` Serge E. Hallyn [this message]
2016-03-22 21:35 ` Paul Moore
2016-03-22 21:38 ` Colin Ian King
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=20160322202817.GA9459@mail.hallyn.com \
--to=serge@hallyn.com \
--cc=colin.king@canonical.com \
--cc=eparis@parisplace.org \
--cc=james.l.morris@oracle.com \
--cc=jeffv@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=nnk@google.com \
--cc=paul@paul-moore.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox