From: Holger Dengler <dengler@linux.ibm.com>
To: freude@linux.ibm.com
Cc: linux-s390@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Ingo Franzki <ifranzki@linux.ibm.com>
Subject: Re: [PATCH v1 1/1] s390/zcrypt: Validate length in reply before using it
Date: Thu, 20 Aug 2026 17:04:43 +0200 [thread overview]
Message-ID: <e131bc89-eca3-48b7-affe-3fefd1c39170@linux.ibm.com> (raw)
In-Reply-To: <3cd23b72c689c0ba769b5bc091798c40@linux.ibm.com>
On 8/20/26 16:46, Harald Freudenberger wrote:
> On 2026-08-20 16:04, Holger Dengler wrote:
>> diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c
>> b/drivers/s390/crypto/zcrypt_ccamisc.c
>> index d4ce6352b5b2..54b8edd1dfc7 100644
>> --- a/drivers/s390/crypto/zcrypt_ccamisc.c
>> +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
>> @@ -1158,8 +1158,21 @@ static int _ip_cprb_helper(u16 cardnr, u16 domain,
>>
>> /* do not check the key here, it may be incomplete */
>>
>> - /* copy the vlsc key token back */
>> + /*
>> + * Copy the vlsc key token back.
>> + * The available space in the destination (key_token) and the source
>> + * (t) buffer is always larger as the valid range of prepparm-
>> >kb.len.
>> + * Validate t->len ba comparing it with the length information in
>> the
>
> what is this funny "ba" in the previous sentence ?
A typo. Should be "by". Will be fixed in v2.
>
>> + * param block of the request (prepparm->kb.len)
>> + * The value range of prepparm->kb.len has been checked above.
>> + */
>> t = (struct cipherkeytoken *)prepparm->kb.tlv1.key_token;
>> + if (t->len != prepparm->kb.len - 3 * sizeof(uint16_t)) {
>> + ZCRYPT_DBF_ERR("%s reply with invalid key_token length %u\n",
>> + __func__, t->len);
>> + rc = -EIO;
>> + goto out;
>> + }
>> memcpy(key_token, t, t->len);
>> *key_token_size = t->len;
>
> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Thx, I'll pick it for the v2.
--
Mit freundlichen Grüßen / Kind regards
Holger Dengler
prev parent reply other threads:[~2026-08-20 15:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 14:04 [PATCH v1 0/1] 390/zcrypt: Validate length information in reply Holger Dengler
2026-08-20 14:04 ` [PATCH v1 1/1] s390/zcrypt: Validate length in reply before using it Holger Dengler
2026-08-20 14:20 ` sashiko-bot
2026-08-20 15:40 ` Holger Dengler
2026-08-20 14:46 ` Harald Freudenberger
2026-08-20 15:04 ` Holger Dengler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e131bc89-eca3-48b7-affe-3fefd1c39170@linux.ibm.com \
--to=dengler@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=ifranzki@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.