linux-stable/drivers/s390/crypto
Harald Freudenberger 4cfca532dd s390/zcrypt: fix reply buffer calculations for CCA replies
The length information for available buffer space for CCA
replies is covered with two fields in the T6 header prepended
on each CCA reply: fromcardlen1 and fromcardlen2. The sum of
these both values must not exceed the AP bus limit for this
card (24KB for CEX8, 12KB CEX7 and older) minus the always
present headers.

The current code adjusted the fromcardlen2 value in case
of exceeding the AP bus limit when there was a non-zero
value given from userspace. Some tests now showed that this
was the wrong assumption. Instead the userspace value given for
this field should always be trusted and if the sum of the
two fields exceeds the AP bus limit for this card the first
field fromcardlen1 should be adjusted instead.

So now the calculation is done with this new insight in mind.
Also some additional checks for overflow have been introduced
and some comments to provide some documentation for future
maintainers of this complicated calculation code.

Furthermore the 128 bytes of fix overhead which is used
in the current code is not correct. Investigations showed
that for a reply always the same two header structs are
prepended before a possible payload. So this is also fixed
with this patch.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-07-20 16:48:56 +02:00
..
ap_bus.c s390: fix various typos 2023-07-03 11:19:42 +02:00
ap_bus.h s390: fix various typos 2023-07-03 11:19:42 +02:00
ap_card.c s390/zcrypt: replace scnprintf with sysfs_emit 2023-03-20 11:12:48 +01:00
ap_debug.h s390/zcrypt: rework of debug feature messages 2021-10-26 15:21:27 +02:00
ap_queue.c s390/zcrypt: cleanup some debug code 2023-07-03 11:19:41 +02:00
Makefile s390/zcrypt: add new low level ep11 functions support file 2020-01-30 13:07:55 +01:00
pkey_api.c s390/pkey: add support for ecc clear key 2023-06-01 17:10:21 +02:00
vfio_ap_debug.h s390-vfio-ap: introduces s390 kernel debug feature for vfio_ap device driver 2022-02-06 23:31:29 +01:00
vfio_ap_drv.c s390 updates for the 6.4 merge window 2023-04-30 11:43:31 -07:00
vfio_ap_ops.c s390: fix various typos 2023-07-03 11:19:42 +02:00
vfio_ap_private.h s390/vfio-ap: realize the VFIO_DEVICE_SET_IRQS ioctl 2023-06-06 13:42:07 +02:00
zcrypt_api.c s390: fix various typos 2023-07-03 11:19:42 +02:00
zcrypt_api.h s390/zcrypt: cleanup some debug code 2023-07-03 11:19:41 +02:00
zcrypt_card.c s390/zcrypt: replace scnprintf with sysfs_emit 2023-03-20 11:12:48 +01:00
zcrypt_cca_key.h s390/zcrypt: rework arrays with length zero occurrences 2023-04-19 16:47:31 +02:00
zcrypt_ccamisc.c s390: fix various typos 2023-07-03 11:19:42 +02:00
zcrypt_ccamisc.h s390: fix various typos 2023-07-03 11:19:42 +02:00
zcrypt_cex2a.c s390/zcrypt: code cleanup 2022-04-25 13:54:14 +02:00
zcrypt_cex2a.h
zcrypt_cex2c.c s390/ap: provide F bit parameter for ap_rapq() and ap_zapq() 2023-03-20 11:12:49 +01:00
zcrypt_cex2c.h
zcrypt_cex4.c s390/zcrypt: replace scnprintf with sysfs_emit 2023-03-20 11:12:48 +01:00
zcrypt_cex4.h
zcrypt_debug.h s390/zcrypt: rework of debug feature messages 2021-10-26 15:21:27 +02:00
zcrypt_ep11misc.c s390: fix various typos 2023-07-03 11:19:42 +02:00
zcrypt_ep11misc.h s390: fix various typos 2023-07-03 11:19:42 +02:00
zcrypt_error.h s390/zcrypt: code cleanup 2022-04-25 13:54:14 +02:00
zcrypt_msgtype6.c s390/zcrypt: fix reply buffer calculations for CCA replies 2023-07-20 16:48:56 +02:00
zcrypt_msgtype6.h s390/zcrypt: code cleanup 2022-04-25 13:54:14 +02:00
zcrypt_msgtype50.c s390/zcrypt: cleanup some debug code 2023-07-03 11:19:41 +02:00
zcrypt_msgtype50.h s390/zcrypt: Support CPRB minor version T7 2022-03-08 00:33:00 +01:00
zcrypt_queue.c s390/zcrypt: replace scnprintf with sysfs_emit 2023-03-20 11:12:48 +01:00