diff options
author | Harald Freudenberger | 2023-07-17 16:55:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-08-30 16:10:59 +0200 |
commit | d4f5dcf68c0531b8a7191b736e121c6537e1b6cf (patch) | |
tree | 3b74aa33c75f3a6a20ec07f60c784e9b509e8622 /drivers/s390/cio | |
parent | 246d763b79a597fcc84ff10d96b620974f47bb56 (diff) |
s390/zcrypt: fix reply buffer calculations for CCA replies
[ Upstream commit 4cfca532ddc3474b3fc42592d0e4237544344b1a ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/s390/cio')
0 files changed, 0 insertions, 0 deletions