From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Johannes Berg <johannes.berg@intel.com>,
Taehee Yoo <ap420073@gmail.com>, Andreas Steinmetz <ast@domdv.de>,
Navid Emamdoost <navid.emamdoost@gmail.com>,
Michal Kubecek <mkubecek@suse.cz>,
Florian Westphal <fw@strlen.de>,
Thomas Gleixner <tglx@linutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: emamd001@umn.edu
Subject: [PATCH] macsec: Fix memory leaks in macsec_decrypt()
Date: Fri, 22 Nov 2019 16:02:36 -0600 [thread overview]
Message-ID: <20191122220242.29359-1-navid.emamdoost@gmail.com> (raw)
In the implementation of macsec_decrypt(), there are two memory leaks
when crypto_aead_decrypt() fails. Release allocated req and skb before
return.
Fixes: c3b7d0bd7ac2 ("macsec: fix rx_sa refcounting with decrypt callback")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/net/macsec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index afd8b2a08245..34c6fb4eb9ef 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -986,6 +986,8 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb,
dev_hold(dev);
ret = crypto_aead_decrypt(req);
if (ret == -EINPROGRESS) {
+ aead_request_free(req);
+ kfree_skb(skb);
return ERR_PTR(ret);
} else if (ret != 0) {
/* decryption/authentication failed
--
2.17.1
next reply other threads:[~2019-11-22 22:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-22 22:02 Navid Emamdoost [this message]
2019-11-22 22:26 ` [PATCH] macsec: Fix memory leaks in macsec_decrypt() Florian Westphal
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=20191122220242.29359-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=ap420073@gmail.com \
--cc=ast@domdv.de \
--cc=davem@davemloft.net \
--cc=emamd001@umn.edu \
--cc=fw@strlen.de \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
/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).