]> git.ipfire.org Git - thirdparty/linux.git/commit
s390/zcrypt: Fix CPRB memory allocation in zcrypt misc code
authorHarald Freudenberger <freude@linux.ibm.com>
Mon, 3 Aug 2026 08:33:34 +0000 (10:33 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 5 Aug 2026 13:12:22 +0000 (15:12 +0200)
commit5004889551dfaf7f4b2cda8ed213d234bb8ebf82
treee2f6b811a64981c4165acba4bd56faead134470f
parent01476391aecef36a3b789ee844357b22fbc90665
s390/zcrypt: Fix CPRB memory allocation in zcrypt misc code

Both CPRB alloc functions in zcrypt_ccamisc.c and zcrypt_ep11misc.c
did not round up the memory allocation to a multiple of 4 bytes as it
is needed by the zcrypt layer to process the CPRBs.

Now the alloc_and_prep_cprbmem() and alloc_cprbmem() functions
guarantee that the base CPRB struct and a possible parameter block are
aligned to a 4-byte boundary and the backing memory allocation is
rounded up to the next multiple of 4 byte. Also the free_cprbmem() is
updated and scrubs the rounded up amount of memory.

Fixes: 9bdb5f7e8369 ("s390/zcrypt: Introduce cprb mempool for cca misc functions")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Cc: stable@vger.kernel.org # 6.16+
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/zcrypt_ccamisc.c
drivers/s390/crypto/zcrypt_ep11misc.c