[PATCH 0/4] platform/x86/amd/hsmp: ACPI input hardening and data-plane readiness gating
From: Muralidhara M K
Date: Mon Jun 29 2026 - 03:49:18 EST
This series hardens the AMD HSMP ACPI driver against malformed firmware
and fixes a data-plane readiness race on multi-socket systems. It is
split out and reworked from the larger HSMP concurrency series.
Patches 1-2 validate ACPI input before it is used:
- hsmp_get_uid() passed the device UID straight to kstrtou16(uid + 2)
without checking it; a NULL or too-short UID could dereference NULL
or read past the end of the string.
- hsmp_read_acpi_dsd() dereferenced elements[0] and elements[1] of each
mailbox sub-package before confirming the package held two elements,
allowing an out-of-bounds read on a malformed _DSD.
These two are based on the review discussion at [1].
Patches 3-4 close a startup race on the lock-free data plane. On a
multi-socket system socket 0 exposes /dev/hsmp before later sockets
finish probing, so a message aimed at a socket still in bring-up could
pass the sock->dev readiness gate and dereference a NULL virt_base_addr:
- Patch 3 is a pure refactor that threads struct device explicitly
through the ACPI mailbox parsers so they no longer depend on sock->dev
being set early.
- Patch 4 publishes sock->dev last with smp_store_release() once the
mailbox and semaphore are initialized, and consumes it with
smp_load_acquire() in hsmp_send_message().
These two are based on the earlier submission at [2].
Each patch was built individually with W=1 (no new warnings) and passes
checkpatch.pl --strict and codespell.
[1] https://lore.kernel.org/platform-driver-x86/b723da76-6309-0cd4-59e0-5931231f585d@xxxxxxxxxxxxxxx/T/#u
[2] https://lore.kernel.org/platform-driver-x86/20260625123337.886435-5-muralidhara.mk@xxxxxxx/T/#u
Muralidhara M K (4):
platform/x86/amd/hsmp: Validate ACPI UID before parsing socket index
platform/x86/amd/hsmp: Validate _DSD mailbox sub-package element count
platform/x86/amd/hsmp: Pass struct device explicitly to ACPI mailbox
parsers
platform/x86/amd/hsmp: Gate the data plane on a fully initialized
socket
drivers/platform/x86/amd/hsmp/acpi.c | 53 ++++++++++++++++++++--------
drivers/platform/x86/amd/hsmp/hsmp.c | 12 +++++++
2 files changed, 50 insertions(+), 15 deletions(-)
--
2.43.0