From: "Christoph Schlameuss" <schlameuss@linux.ibm.com>
To: "Steffen Eiden" <seiden@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>
Cc: "David Hildenbrand" <david@kernel.org>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Christoph Schlameuss" <schlameuss@linux.ibm.com>,
"Harald Freudenberger" <freude@linux.ibm.com>,
<kvm@vger.kernel.org>, <linux-s390@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] s390: uv: Fix loop condition in uv_find_secrets
Date: Wed, 12 Aug 2026 09:30:02 +0200 [thread overview]
Message-ID: <DKMSEYY98TEX.3OCZ7ZWIXKATS@linux.ibm.com> (raw)
In-Reply-To: <20260811-uv_secrets_fix-v1-1-940a421a9292@linux.ibm.com>
On Tue Aug 11, 2026 at 10:43 AM CEST, Steffen Eiden wrote:
> Nothing modified `start_idx` between the assignment and the comparison,
> so the condition was always false and the do/while ran exactly once
> even when the UV returned UVC_RC_MORE_DATA. Systems with more than
> 85 UV secrets got -ENOENT for any secret past the first page.
>
> Fix this by setting the start index at the beginning of the loop not at
> the end. First test if there are more secrets left by comparing
> start_idx with list->next_secret_idx, and then set the start index to the
> next secret index.
>
> Fixes: 7c9137af2042 ("s390/uv: Retrieve UV secrets support")
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> ---
> arch/s390/kernel/uv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
> index a284f98d9716..d970b15ef126 100644
> --- a/arch/s390/kernel/uv.c
> +++ b/arch/s390/kernel/uv.c
> @@ -781,11 +781,14 @@ int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN],
> struct uv_secret_list *list,
> struct uv_secret_list_item_hdr *secret)
> {
> - u16 start_idx = 0;
> + u16 start_idx;
> u16 list_rc;
> int ret;
>
> + list->next_secret_idx = 0;
> +
> do {
> + start_idx = list->next_secret_idx;
> uv_list_secrets(list, start_idx, &list_rc, NULL);
> if (list_rc != UVC_RC_EXECUTED && list_rc != UVC_RC_MORE_DATA) {
> if (list_rc == UVC_RC_INV_CMD)
> @@ -796,7 +799,6 @@ int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN],
> ret = find_secret_in_page(secret_id, list, secret);
> if (ret == 0)
> return ret;
> - start_idx = list->next_secret_idx;
> } while (list_rc == UVC_RC_MORE_DATA && start_idx < list->next_secret_idx);
>
> return -ENOENT;
>
> ---
> base-commit: d58772d8520c7ef247c4b95c9bd76d3a25da9ff5
> change-id: 20260811-uv_secrets_fix-58a63b4a4ec4
>
> Best regards,
prev parent reply other threads:[~2026-08-12 7:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 8:43 [PATCH] s390: uv: Fix loop condition in uv_find_secrets Steffen Eiden
2026-08-11 15:34 ` Claudio Imbrenda
2026-08-12 7:30 ` Christoph Schlameuss [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=DKMSEYY98TEX.3OCZ7ZWIXKATS@linux.ibm.com \
--to=schlameuss@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@kernel.org \
--cc=frankja@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=seiden@linux.ibm.com \
--cc=svens@linux.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox