Re: [PATCH v7 1/1] s390/zcrypt: Improve zcrypt reply message verification checks
Finn Callies <[email protected]>
| Newsgroups | org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
On 07.08.26 12:19, Harald Freudenberger wrote: > Add or improve checks related to buffer sizes and reply sizes to the > handling of replies from the crypto cards for CCA, EP11 (AP message > type 6) and ICA (AP type 50) messages. The verification code related > to reply field length was not designed well and thus firmware > deficiencies could lead to unexpected behavior in the zcrypt device > driver. Thus improve the code to more closely inspect especially > length fields at message replies. > > Rework zcrypt_msgtype6_receive(), zcrypt_msgtype6_receive_ep11() and > zcrypt_msgtype50_receive() to validate reply lengths more carefully > before copying data back into the request buffer. Use size_t for > length calculations, reject inconsistent reply sizes, and add > defensive handling for short invalid replies. For XCRB replies, > validate both reply segments and derive the effective message length > from the covered range instead of trusting only the second segment. > > Signed-off-by: Harald Freudenberger <[email protected]> > --- > drivers/s390/crypto/zcrypt_msgtype50.c | 39 ++++--- > drivers/s390/crypto/zcrypt_msgtype6.c | 149 ++++++++++++++++--------- > 2 files changed, 124 insertions(+), 64 deletions(-) [ snip ] Reviewed-by: Finn Callies <[email protected]>