]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
s390/zcrypt: Pad trailing CCA or EP11 message with zeros
authorHarald Freudenberger <freude@linux.ibm.com>
Mon, 3 Aug 2026 08:33:38 +0000 (10:33 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 5 Aug 2026 13:12:22 +0000 (15:12 +0200)
commiteb363254472493e3458156fc11fd56dca92f4333
tree71f997bd3b5ec434bd6107a59db5b4b67a04bf00
parent0864a163783bff109b548266921829ea794edc93
s390/zcrypt: Pad trailing CCA or EP11 message with zeros

The both functions xcrb_msg_to_type6cprb_msgx() and
xcrb_msg_to_type6_ep11cprb_msgx() copy the user space message into a
kernel buffer based on the message length. But on further processing
the message is supposed to be 4 byte length adjusted. Thus up to 3
bytes of uninitialized kernel memory are forwarded to further
processing steps and may unwanted expose kernel memory to the crypto
card firmware.

This patch contains code to pad the gap between user space copied
message and message buffer length sent down to further processing of
the CCA or EP11 message to zeros.

Fixes: e2c6d91eb8b1 ("s390/zcrypt: Rework domain processing within zcrypt device driver")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Cc: stable@vger.kernel.org # 7.1+
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/zcrypt_msgtype6.c