mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ameer Hamza <amhamza.mgc@gmail.com>
To: jmaloy@redhat.com, ying.xue@windriver.com, davem@davemloft.net,
	kuba@kernel.org
Cc: tipc-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, amhamza.mgc@gmail.com
Subject: [PATCH] tipc: fixed possible memory leak issue
Date: Fri,  3 Dec 2021 22:48:48 +0500	[thread overview]
Message-ID: <20211203174848.43879-1-amhamza.mgc@gmail.com> (raw)

Fixed coverity warning by freeing the memory before return

Addresses-Coverity: 1494433 ("Resource leak")

Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
---
 net/tipc/crypto.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index b4d9419a015b..10e6d0e9ddbc 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -599,6 +599,7 @@ static int tipc_aead_init(struct tipc_aead **aead, struct tipc_aead_key *ukey,
 	tmp->key = kmemdup(ukey, tipc_aead_key_size(ukey), GFP_KERNEL);
 	if (!tmp->key) {
 		tipc_aead_free(&tmp->rcu);
+		kfree_sensitive(tmp);
 		return -ENOMEM;
 	}
 	memcpy(&tmp->salt, ukey->key + keylen, TIPC_AES_GCM_SALT_SIZE);
-- 
2.25.1


             reply	other threads:[~2021-12-03 17:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 17:48 Ameer Hamza [this message]
2021-12-04 11:20 ` Ameer Hamza

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=20211203174848.43879-1-amhamza.mgc@gmail.com \
    --to=amhamza.mgc@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jmaloy@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=ying.xue@windriver.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®