diff options
| author | Holger Dengler <dengler@linux.ibm.com> | 2026-07-29 11:36:15 +0200 |
|---|---|---|
| committer | Vasily Gorbik <gor@linux.ibm.com> | 2026-07-31 13:31:19 +0200 |
| commit | 06afe425d5283b9764303de47f554da5a808ce8a (patch) | |
| tree | d3c4feeb4f10fe1707fa128d26962c3f6e92dd11 | |
| parent | b7ab86bdc65eadcfc43a0e3faf682a3f750cfb96 (diff) | |
| download | linux-next-06afe425d5283b9764303de47f554da5a808ce8a.tar.gz linux-next-06afe425d5283b9764303de47f554da5a808ce8a.zip | |
s390/zcrypt: Validate length for CCA AES cipher key requests
cca_cipher2protkey() derives the copy length for the CPRB parameter
block directly from the length field in the key token. Reject the
request early if the token length exceeds the available space in the
parameter block.
Fixes: 4bc123b18ce6 ("s390/zcrypt: Add low level functions for CCA AES cipher keys")
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Cc: stable@vger.kernel.org # 5.4+
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
| -rw-r--r-- | drivers/s390/crypto/zcrypt_ccamisc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c index 84936a795b95..db6a4211a97e 100644 --- a/drivers/s390/crypto/zcrypt_ccamisc.c +++ b/drivers/s390/crypto/zcrypt_ccamisc.c @@ -1261,6 +1261,9 @@ int cca_cipher2protkey(u16 cardnr, u16 domain, const u8 *ckey, } __packed * prepparm; int keytoklen = ((struct cipherkeytoken *)ckey)->len; + if (keytoklen > PARMBSIZE - sizeof(struct aureqparm)) + return -EINVAL; + /* get already prepared memory for 2 cprbs with param block each */ rc = alloc_and_prep_cprbmem(PARMBSIZE, &mem, &preqcblk, &prepcblk, xflags); |
