KEYS: Use kfree_sensitive() in keyctl_pkey_e_d_s()
Subsystems (2)
PATCH 1/1 KEYS: Use kfree_sensitive() in keyctl_pkey_e_d_s()
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.
--- security/keys/keyctl_pkey.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/keys/keyctl_pkey.c +2 -2
@@ -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;
Signature · 1 line
2.47.3
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 10 lines
keyctl_pkey_e_d_s()frees the temporary 'in' and 'out' buffers withkfree(). For encrypt, decrypt and sign operations these buffers hold plaintext or other sensitive data.Free them with
kfree_sensitive()instead.Fixes 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2]")Signed-off-by Guicai Ma <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 32 lines · Guicai Ma
keyctl_pkey_e_d_s()frees the temporary 'in' and 'out' buffers withkfree(). For encrypt, decrypt and sign operations these buffers hold plaintext or other sensitive data.Free them with
kfree_sensitive()instead.Fixes 00d60fd3b932 ("KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2]")Signed-off-by Guicai Ma <[email protected]>--- security/keys/keyctl_pkey.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)security/keys/keyctl_pkey.c +2
-2@@ -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;Signature · 1 line
2.47.3
Thanks applied.
Br, Jarkko