From: Colin King <colin.king@canonical.com>
To: 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
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] selinux: fix memory leak on node_ptr on error return path
Date: Mon, 21 Mar 2016 23:00:13 +0000 [thread overview]
Message-ID: <1458601213-5835-1-git-send-email-colin.king@canonical.com> (raw)
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>
---
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 reply other threads:[~2016-03-21 23:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 23:00 Colin King [this message]
2016-03-22 20:28 ` Serge E. Hallyn
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=1458601213-5835-1-git-send-email-colin.king@canonical.com \
--to=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 \
--cc=serge@hallyn.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®