Skip to content

Commit 74d9391

Browse files
hodgesdskuba-moo
authored andcommitted
tipc: use kfree_sensitive() for session key material
The rx->skey field contains a struct tipc_aead_key with GCM-AES encryption keys used for TIPC cluster communication. Using plain kfree() leaves this sensitive key material in freed memory pages where it could potentially be recovered. Switch to kfree_sensitive() to ensure the key material is zeroed before the memory is freed. Fixes: 1ef6f7c ("tipc: add automatic session key exchange") Signed-off-by: Daniel Hodges <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent dbbec8c commit 74d9391

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

net/tipc/crypto.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ void tipc_crypto_key_flush(struct tipc_crypto *c)
12191219
rx = c;
12201220
tx = tipc_net(rx->net)->crypto_tx;
12211221
if (cancel_delayed_work(&rx->work)) {
1222-
kfree(rx->skey);
1222+
kfree_sensitive(rx->skey);
12231223
rx->skey = NULL;
12241224
atomic_xchg(&rx->key_distr, 0);
12251225
tipc_node_put(rx->node);
@@ -2394,7 +2394,7 @@ static void tipc_crypto_work_rx(struct work_struct *work)
23942394
break;
23952395
default:
23962396
synchronize_rcu();
2397-
kfree(rx->skey);
2397+
kfree_sensitive(rx->skey);
23982398
rx->skey = NULL;
23992399
break;
24002400
}

0 commit comments

Comments
 (0)