From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu,
Navid Emamdoost <navid.emamdoost@gmail.com>,
Paul Moore <paul@paul-moore.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] genetlink: prevent memory leak in netlbl_unlabel_defconf
Date: Wed, 25 Sep 2019 17:10:08 -0500 [thread overview]
Message-ID: <20190925221009.15523-1-navid.emamdoost@gmail.com> (raw)
In netlbl_unlabel_defconf if netlbl_domhsh_add_default fails the
allocated entry should be released.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
net/netlabel/netlabel_unlabeled.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index d2e4ab8d1cb1..c63ec480ee4e 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1541,8 +1541,10 @@ int __init netlbl_unlabel_defconf(void)
entry->family = AF_UNSPEC;
entry->def.type = NETLBL_NLTYPE_UNLABELED;
ret_val = netlbl_domhsh_add_default(entry, &audit_info);
- if (ret_val != 0)
+ if (ret_val != 0) {
+ kfree(entry);
return ret_val;
+ }
netlbl_unlabel_acceptflg_set(1, &audit_info);
--
2.17.1
next reply other threads:[~2019-09-25 22:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 22:10 Navid Emamdoost [this message]
2019-09-25 23:27 ` [PATCH] genetlink: prevent memory leak in netlbl_unlabel_defconf Paul Moore
2019-09-27 13:15 ` Markus Elfring
2019-09-27 14:48 ` Paul Moore
2019-09-27 16:14 ` David Miller
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=20190925221009.15523-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=davem@davemloft.net \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=smccaman@umn.edu \
/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;
as well as URLs for NNTP newsgroup(s).