From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Josh Snyder <josh@code406.com>
Cc: Jorge Lopez <jorge.lopez2@hp.com>,
Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: hp-bioscfg: fix heap buffer overflow in security buffer
Date: Fri, 10 Apr 2026 19:40:45 +0300 (EEST) [thread overview]
Message-ID: <928a6f5c-6f94-5661-d95c-03e310abf7bb@linux.intel.com> (raw)
In-Reply-To: <20260402-hp-bioscfg-overflow-v1-1-6985f8c9e67c@code406.com>
On Thu, 2 Apr 2026, Josh Snyder wrote:
> hp_calculate_security_buffer() returns sizeof(u16) * 2 (4 bytes) for
> empty strings via an early return. However, hp_populate_security_buffer()
> always prepends UTF_PREFIX ("<utf-16/>") to non-BEAM authentication
> strings, including empty ones, before converting to UTF-16. This results
> in 20 bytes being written into a 4-byte region of the heap buffer
> allocated in hp_set_attribute().
>
> The 16-byte overrun corrupts adjacent heap memory. In practice, the
> firmware's own bounds checking rejects the undersized buffer before
> acting on it (returning error 0x04), which masked the overflow.
>
> Fix by removing the early return for empty strings. The calculation at
> the end of the function already accounts for UTF_PREFIX correctly when
> authlen is zero: sizeof(u16) + 0 + strlen("<utf-16/>") * sizeof(u16)
> = 20 bytes, matching what hp_populate_security_buffer() writes. The
> NULL check is preserved since hp_populate_security_buffer() would
What NULL check this refers to??? For which of the inputs?
> dereference NULL via strstarts().
This entire description is confusing and seems to also contradict with
itself in multiple places.
> Fixes: b2715aa2e1352 ("platform/x86: hp-bioscfg: spmobj-attributes")
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Josh Snyder <josh@code406.com>
> ---
> drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
> index 2b00a14792e92..93e0a077e4240 100644
> --- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
> +++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
> @@ -47,9 +47,6 @@ size_t hp_calculate_security_buffer(const char *authentication)
> return sizeof(u16) * 2;
>
> authlen = strlen(authentication);
> - if (!authlen)
> - return sizeof(u16) * 2;
> -
> size = sizeof(u16) + authlen * sizeof(u16);
> if (!strstarts(authentication, BEAM_PREFIX))
> size += strlen(UTF_PREFIX) * sizeof(u16);
>
> ---
> base-commit: cc13002a9f984d37906e9476f3e532a8cdd126f5
> change-id: 20260402-hp-bioscfg-overflow-d58dbe53ecf5
>
> Best regards,
> --
> Josh
>
--
i.
next prev parent reply other threads:[~2026-04-10 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-02 23:32 Josh Snyder
2026-04-10 16:40 ` Ilpo Järvinen [this message]
2026-04-12 6:11 ` Josh Snyder
2026-04-13 13:03 ` Ilpo Järvinen
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=928a6f5c-6f94-5661-d95c-03e310abf7bb@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=hansg@kernel.org \
--cc=jorge.lopez2@hp.com \
--cc=josh@code406.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@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 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®