[PATCH v5 0/4] platform/x86: hp-bioscfg: fix ACPI package handling on HP EliteBook 840 G2

Muhammad Bilal posted 4 patches 2 weeks, 4 days ago
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c     | 16 +++++++++++++---
drivers/platform/x86/hp/hp-bioscfg/bioscfg.h     |  8 ++++++++
.../platform/x86/hp/hp-bioscfg/enum-attributes.c | 11 +++++++----
.../platform/x86/hp/hp-bioscfg/int-attributes.c  |  4 +++-
.../x86/hp/hp-bioscfg/order-list-attributes.c    |  8 +++++---
.../x86/hp/hp-bioscfg/passwdobj-attributes.c     |  6 ++++--
.../x86/hp/hp-bioscfg/string-attributes.c        |  4 +++-
7 files changed, 43 insertions(+), 14 deletions(-)
[PATCH v5 0/4] platform/x86: hp-bioscfg: fix ACPI package handling on HP EliteBook 840 G2
Posted by Muhammad Bilal 2 weeks, 4 days ago
This series fixes attribute enumeration failures on the HP EliteBook 840
G2 (BIOS M71 Ver. 01.31), whose BIOS returns shorter ACPI WMI packages
than hp_init_bios_package_attribute() currently accepts, plus occasional
type-mismatched elements after a failed WMI query.

Patches 1 and 2 are prerequisites: they make each per-type parser bound
itself on the real, validated package count instead of an incorrect value
derived from the NAME string's length. Both are no-ops today, since
every package the driver currently handles already meets the old
minimum size. They matter because patch 3 depends on them: once the
minimum size check is relaxed, the elements array can genuinely be
smaller than a parser's fixed per-type count, and without patches 1 and
2 this would result in an out-of-bounds heap read.

Patch 3 relaxes that minimum size check to accept packages missing
optional type-specific fields, as long as the common fields (NAME
through SECURITY_LEVEL) are present.

Patch 4 changes a type mismatch on one element from aborting the whole
attribute to warning and skipping the offending element, matching the
existing handling of unsupported element types.

Patches 1 through 3 are intended to be applied together, as patch 3
depends on the preparatory fixes in patches 1 and 2.

v4: https://lore.kernel.org/all/20260708154846.12356-1-meatuni001@gmail.com/

Changes since v4:
- Patch 1: added missing kerneldoc @foo_count entries for the five new
  parameters. (Ilpo)
- No other code changes.

Changes since v3:
- Patch 1: dropped the Fixes: tag (the patch does not fix anything on
  its own; Cc: stable is enough for stable to pull it in as a series
  dependency) and reworded the forward reference from "a later patch"
  to "an upcoming change". (Ilpo)
- Patch 2: dropped the Fixes: tag and reworded the forward reference as
  in patch 1, plus dropped the redundant sentence describing the
  out-of-bounds read. (Ilpo)
- No code changes; commit-message wording only.

Changes since v2:
- Split the single "pass validated count and bound ordered list
  parsing" patch into two: patch 1 fixes the count value passed to
  each wrapper, patch 2 adds the missing elem < count bound to the
  ordered list parser. (Ilpo)
- Rewrote patch 1's commit message to lead with the bug instead of
  quoting code, and to state up front that a later patch depends on
  it. (Ilpo)
- Reworded "thread the count down" and "guess at it" phrasing. (Ilpo)

Muhammad Bilal (4):
  platform/x86: hp-bioscfg: pass validated element count to package
    parsers
  platform/x86: hp-bioscfg: bound ordered-list parsing by the package
    count
  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     | 16 +++++++++++++---
 drivers/platform/x86/hp/hp-bioscfg/bioscfg.h     |  8 ++++++++
 .../platform/x86/hp/hp-bioscfg/enum-attributes.c | 11 +++++++----
 .../platform/x86/hp/hp-bioscfg/int-attributes.c  |  4 +++-
 .../x86/hp/hp-bioscfg/order-list-attributes.c    |  8 +++++---
 .../x86/hp/hp-bioscfg/passwdobj-attributes.c     |  6 ++++--
 .../x86/hp/hp-bioscfg/string-attributes.c        |  4 +++-
 7 files changed, 43 insertions(+), 14 deletions(-)

-- 
2.55.0
Re: [PATCH v5 0/4] platform/x86: hp-bioscfg: fix ACPI package handling on HP EliteBook 840 G2
Posted by Ilpo Järvinen 2 weeks, 4 days ago
On Thu, 09 Jul 2026 21:58:55 +0500, Muhammad Bilal wrote:

> This series fixes attribute enumeration failures on the HP EliteBook 840
> G2 (BIOS M71 Ver. 01.31), whose BIOS returns shorter ACPI WMI packages
> than hp_init_bios_package_attribute() currently accepts, plus occasional
> type-mismatched elements after a failed WMI query.
> 
> Patches 1 and 2 are prerequisites: they make each per-type parser bound
> itself on the real, validated package count instead of an incorrect value
> derived from the NAME string's length. Both are no-ops today, since
> every package the driver currently handles already meets the old
> minimum size. They matter because patch 3 depends on them: once the
> minimum size check is relaxed, the elements array can genuinely be
> smaller than a parser's fixed per-type count, and without patches 1 and
> 2 this would result in an out-of-bounds heap read.
> 
> [...]

Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent cycle or is clearly a regression
fix.

The list of commits applied:
[1/4] platform/x86: hp-bioscfg: pass validated element count to package parsers
      commit: e0ddfd77c0c320b7d12b6c9169303b140b798775
[2/4] platform/x86: hp-bioscfg: bound ordered-list parsing by the package count
      commit: 1d143d78299d0eb4536698bf98c1815ec69f22a9
[3/4] platform/x86: hp-bioscfg: accept reduced ACPI packages from older HP BIOS
      commit: 40e10e6cc8f70c041431a1e30186807e28ec46e0
[4/4] platform/x86: hp-bioscfg: warn on element type mismatch instead of failing
      commit: b0e2af3ec94e0431adb59d9f249ebbd3b7285158

--
 i.