mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
s390/pkey: zeroize key blobs
[ Upstream commit 844cf829e5 ]
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 <freude@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9f2f538cd8
commit
26cfe2faa8
@@ -1293,6 +1293,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
|
|||||||
return PTR_ERR(kkey);
|
return PTR_ERR(kkey);
|
||||||
rc = pkey_keyblob2pkey(kkey, ktp.keylen, &ktp.protkey);
|
rc = pkey_keyblob2pkey(kkey, ktp.keylen, &ktp.protkey);
|
||||||
DEBUG_DBG("%s pkey_keyblob2pkey()=%d\n", __func__, rc);
|
DEBUG_DBG("%s pkey_keyblob2pkey()=%d\n", __func__, rc);
|
||||||
|
memzero_explicit(kkey, ktp.keylen);
|
||||||
kfree(kkey);
|
kfree(kkey);
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
@@ -1426,6 +1427,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
|
|||||||
kkey, ktp.keylen, &ktp.protkey);
|
kkey, ktp.keylen, &ktp.protkey);
|
||||||
DEBUG_DBG("%s pkey_keyblob2pkey2()=%d\n", __func__, rc);
|
DEBUG_DBG("%s pkey_keyblob2pkey2()=%d\n", __func__, rc);
|
||||||
kfree(apqns);
|
kfree(apqns);
|
||||||
|
memzero_explicit(kkey, ktp.keylen);
|
||||||
kfree(kkey);
|
kfree(kkey);
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
@@ -1552,6 +1554,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
|
|||||||
protkey, &protkeylen);
|
protkey, &protkeylen);
|
||||||
DEBUG_DBG("%s pkey_keyblob2pkey3()=%d\n", __func__, rc);
|
DEBUG_DBG("%s pkey_keyblob2pkey3()=%d\n", __func__, rc);
|
||||||
kfree(apqns);
|
kfree(apqns);
|
||||||
|
memzero_explicit(kkey, ktp.keylen);
|
||||||
kfree(kkey);
|
kfree(kkey);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kfree(protkey);
|
kfree(protkey);
|
||||||
|
|||||||
Reference in New Issue
Block a user