* [PATCH 1/2] platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP BIOS
2026-06-26 20:49 [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Muhammad Bilal
@ 2026-06-26 20:49 ` Muhammad Bilal
2026-06-26 20:49 ` [PATCH 2/2] platform/x86: hp-bioscfg: warn on element type mismatch instead of failing Muhammad Bilal
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Muhammad Bilal @ 2026-06-26 20:49 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, Ilpo Järvinen
Cc: Thomas Weißschuh, platform-driver-x86, linux-kernel, stable,
Muhammad Bilal
hp_init_bios_package_attribute() hard-fails when a WMI ACPI package
contains fewer elements than the type-specific expected count (e.g. 11
elements instead of 13 for INTEGER or ENUMERATION attributes). This
causes the entire hp_bioscfg driver to skip attribute enumeration on
older HP hardware whose BIOS returns shortened packages when optional
fields like prerequisites or possible values are absent.
Observed on HP EliteBook 840 G2 (BIOS M71 Ver. 01.31):
hp_bioscfg: ACPI-package does not have enough elements: 11 < 13
The element layout has two tiers:
- Elements 0-9 (SECURITY_LEVEL+1 = 10): common to all attribute types
- Elements 10-N: type-specific (bounds, values, encodings, ...)
The per-type populate functions (hp_populate_*_elements_from_package)
already handle sparse packages correctly via their own elem < count
loop guards and inner-loop bounds checks. The only unsafe case is when
we lack even the common elements needed to register the attribute.
Fix by introducing COMMON_ELEM_CNT to mark the hard minimum (10), and
splitting the check into two tiers:
- Fewer than COMMON_ELEM_CNT elements: hard fail, can't proceed.
- Fewer than expected type-specific elements: warn, but let the
populate function parse what is available.
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 | 11 ++++++++---
drivers/platform/x86/hp/hp-bioscfg/bioscfg.h | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
index 27fd6cd215290..dd531191e88e2 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
@@ -661,12 +661,17 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type,
int ret = 0;
/* Take action appropriate to each ACPI TYPE */
- if (obj->package.count < min_elements) {
- pr_err("ACPI-package does not have enough elements: %d < %d\n",
- obj->package.count, min_elements);
+ if (obj->package.count < COMMON_ELEM_CNT) {
+ pr_err("ACPI-package is missing common elements: %d < %d\n",
+ obj->package.count, COMMON_ELEM_CNT);
goto pack_attr_exit;
}
+ if (obj->package.count < min_elements) {
+ pr_warn("ACPI-package has fewer elements than expected: %d < %d, parsing available elements\n",
+ obj->package.count, min_elements);
+ }
+
elements = obj->package.elements;
/* sanity checking */
diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.h b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.h
index f1eec0e4ba075..f4a375c5669e4 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.h
+++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.h
@@ -279,6 +279,9 @@ enum hp_wmi_data_elements {
PSWD_ENCODINGS = 13,
PSWD_IS_SET = 14,
PSWD_ELEM_CNT = 15,
+
+ /* Minimum elements shared by all attribute types (NAME..SECURITY_LEVEL) */
+ COMMON_ELEM_CNT = SECURITY_LEVEL + 1,
};
#define GET_INSTANCE_ID(type) \
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 2/2] platform/x86: hp-bioscfg: warn on element type mismatch instead of failing
2026-06-26 20:49 [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Muhammad Bilal
2026-06-26 20:49 ` [PATCH 1/2] platform/x86: hp-bioscfg: accept reduced ACPI packages from " Muhammad Bilal
@ 2026-06-26 20:49 ` Muhammad Bilal
2026-06-26 21:14 ` [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Mario Limonciello
2026-06-30 20:29 ` Armin Wolf
3 siblings, 0 replies; 6+ messages in thread
From: Muhammad Bilal @ 2026-06-26 20:49 UTC (permalink / raw)
To: Jorge Lopez, Hans de Goede, Ilpo Järvinen
Cc: Thomas Weißschuh, platform-driver-x86, linux-kernel, stable,
Muhammad Bilal
hp_populate_enumeration_elements_from_package() returns -EIO and aborts
enumeration of the entire attribute when any single element has an
unexpected ACPI type. This is observed on HP EliteBook 840 G2 when the
BIOS returns malformed ACPI data following a failed WMI query:
ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT, Index (0x000000032)
is beyond end of object (length 0x32)
ACPI Error: Aborting method \_SB.WMID.WQBE due to previous error
Error expected type 2 for elem 13, but got type 1 instead
hp_bioscfg: Returned error 0x3, "Invalid command value/Feature not supported"
A type mismatch on one element does not necessarily corrupt the attribute
being built, especially for non-critical type-specific elements such as
possible values or bounds. Failing fatally here discards attributes that
could otherwise be partially useful.
Change the type mismatch handling from a fatal pr_err + return -EIO to
a pr_warn + continue, freeing the accumulated string value and skipping
the affected element. The attribute is still registered with whatever
valid elements the BIOS did supply.
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/enum-attributes.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
index af4d1920d4880..78729354c04f2 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c
@@ -163,10 +163,11 @@ static int hp_populate_enumeration_elements_from_package(union acpi_object *enum
/* Check that both expected and read object type match */
if (expected_enum_types[eloc] != enum_obj[elem].type) {
- pr_err("Error expected type %d for elem %d, but got type %d instead\n",
- expected_enum_types[eloc], elem, enum_obj[elem].type);
+ pr_warn("Unexpected element type at elem %d: expected %d, got %d, skipping\n",
+ elem, expected_enum_types[eloc], enum_obj[elem].type);
kfree(str_value);
- return -EIO;
+ str_value = NULL;
+ continue;
}
/* Assign appropriate element value to corresponding field */
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS
2026-06-26 20:49 [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Muhammad Bilal
2026-06-26 20:49 ` [PATCH 1/2] platform/x86: hp-bioscfg: accept reduced ACPI packages from " Muhammad Bilal
2026-06-26 20:49 ` [PATCH 2/2] platform/x86: hp-bioscfg: warn on element type mismatch instead of failing Muhammad Bilal
@ 2026-06-26 21:14 ` Mario Limonciello
2026-06-30 20:29 ` Armin Wolf
3 siblings, 0 replies; 6+ messages in thread
From: Mario Limonciello @ 2026-06-26 21:14 UTC (permalink / raw)
To: Muhammad Bilal, Jorge Lopez, Hans de Goede, Ilpo Järvinen
Cc: Thomas Weißschuh, platform-driver-x86, linux-kernel, stable
On 6/26/26 15:49, Muhammad Bilal wrote:
> The hp_bioscfg driver silently fails to enumerate BIOS attributes on
> HP EliteBook 840 G2 (and potentially other older HP models) because:
>
> 1. hp_init_bios_package_attribute() hard-fails when a WMI ACPI package
> contains fewer elements than the per-type expected count (11 < 13),
> even though only the first 10 common elements are required to
> register an attribute.
>
> 2. hp_populate_enumeration_elements_from_package() returns -EIO and
> discards the entire attribute when any single element has an
> unexpected ACPI object type — typically after a BIOS AML error
> returns malformed data.
>
> Hardware affected:
> HP EliteBook 840 G2 (DMI: Hewlett-Packard HP EliteBook 840 G2/2216)
> BIOS: M71 Ver. 01.31 (02/24/2020)
>
> How to reproduce:
> 1. Boot a kernel with CONFIG_HP_BIOSCFG=m on an HP EliteBook 840 G2
> 2. modprobe hp_bioscfg
> 3. Observe dmesg:
> hp_bioscfg: ACPI-package does not have enough elements: 11 < 13
> Error expected type 2 for elem 13, but got type 1 instead
>
> Testing notes:
> Tested on HP EliteBook 840 G2 running Arch Linux kernel 7.0.13-arch1-1.
> After patches, hp_bioscfg loads successfully and enumerates available
> BIOS attributes. Attributes with shortened packages are partially
> populated and accessible via sysfs. No regressions on systems that
> return full 13-element packages (checked via code inspection —
> pr_warn path is only reached when count < min_elements).
>
> Relevant dmesg (before fix):
> [ 11.xxx] hp_bioscfg: ACPI-package does not have enough elements:
> 11 < 13
> [ 11.xxx] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT,
> Index (0x000000032) is beyond end of object (length 0x32)
> [ 11.xxx] ACPI Error: Aborting method \_SB.WMID.WQBE
> [ 11.xxx] Error expected type 2 for elem 13, got type 1
> [ 11.xxx] hp_bioscfg: Returned error 0x3
>
> Muhammad Bilal (2):
> platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP
> BIOS
> platform/x86: hp-bioscfg: warn on element type mismatch instead of
> failing
>
> drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 11 ++++++++---
> drivers/platform/x86/hp/hp-bioscfg/bioscfg.h | 3 +++
> drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 7 ++++---
> 3 files changed, 15 insertions(+), 6 deletions(-)
>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS
2026-06-26 20:49 [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Muhammad Bilal
` (2 preceding siblings ...)
2026-06-26 21:14 ` [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS Mario Limonciello
@ 2026-06-30 20:29 ` Armin Wolf
2026-07-04 16:56 ` Muhammad Bilal
3 siblings, 1 reply; 6+ messages in thread
From: Armin Wolf @ 2026-06-30 20:29 UTC (permalink / raw)
To: Muhammad Bilal, Jorge Lopez, Hans de Goede, Ilpo Järvinen
Cc: Thomas Weißschuh, platform-driver-x86, linux-kernel, stable
Am 26.06.26 um 22:49 schrieb Muhammad Bilal:
> The hp_bioscfg driver silently fails to enumerate BIOS attributes on
> HP EliteBook 840 G2 (and potentially other older HP models) because:
>
> 1. hp_init_bios_package_attribute() hard-fails when a WMI ACPI package
> contains fewer elements than the per-type expected count (11 < 13),
> even though only the first 10 common elements are required to
> register an attribute.
>
> 2. hp_populate_enumeration_elements_from_package() returns -EIO and
> discards the entire attribute when any single element has an
> unexpected ACPI object type — typically after a BIOS AML error
> returns malformed data.
Hi,
it could be that the ACPI firmware still transmits all the necessary data, its just
that some package elements are combined into a single buffer element
(see https://docs.kernel.org/wmi/acpi-interface.html section "Conversion rules for ACPI data types"
for details).
The correct solution would be to migrate the driver to the new buffer-based WMI API,
because said API ensures that ACPI objects are properly marshaled into the common
WMI data format. However this might require a lot of work :/.
Regarding the BIOS error: this usually happens because creating a ByteField with and
invalid length does not cause an error under Windows. Passing a larger buffer usually
fixes this problem.
Thanks,
Armin Wolf
>
> Hardware affected:
> HP EliteBook 840 G2 (DMI: Hewlett-Packard HP EliteBook 840 G2/2216)
> BIOS: M71 Ver. 01.31 (02/24/2020)
>
> How to reproduce:
> 1. Boot a kernel with CONFIG_HP_BIOSCFG=m on an HP EliteBook 840 G2
> 2. modprobe hp_bioscfg
> 3. Observe dmesg:
> hp_bioscfg: ACPI-package does not have enough elements: 11 < 13
> Error expected type 2 for elem 13, but got type 1 instead
>
> Testing notes:
> Tested on HP EliteBook 840 G2 running Arch Linux kernel 7.0.13-arch1-1.
> After patches, hp_bioscfg loads successfully and enumerates available
> BIOS attributes. Attributes with shortened packages are partially
> populated and accessible via sysfs. No regressions on systems that
> return full 13-element packages (checked via code inspection —
> pr_warn path is only reached when count < min_elements).
>
> Relevant dmesg (before fix):
> [ 11.xxx] hp_bioscfg: ACPI-package does not have enough elements:
> 11 < 13
> [ 11.xxx] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT,
> Index (0x000000032) is beyond end of object (length 0x32)
> [ 11.xxx] ACPI Error: Aborting method \_SB.WMID.WQBE
> [ 11.xxx] Error expected type 2 for elem 13, got type 1
> [ 11.xxx] hp_bioscfg: Returned error 0x3
>
> Muhammad Bilal (2):
> platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP
> BIOS
> platform/x86: hp-bioscfg: warn on element type mismatch instead of
> failing
>
> drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 11 ++++++++---
> drivers/platform/x86/hp/hp-bioscfg/bioscfg.h | 3 +++
> drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 7 ++++---
> 3 files changed, 15 insertions(+), 6 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 0/2] platform/x86: hp-bioscfg: fix attribute enumeration on older HP BIOS
2026-06-30 20:29 ` Armin Wolf
@ 2026-07-04 16:56 ` Muhammad Bilal
0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Bilal @ 2026-07-04 16:56 UTC (permalink / raw)
To: Armin Wolf
Cc: Jorge Lopez, Hans de Goede, Ilpo Järvinen,
Thomas Weißschuh, platform-driver-x86, linux-kernel, stable
Hi Armin,
I've posted v2 of the series, which includes an additional preparatory
patch to ensure parser iteration remains bounded before relaxing the
package-length check.
https://lore.kernel.org/all/20260704160759.236249-1-meatuni001@gmail.com/
Thanks for your review.
On Wed, Jul 1, 2026 at 1:29 AM Armin Wolf <W_Armin@gmx.de> wrote:
>
> Am 26.06.26 um 22:49 schrieb Muhammad Bilal:
>
> > The hp_bioscfg driver silently fails to enumerate BIOS attributes on
> > HP EliteBook 840 G2 (and potentially other older HP models) because:
> >
> > 1. hp_init_bios_package_attribute() hard-fails when a WMI ACPI package
> > contains fewer elements than the per-type expected count (11 < 13),
> > even though only the first 10 common elements are required to
> > register an attribute.
> >
> > 2. hp_populate_enumeration_elements_from_package() returns -EIO and
> > discards the entire attribute when any single element has an
> > unexpected ACPI object type — typically after a BIOS AML error
> > returns malformed data.
>
> Hi,
>
> it could be that the ACPI firmware still transmits all the necessary data, its just
> that some package elements are combined into a single buffer element
> (see https://docs.kernel.org/wmi/acpi-interface.html section "Conversion rules for ACPI data types"
> for details).
>
> The correct solution would be to migrate the driver to the new buffer-based WMI API,
> because said API ensures that ACPI objects are properly marshaled into the common
> WMI data format. However this might require a lot of work :/.
>
> Regarding the BIOS error: this usually happens because creating a ByteField with and
> invalid length does not cause an error under Windows. Passing a larger buffer usually
> fixes this problem.
>
> Thanks,
> Armin Wolf
>
> >
> > Hardware affected:
> > HP EliteBook 840 G2 (DMI: Hewlett-Packard HP EliteBook 840 G2/2216)
> > BIOS: M71 Ver. 01.31 (02/24/2020)
> >
> > How to reproduce:
> > 1. Boot a kernel with CONFIG_HP_BIOSCFG=m on an HP EliteBook 840 G2
> > 2. modprobe hp_bioscfg
> > 3. Observe dmesg:
> > hp_bioscfg: ACPI-package does not have enough elements: 11 < 13
> > Error expected type 2 for elem 13, but got type 1 instead
> >
> > Testing notes:
> > Tested on HP EliteBook 840 G2 running Arch Linux kernel 7.0.13-arch1-1.
> > After patches, hp_bioscfg loads successfully and enumerates available
> > BIOS attributes. Attributes with shortened packages are partially
> > populated and accessible via sysfs. No regressions on systems that
> > return full 13-element packages (checked via code inspection —
> > pr_warn path is only reached when count < min_elements).
> >
> > Relevant dmesg (before fix):
> > [ 11.xxx] hp_bioscfg: ACPI-package does not have enough elements:
> > 11 < 13
> > [ 11.xxx] ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT,
> > Index (0x000000032) is beyond end of object (length 0x32)
> > [ 11.xxx] ACPI Error: Aborting method \_SB.WMID.WQBE
> > [ 11.xxx] Error expected type 2 for elem 13, got type 1
> > [ 11.xxx] hp_bioscfg: Returned error 0x3
> >
> > Muhammad Bilal (2):
> > platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP
> > BIOS
> > platform/x86: hp-bioscfg: warn on element type mismatch instead of
> > failing
> >
> > drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 11 ++++++++---
> > drivers/platform/x86/hp/hp-bioscfg/bioscfg.h | 3 +++
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c | 7 ++++---
> > 3 files changed, 15 insertions(+), 6 deletions(-)
> >
^ permalink raw reply [flat|nested] 6+ messages in thread