* [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors
@ 2026-08-03 14:30 Muhammad Bilal
2026-08-03 14:30 ` [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer Muhammad Bilal
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001
This series fixes several bugs in the hp-bioscfg driver:
1. Memory safety issues (patches 1-6):
- Off-by-one NUL terminator write in hp_get_string_from_buffer()
- Heap OOB read in sk_store()/kek_store() when passing original count
instead of trimmed length to hp_wmi_perform_query()
- Heap OOB read on empty password write in validate_password_input()
- 16-byte heap overflow in hp_calculate_security_buffer() for empty
authentication tokens
- Off-by-one heap OOB write in audit_log_entries_show() when more
than 256 log entries are reported
- Missing bounds check in the PSWD_ENCODINGS parsing loop
2. Logic bugs (patches 7-8):
- new_password_store() incorrectly passing is_current=true, causing
writes to land in current_password instead
- ORD_LIST_ELEMENTS case using a stale NULL str_value pointer
instead of converting the current ACPI element directly
3. ACPI package element index tracking (patches 9-13):
- Five attribute-type parsers (enum, int, string, order-list, passwd)
all share the same defect: multi-element array cases
(PREREQUISITES, ENUM_POSSIBLE_VALUES, PSWD_ENCODINGS) consume
"size" consecutive elements but the outer loop only advances by
one, causing the next iteration to misread a leftover array entry
as the next property and abort with -EIO
Tested on HP EliteBook 840 G2 (BIOS M71 Ver. 01.31), kernel 7.2.0-rc5+,
with CONFIG_KASAN_GENERIC=y and CONFIG_SLUB_DEBUG=y.
This series applies on top of:
commit ea4d8f8ba283 ("platform/x86: hp-bioscfg: fix
slab-out-of-bounds write in hp_convert_hexstr_to_str")
Muhammad Bilal (13):
platform/x86: hp-bioscfg: fix off-by-one write in
hp_get_string_from_buffer
platform/x86: hp-bioscfg: fix heap OOB read in sk_store and kek_store
platform/x86: hp-bioscfg: fix heap OOB read on empty password write
platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth
token
platform/x86: hp-bioscfg: fix off-by-one heap OOB write in
audit_log_entries_show
platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS
loop
platform/x86: hp-bioscfg: fix new_password_store overwriting
current_password
platform/x86: hp-bioscfg: fix ORD_LIST_ELEMENTS never being parsed
platform/x86: hp-bioscfg: advance elem past consumed array elements in
enum-attributes
platform/x86: hp-bioscfg: advance elem past consumed array elements in
int-attributes
platform/x86: hp-bioscfg: advance elem past consumed array elements in
string-attributes
platform/x86: hp-bioscfg: advance elem past consumed array elements in
order-list-attributes
platform/x86: hp-bioscfg: advance elem past consumed array elements in
passwdobj-attributes
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
.../platform/x86/hp/hp-bioscfg/enum-attributes.c | 4 ++++
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c | 2 ++
.../x86/hp/hp-bioscfg/order-list-attributes.c | 6 +++++-
.../x86/hp/hp-bioscfg/passwdobj-attributes.c | 13 +++++++++++--
.../platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 6 +++---
.../platform/x86/hp/hp-bioscfg/string-attributes.c | 2 ++
.../x86/hp/hp-bioscfg/surestart-attributes.c | 2 +-
8 files changed, 29 insertions(+), 8 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 02/13] platform/x86: hp-bioscfg: fix heap OOB read in sk_store and kek_store Muhammad Bilal
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
hp_get_string_from_buffer() clamps the converted string length against
the destination buffer size with "size > dst_size", so when the
converted length is exactly equal to dst_size, conv_dst_size is left
at dst_size and the unconditional NUL terminator write
dst[conv_dst_size] = 0;
lands one byte past the destination buffer. This is the same shape of
bug as the previously fixed off-by-one in hp_convert_hexstr_to_str():
the buffer is sized correctly for the content, but the terminator
write is never checked against that size.
Fix by changing the comparison to ">=" so conv_dst_size is always left
with room for the terminator.
All fixed-size destinations that reach this function (path[512],
current_value[512], current_password/current_value[64], and the
per-entry buffers in encodings[][512] and prerequisites[][512]) are
affected.
Fixes: a34fc329b189 ("platform/x86: hp-bioscfg: bioscfg")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index 2bf57e6eade4..0edc6e7cfa9a 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
@@ -85,7 +85,7 @@ int hp_get_string_from_buffer(u8 **buffer, u32 *buffer_size, char *dst, u32 dst_
* bytes.
*/
conv_dst_size = size;
- if (size > dst_size)
+ if (size >= dst_size)
conv_dst_size = dst_size - 1;
/*
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/13] platform/x86: hp-bioscfg: fix heap OOB read in sk_store and kek_store
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
2026-08-03 14:30 ` [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 03/13] platform/x86: hp-bioscfg: fix heap OOB read on empty password write Muhammad Bilal
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
sk_store() and kek_store() strip a trailing newline from the sysfs
write before allocating the key buffer:
length = count;
if (buf[length - 1] == '\n')
length--;
bioscfg_drv.spm_data.signing_key = kmemdup(buf, length, GFP_KERNEL);
but then pass the original "count" (not "length") as the copy size to
hp_wmi_perform_query(), which memcpy()s that many bytes out of the
"length"-sized allocation, reading one byte past it whenever the write
ends in a newline, the normal case for a shell "echo" into sysfs.
KASAN confirms this directly:
BUG: KASAN: slab-out-of-bounds in hp_wmi_perform_query+0x1e9/0x460 [hp_bioscfg]
Read of size 28 at addr ffff88813c8e2b80 by task python3/16022
...
sk_store+0xa7/0x240 [hp_bioscfg]
kernfs_fop_write_iter+0x3e1/0x5d0
...
The buggy address is located 0 bytes inside of
allocated 27-byte region [ffff88813c8e2b80, ffff88813c8e2b9b)
Reproduced identically for kek_store, and at multiple write sizes
(28, 57, 201 bytes), each time reading exactly one byte past a
kmemdup() allocation one byte smaller than the write.
Fix by passing "length" instead of "count" to hp_wmi_perform_query()
in both functions.
Fixes: b2715aa2e135 ("platform/x86: hp-bioscfg: spmobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
index 2b00a14792e9..4d94e48c1a4c 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
@@ -238,7 +238,7 @@ static ssize_t sk_store(struct kobject *kobj,
ret = hp_wmi_perform_query(HPWMI_SECUREPLATFORM_SET_SK,
HPWMI_SECUREPLATFORM,
(void *)bioscfg_drv.spm_data.signing_key,
- count, 0);
+ length, 0);
if (!ret) {
bioscfg_drv.spm_data.mechanism = SIGNING_KEY;
@@ -274,7 +274,7 @@ static ssize_t kek_store(struct kobject *kobj,
ret = hp_wmi_perform_query(HPWMI_SECUREPLATFORM_SET_KEK,
HPWMI_SECUREPLATFORM,
(void *)bioscfg_drv.spm_data.endorsement_key,
- count, 0);
+ length, 0);
if (!ret) {
bioscfg_drv.spm_data.mechanism = ENDORSEMENT_KEY;
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/13] platform/x86: hp-bioscfg: fix heap OOB read on empty password write
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
2026-08-03 14:30 ` [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer Muhammad Bilal
2026-08-03 14:30 ` [PATCH 02/13] platform/x86: hp-bioscfg: fix heap OOB read in sk_store and kek_store Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 04/13] platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth token Muhammad Bilal
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
validate_password_input() computes length = strlen(buf) and then
checks buf[length - 1] to strip a trailing newline, without checking
that length is nonzero first. Writing an empty string (a bare '\n')
to current_password or new_password gives length == 0, and
buf[length - 1] reads buf[-1], one byte before the heap allocation
holding the copied input.
KASAN confirms this directly:
BUG: KASAN: slab-out-of-bounds in store_password_instance.constprop.0+0x223/0x2a0 [hp_bioscfg]
Read of size 1 at addr ffff88811bd8da9f by task sh/13740
...
store_password_instance.constprop.0+0x223/0x2a0 [hp_bioscfg]
current_password_store+0x14/0x20 [hp_bioscfg]
...
The buggy address is located 23 bytes to the right of
allocated 8-byte region [ffff88811bd8da80, ffff88811bd8da88)
Reproduced identically via new_password_store. Execution continues
past the bad read (the garbage byte only affects whether "length" is
decremented by one), so the write completes and returns success; this
is a pure information read past the buffer, not a crash, but it is
still an out-of-bounds access KASAN correctly flags.
Fix by only checking buf[length - 1] when length is nonzero.
Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index 4d79eb8056a5..86fa03a5ee9a 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -66,7 +66,7 @@ static int validate_password_input(int instance_id, const char *buf)
struct password_data *password_data = &bioscfg_drv.password_data[instance_id];
length = strlen(buf);
- if (buf[length - 1] == '\n')
+ if (length > 0 && buf[length - 1] == '\n')
length--;
if (length > MAX_PASSWD_SIZE)
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/13] platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth token
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (2 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 03/13] platform/x86: hp-bioscfg: fix heap OOB read on empty password write Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 05/13] platform/x86: hp-bioscfg: fix off-by-one heap OOB write in audit_log_entries_show Muhammad Bilal
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
hp_calculate_security_buffer() special-cases an empty authentication
string and returns a fixed 4 bytes (sizeof(u16) * 2). But
hp_populate_security_buffer() does not special-case that same input:
for any authentication string that does not start with BEAM_PREFIX,
including the empty string, it always builds "UTF_PREFIX +
authentication" and converts the result to UTF-16, writing a 2-byte
length header plus 2 bytes per character of "<utf-16/>" (9 characters),
20 bytes total, regardless of how long "authentication" itself is.
The caller, hp_set_attribute(), sizes its kmalloc() buffer using
hp_calculate_security_buffer()'s return value, so for an empty
authentication token it allocates 4 bytes for the security area but
hp_populate_security_buffer() then writes 20 bytes into it, a 16-byte
heap buffer overflow.
The authentication token used here is the current admin/setup
password, which is an empty string by default until one is
configured. Any write to a writable BIOS attribute while no admin
password has been set reaches this path.
Fix by removing the special-case short return for an empty string in
hp_calculate_security_buffer() and letting the normal formula run,
which already accounts for the UTF_PREFIX correctly for the non-empty
case; for an empty string this naturally yields the same 20 bytes
that hp_populate_security_buffer() writes.
Fixes: b2715aa2e135 ("platform/x86: hp-bioscfg: spmobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
index 4d94e48c1a4c..2d4a3720f80c 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c
@@ -48,7 +48,7 @@ size_t hp_calculate_security_buffer(const char *authentication)
authlen = strlen(authentication);
if (!authlen)
- return sizeof(u16) * 2;
+ return sizeof(u16) + strlen(UTF_PREFIX) * sizeof(u16);
size = sizeof(u16) + authlen * sizeof(u16);
if (!strstarts(authentication, BEAM_PREFIX))
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/13] platform/x86: hp-bioscfg: fix off-by-one heap OOB write in audit_log_entries_show
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (3 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 04/13] platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth token Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 06/13] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop Muhammad Bilal
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
The per-iteration guard in audit_log_entries_show() is:
if (ret < 0 || (LOG_ENTRY_SIZE * i) > PAGE_SIZE)
break;
...
memcpy(buf, audit_log_buffer, LOG_ENTRY_SIZE);
buf += LOG_ENTRY_SIZE;
At i == 256 (PAGE_SIZE / LOG_ENTRY_SIZE), LOG_ENTRY_SIZE * i equals
PAGE_SIZE exactly, which is not ">" PAGE_SIZE, so the loop does not
break and instead writes another LOG_ENTRY_SIZE (16) bytes starting at
offset 4096 of the page-sized sysfs output buffer, one entry past its
end.
This needs the BIOS to report more than 256 audit log entries, which
already exceeds this driver's own documented LOG_MAX_ENTRIES of 254,
so it requires a non-compliant or corrupted firmware value rather than
the roughly 85 million entries an unrelated integer-overflow read of
this code might suggest.
Fix by checking the bound against the offset the write is about to
reach, (i + 1), instead of the offset already written.
Fixes: 63e8f906e94e ("platform/x86: hp-bioscfg: surestart-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
index b57e42f29282..6b63fdb84606 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/surestart-attributes.c
@@ -90,7 +90,7 @@ static ssize_t audit_log_entries_show(struct kobject *kobj,
HPWMI_SURESTART,
audit_log_buffer, 1, 128);
- if (ret < 0 || (LOG_ENTRY_SIZE * i) > PAGE_SIZE) {
+ if (ret < 0 || (LOG_ENTRY_SIZE * (i + 1)) > PAGE_SIZE) {
/*
* Encountered a failure while reading
* individual logs. Only a partial list of
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/13] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (4 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 05/13] platform/x86: hp-bioscfg: fix off-by-one heap OOB write in audit_log_entries_show Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 07/13] platform/x86: hp-bioscfg: fix new_password_store overwriting current_password Muhammad Bilal
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
The PREREQUISITES loop earlier in the same function checks
"elem + reqs" against password_obj_count before indexing the ACPI
package element array:
if (elem + reqs >= password_obj_count) {
pr_err("Error elem-objects package is too small\n");
return -EINVAL;
}
The PSWD_ENCODINGS loop performs the identical indexing pattern,
password_obj[elem + pos_values], with no equivalent check, causing an
out-of-bounds read of the package element array whenever
encodings_size is larger than the number of elements actually present.
Fix by adding the same bounds check, matching PREREQUISITES.
Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index 86fa03a5ee9a..acb123985ede 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -351,6 +351,11 @@ static int hp_populate_password_elements_from_package(union acpi_object *passwor
case PSWD_ENCODINGS:
size = min_t(u32, password_data->encodings_size, MAX_ENCODINGS_SIZE);
for (pos_values = 0; pos_values < size; pos_values++) {
+ if (elem + pos_values >= password_obj_count) {
+ pr_err("Error elem-objects package is too small\n");
+ return -EINVAL;
+ }
+
ret = hp_convert_hexstr_to_str(password_obj[elem + pos_values].string.pointer,
password_obj[elem + pos_values].string.length,
&str_value, &value_len);
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/13] platform/x86: hp-bioscfg: fix new_password_store overwriting current_password
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (5 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 06/13] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 08/13] platform/x86: hp-bioscfg: fix ORD_LIST_ELEMENTS never being parsed Muhammad Bilal
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
current_password_store() and new_password_store() both call
store_password_instance() with is_current = true:
static ssize_t new_password_store(...)
{
return store_password_instance(kobj, buf, count, true);
}
so a write to new_password is routed to current_password instead, and
the new_password field is never written by either sysfs entry point.
Fix by passing false from new_password_store(), matching what the
is_current parameter is meant to select.
Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index acb123985ede..6bd56d3f5bd0 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -123,7 +123,7 @@ static ssize_t new_password_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
- return store_password_instance(kobj, buf, count, true);
+ return store_password_instance(kobj, buf, count, false);
}
static struct kobj_attribute password_new_password = __ATTR_WO(new_password);
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/13] platform/x86: hp-bioscfg: fix ORD_LIST_ELEMENTS never being parsed
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (6 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 07/13] platform/x86: hp-bioscfg: fix new_password_store overwriting current_password Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 09/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in enum-attributes Muhammad Bilal
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
The ACPI_TYPE_STRING case explicitly skips the string conversion for
elem == ORD_LIST_ELEMENTS:
if (elem != PREREQUISITES && elem != ORD_LIST_ELEMENTS) {
ret = hp_convert_hexstr_to_str(..., &str_value, &value_len);
if (ret)
continue;
}
so by the time the ORD_LIST_ELEMENTS case in the eloc switch runs,
str_value is NULL (it was freed and reset to NULL at the end of the
previous iteration). That case then does:
ret = hp_convert_hexstr_to_str(str_value, value_len, &tmpstr, &tmp_len);
hp_convert_hexstr_to_str() rejects a NULL input with -EINVAL, which
sends this function to exit_list, and exit_list unconditionally
returns 0. The net effect is that any ordered-list attribute with
elements present silently ends up with an empty elements list, with no
error surfaced anywhere.
Fix by converting the current element directly, order_obj[elem], the
same way the PREREQUISITES case already handles its own array
elements, instead of reusing the unrelated str_value/value_len left
over from earlier processing.
Fixes: 4b2672ec71a3 ("platform/x86: hp-bioscfg: order-list-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index f09489a085c8..704c69c18146 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -261,7 +261,9 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
* Ordered list data is stored in hex and comma separated format
* Convert the data and split it to show each element
*/
- ret = hp_convert_hexstr_to_str(str_value, value_len, &tmpstr, &tmp_len);
+ ret = hp_convert_hexstr_to_str(order_obj[elem].string.pointer,
+ order_obj[elem].string.length,
+ &tmpstr, &tmp_len);
if (ret)
goto exit_list;
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in enum-attributes
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (7 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 08/13] platform/x86: hp-bioscfg: fix ORD_LIST_ELEMENTS never being parsed Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 10/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in int-attributes Muhammad Bilal
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
The outer parsing loop advances "elem" (the index into the ACPI
package's element array) by exactly one per iteration:
for (elem = 1, eloc = 1; elem < enum_obj_count; elem++, eloc++) {
but the PREREQUISITES and ENUM_POSSIBLE_VALUES cases each consume
"size" consecutive elements (elem, elem + 1, ..., elem + size - 1) to
populate an array, without adjusting "elem" to account for the extra
elements consumed beyond the first. The next outer iteration then
re-reads a leftover element from the array just consumed instead of
the next real property, and the type check against
expected_enum_types[eloc] fails on that stale element, aborting the
parse with -EIO.
This produces exactly the failure visible in dmesg on the test
hardware, on every boot:
Error expected type 2 for elem 13, but got type 1 instead
hp_bioscfg: Returned error 0x3, "Invalid command value/Feature not
supported"
Note: this exact message string is shared by more than one file in
this driver (see the companion patches to int-attributes.c,
string-attributes.c, order-list-attributes.c, and
passwdobj-attributes.c in this series, which fix the identical
pattern), so this dmesg line cannot be attributed to this file alone
without further instrumentation; it is included here as evidence that
this class of bug is live and reachable on real hardware, not as
proof this specific instance is the one firing.
Fix by advancing "elem" by (size - 1) after each of the two loops, so
the outer loop's own "elem++" lands on the correct next element.
"eloc" is intentionally left alone, it indexes the logical property
schema (expected_enum_types[]), not the physical element array, and
each of PREREQUISITES/ENUM_POSSIBLE_VALUES is still exactly one
logical property regardless of how many physical elements it spans.
Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
index af4d1920d488..43beb639051e 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
@@ -227,6 +227,8 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
kfree(str_value);
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case SECURITY_LEVEL:
@@ -280,6 +282,8 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
kfree(str_value);
str_value = NULL;
}
+ if (size)
+ elem += (size < MAX_VALUES_SIZE ? size : MAX_VALUES_SIZE) - 1;
break;
default:
pr_warn("Invalid element: %d found in Enumeration attribute or data may be malformed\n", elem);
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in int-attributes
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (8 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 09/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in enum-attributes Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 11/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in string-attributes Muhammad Bilal
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
Same defect as the companion fix to enum-attributes.c in this series:
the PREREQUISITES case consumes "size" consecutive ACPI package
elements via elem + reqs, but the outer loop only advances "elem" by
one per iteration, causing the next iteration to misread a leftover
prerequisite entry as the next property and abort the parse with
-EIO on the resulting type mismatch.
Fix by advancing "elem" by (size - 1) after the loop.
Fixes: 6f2c06d5a467 ("platform/x86: hp-bioscfg: int-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
index d96e160953e3..5373af71549a 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c
@@ -243,6 +243,8 @@ static int hp_populate_integer_elements_from_package(union acpi_object *integer_
kfree(str_value);
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case SECURITY_LEVEL:
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in string-attributes
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (9 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 10/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in int-attributes Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 12/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in order-list-attributes Muhammad Bilal
2026-08-03 14:30 ` [PATCH 13/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in passwdobj-attributes Muhammad Bilal
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
Same defect as the companion fix to enum-attributes.c in this series:
the PREREQUISITES case consumes "size" consecutive ACPI package
elements via elem + reqs, but the outer loop only advances "elem" by
one per iteration, causing the next iteration to misread a leftover
prerequisite entry as the next property and abort the parse with
-EIO on the resulting type mismatch.
Fix by advancing "elem" by (size - 1) after the loop.
Fixes: e6c7b3e15559 ("platform/x86: hp-bioscfg: string-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/string-attributes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
index fe5a9a3a4ef1..5abec8995911 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c
@@ -233,6 +233,8 @@ static int hp_populate_string_elements_from_package(union acpi_object *string_ob
kfree(str_value);
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case SECURITY_LEVEL:
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in order-list-attributes
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (10 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 11/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in string-attributes Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
2026-08-03 14:30 ` [PATCH 13/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in passwdobj-attributes Muhammad Bilal
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
Same defect as the companion fix to enum-attributes.c in this series:
the PREREQUISITES case consumes "size" consecutive ACPI package
elements via elem + reqs, but the outer loop only advances "elem" by
one per iteration, causing the next iteration to misread a leftover
prerequisite entry as the next property and abort the parse with
-EIO on the resulting type mismatch.
Fix by advancing "elem" by (size - 1) after the loop.
Fixes: 4b2672ec71a3 ("platform/x86: hp-bioscfg: order-list-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index 704c69c18146..6696255738ba 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -232,6 +232,8 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
kfree(str_value);
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case SECURITY_LEVEL:
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 13/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in passwdobj-attributes
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
` (11 preceding siblings ...)
2026-08-03 14:30 ` [PATCH 12/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in order-list-attributes Muhammad Bilal
@ 2026-08-03 14:30 ` Muhammad Bilal
12 siblings, 0 replies; 14+ messages in thread
From: Muhammad Bilal @ 2026-08-03 14:30 UTC (permalink / raw)
To: platform-driver-x86
Cc: jorge.lopez2, hansg, ilpo.jarvinen, linux, linux-kernel,
meatuni001, stable
Same defect as the companion fix to enum-attributes.c in this series,
present here in both the PREREQUISITES and PSWD_ENCODINGS cases: each
consumes "size" consecutive ACPI package elements, but the outer loop
only advances "elem" by one per iteration, causing the next iteration
to misread a leftover entry as the next property and abort the parse
with -EIO on the resulting type mismatch.
Fix by advancing "elem" by (size - 1) after each of the two loops.
Fixes: 8646a3b5ee3a ("platform/x86: hp-bioscfg: passwdobj-attributes")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
index 6bd56d3f5bd0..9b989ef756ea 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c
@@ -321,6 +321,8 @@ static int hp_populate_password_elements_from_package(union acpi_object *passwor
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case SECURITY_LEVEL:
password_data->common.security_level = int_value;
@@ -367,6 +369,8 @@ static int hp_populate_password_elements_from_package(union acpi_object *passwor
str_value = NULL;
}
+ if (size)
+ elem += size - 1;
break;
case PSWD_IS_SET:
password_data->is_enabled = int_value;
--
2.55.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-08-03 14:31 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 14:30 [PATCH 00/13] platform/x86: hp-bioscfg: fix multiple memory safety bugs and parsing errors Muhammad Bilal
2026-08-03 14:30 ` [PATCH 01/13] platform/x86: hp-bioscfg: fix off-by-one write in hp_get_string_from_buffer Muhammad Bilal
2026-08-03 14:30 ` [PATCH 02/13] platform/x86: hp-bioscfg: fix heap OOB read in sk_store and kek_store Muhammad Bilal
2026-08-03 14:30 ` [PATCH 03/13] platform/x86: hp-bioscfg: fix heap OOB read on empty password write Muhammad Bilal
2026-08-03 14:30 ` [PATCH 04/13] platform/x86: hp-bioscfg: fix 16-byte heap overflow for empty auth token Muhammad Bilal
2026-08-03 14:30 ` [PATCH 05/13] platform/x86: hp-bioscfg: fix off-by-one heap OOB write in audit_log_entries_show Muhammad Bilal
2026-08-03 14:30 ` [PATCH 06/13] platform/x86: hp-bioscfg: add missing bounds check in PSWD_ENCODINGS loop Muhammad Bilal
2026-08-03 14:30 ` [PATCH 07/13] platform/x86: hp-bioscfg: fix new_password_store overwriting current_password Muhammad Bilal
2026-08-03 14:30 ` [PATCH 08/13] platform/x86: hp-bioscfg: fix ORD_LIST_ELEMENTS never being parsed Muhammad Bilal
2026-08-03 14:30 ` [PATCH 09/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in enum-attributes Muhammad Bilal
2026-08-03 14:30 ` [PATCH 10/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in int-attributes Muhammad Bilal
2026-08-03 14:30 ` [PATCH 11/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in string-attributes Muhammad Bilal
2026-08-03 14:30 ` [PATCH 12/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in order-list-attributes Muhammad Bilal
2026-08-03 14:30 ` [PATCH 13/13] platform/x86: hp-bioscfg: advance elem past consumed array elements in passwdobj-attributes Muhammad Bilal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox