* [PATCH] tipc: fixed possible memory leak issue
@ 2021-12-03 17:48 Ameer Hamza
2021-12-04 11:20 ` Ameer Hamza
0 siblings, 1 reply; 2+ messages in thread
From: Ameer Hamza @ 2021-12-03 17:48 UTC (permalink / raw)
To: jmaloy, ying.xue, davem, kuba; +Cc: tipc-discussion, linux-kernel, amhamza.mgc
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tipc: fixed possible memory leak issue
2021-12-03 17:48 [PATCH] tipc: fixed possible memory leak issue Ameer Hamza
@ 2021-12-04 11:20 ` Ameer Hamza
0 siblings, 0 replies; 2+ messages in thread
From: Ameer Hamza @ 2021-12-04 11:20 UTC (permalink / raw)
To: jmaloy, ying.xue, davem, kuba; +Cc: tipc-discussion, linux-kernel
On Fri, Dec 03, 2021 at 10:48:48PM +0500, Ameer Hamza wrote:
> 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
>
I reviewed this change again and coverity is generating a false
positive here. tipc_aead_free() is already releasing the allocated
memory for tmp. Please ignore this patch and sorry for the
inconvinience.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-04 11:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 17:48 [PATCH] tipc: fixed possible memory leak issue Ameer Hamza
2021-12-04 11:20 ` Ameer Hamza
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).