]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tipc: use kfree_sensitive() for aead cleanup
authorZilin Guan <zilin@seu.edu.cn>
Fri, 23 May 2025 11:47:17 +0000 (11:47 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 28 May 2025 00:31:42 +0000 (17:31 -0700)
The tipc_aead_free() function currently uses kfree() to release the aead
structure. However, this structure contains sensitive information, such
as key's SALT value, which should be securely erased from memory to
prevent potential leakage.

To enhance security, replace kfree() with kfree_sensitive() when freeing
the aead structure. This change ensures that sensitive data is explicitly
cleared before memory deallocation, aligning with the approach used in
tipc_aead_init() and adhering to best practices for handling confidential
information.

Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Link: https://patch.msgid.link/20250523114717.4021518-1-zilin@seu.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/tipc/crypto.c

index 8584893b478510dc1ddda321ed06054de327609b..f4cfe88670f55418a43a7eb0d11a851e335faa8d 100644 (file)
@@ -425,7 +425,7 @@ static void tipc_aead_free(struct rcu_head *rp)
        }
        free_percpu(aead->tfm_entry);
        kfree_sensitive(aead->key);
-       kfree(aead);
+       kfree_sensitive(aead);
 }
 
 static int tipc_aead_users(struct tipc_aead __rcu *aead)