From: "Ard Biesheuvel" <ardb@kernel.org>
To: "Zhang Chujun" <zhangchujun@cmss.chinamobile.com>,
"Jeremy Kerr" <jk@ozlabs.org>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
"Kohei Enju" <kohei@enjuk.jp>,
pjones@redhat.com
Subject: Re: [PATCH] efivarfs: fix off-by-one in efivar_validate() variable name matching
Date: Tue, 24 Nov 2026 11:28:34 +0100 [thread overview]
Message-ID: <a3b9592d-1a89-488d-b61b-ac5d49aaba7e@app.fastmail.com> (raw)
In-Reply-To: <20261120081540.1870-1-zhangchujun@cmss.chinamobile.com>
(cc Peter)
On Fri, 20 Nov 2026, at 09:15, Zhang Chujun wrote:
> From: zhangchujun <zhangchujun@cmss.chinamobile.com>
>
> efivar_validate() passes utf8_size + 1 to variable_matches(),
> including the terminating NUL in the name length. However,
> variable_matches() expects the number of non-NUL characters.
>
> As a result, exact-name entries in variable_validate[] fail to
> match, causing some variables to use the wrong validator or
> bypass their intended validation.
>
> Fixes: 630ba0cc7a6d ("efi: Fix out-of-bounds read in variable_matches()")
> Cc: stable@vger.kernel.org
> Signed-off-by: zhangchujun <zhangchujun@cmss.chinamobile.com>
>
> diff --git a/fs/efivarfs/vars.c b/fs/efivarfs/vars.c
> index 6833c3d24b54..9f18bf48615c 100644
> --- a/fs/efivarfs/vars.c
> +++ b/fs/efivarfs/vars.c
> @@ -274,7 +274,7 @@ efivar_validate(efi_guid_t vendor, efi_char16_t
> *var_name, u8 *data,
> if (efi_guidcmp(vendor, variable_validate[i].vendor))
> continue;
>
> - if (variable_matches(utf8_name, utf8_size+1, name, &match)) {
> + if (variable_matches(utf8_name, utf8_size, name, &match)) {
> if (variable_validate[i].validate == NULL)
> break;
> kfree(utf8_name);
Queued as a fix, thanks.
prev parent reply other threads:[~2026-11-24 10:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 8:15 Zhang Chujun
2026-11-24 10:28 ` Ard Biesheuvel [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=a3b9592d-1a89-488d-b61b-ac5d49aaba7e@app.fastmail.com \
--to=ardb@kernel.org \
--cc=jk@ozlabs.org \
--cc=kohei@enjuk.jp \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pjones@redhat.com \
--cc=zhangchujun@cmss.chinamobile.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
all inboxes | Powered by JetHome®