Skip to content

Commit 844cf82

Browse files
holger-denglerAlexander Gordeev
authored andcommitted
s390/pkey: zeroize key blobs
Key blobs for the IOCTLs PKEY_KBLOB2PROTK[23] may contain clear key material. Zeroize the copies of these keys in kernel memory after creating the protected key. Reviewed-by: Harald Freudenberger <[email protected]> Signed-off-by: Holger Dengler <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 8703dd6 commit 844cf82

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/s390/crypto/pkey_api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
12931293
return PTR_ERR(kkey);
12941294
rc = pkey_keyblob2pkey(kkey, ktp.keylen, &ktp.protkey);
12951295
DEBUG_DBG("%s pkey_keyblob2pkey()=%d\n", __func__, rc);
1296+
memzero_explicit(kkey, ktp.keylen);
12961297
kfree(kkey);
12971298
if (rc)
12981299
break;
@@ -1426,6 +1427,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
14261427
kkey, ktp.keylen, &ktp.protkey);
14271428
DEBUG_DBG("%s pkey_keyblob2pkey2()=%d\n", __func__, rc);
14281429
kfree(apqns);
1430+
memzero_explicit(kkey, ktp.keylen);
14291431
kfree(kkey);
14301432
if (rc)
14311433
break;
@@ -1552,6 +1554,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
15521554
protkey, &protkeylen);
15531555
DEBUG_DBG("%s pkey_keyblob2pkey3()=%d\n", __func__, rc);
15541556
kfree(apqns);
1557+
memzero_explicit(kkey, ktp.keylen);
15551558
kfree(kkey);
15561559
if (rc) {
15571560
kfree(protkey);

0 commit comments

Comments
 (0)