* [PATCH] KEYS: Use kfree_sensitive() in keyctl_pkey_e_d_s()
@ 2026-11-24 5:28 Guicai Ma
2026-11-24 5:34 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Guicai Ma @ 2026-11-24 5:28 UTC (permalink / raw)
To: Jarkko Sakkinen, David Howells
Cc: keyrings, linux-security-module, linux-kernel, Paul Moore,
James Morris, Serge E . Hallyn, Guicai Ma
keyctl_pkey_e_d_s() frees the temporary 'in' and 'out' buffers with
kfree(). For encrypt, decrypt and sign operations these buffers hold
plaintext or other sensitive data.
Free them with kfree_sensitive() instead.
Closes: https://sashiko.dev/#/bug/linux-4199b169-0b8d-4055-9a71-6b5b79e38eb3
Fixes: 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2]")
Cc: stable@vger.kernel.org
Signed-off-by: Guicai Ma <maguicai@kylinos.cn>
---
security/keys/keyctl_pkey.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/keys/keyctl_pkey.c b/security/keys/keyctl_pkey.c
index e7121523b9c9..8d2c2b65f50b 100644
--- a/security/keys/keyctl_pkey.c
+++ b/security/keys/keyctl_pkey.c
@@ -314,9 +314,9 @@ long keyctl_pkey_e_d_s(int op,
ret = -EFAULT;
error_out:
- kfree(out);
+ kfree_sensitive(out);
error_in:
- kfree(in);
+ kfree_sensitive(in);
error_params:
keyctl_pkey_params_free(¶ms);
return ret;
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 5:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 5:28 [PATCH] KEYS: Use kfree_sensitive() in keyctl_pkey_e_d_s() Guicai Ma
2026-11-24 5:34 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox