summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Freudenberger <freude@linux.ibm.com>2020-01-31 12:08:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-19 19:54:06 +0100
commitb334e9e636e4ba0ca1a42f4b3415803448d03735 (patch)
treee906f83e51e7ff19640e7dae29ebb75346c52724
parent0441d946eb038a2e3fc384edde8156b106798a33 (diff)
downloadlinux-b334e9e636e4ba0ca1a42f4b3415803448d03735.tar.gz
linux-b334e9e636e4ba0ca1a42f4b3415803448d03735.tar.bz2
linux-b334e9e636e4ba0ca1a42f4b3415803448d03735.zip
s390/pkey: fix missing length of protected key on return
commit aab73d278d49c718b722ff5052e16c9cddf144d4 upstream. The pkey ioctl call PKEY_SEC2PROTK updates a struct pkey_protkey on return. The protected key is stored in, the protected key type is stored in but the len information was not updated. This patch now fixes this and so the len field gets an update to refrect the actual size of the protected key value returned. Fixes: efc598e6c8a9 ("s390/zcrypt: move cca misc functions to new code file") Cc: Stable <stable@vger.kernel.org> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reported-by: Christian Rund <RUNDC@de.ibm.com> Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/s390/crypto/pkey_api.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index d78d77686d7b..cda75118ccdb 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -774,7 +774,7 @@ static long pkey_unlocked_ioctl(struct file *filp, unsigned int cmd,
return -EFAULT;
rc = cca_sec2protkey(ksp.cardnr, ksp.domain,
ksp.seckey.seckey, ksp.protkey.protkey,
- NULL, &ksp.protkey.type);
+ &ksp.protkey.len, &ksp.protkey.type);
DEBUG_DBG("%s cca_sec2protkey()=%d\n", __func__, rc);
if (rc)
break;