[PATCH 0/6] platform/wmi: Use WMI driver core for size checks

From: Armin Wolf

Date: Mon Apr 06 2026 - 17:18:10 EST


As suggested by Ilpo, the buffer-based WMI API should assist drivers
in verifying the size of buffers received from WMI methods or blocks.
This patch series implements this suggestion by allowing drivers to
use the WMI driver core to automatically reject undersized buffers.

This avoids a memory allocation for undersized data and simplifies
the size checking code in most WMI drivers. All patches except the
last one have been tested using synthetic ACPI tables and appear to
work just fine.

Armin Wolf (6):
platform/wmi: Add wmidev_invoke_procedure()
platform/wmi: Convert drivers to use wmidev_invoke_procedure()
platform/wmi: Prepare to reject undersized unmarshalling results
platform/wmi: Extend wmidev_invoke_method() to reject undersized data
platform/wmi: Extend wmidev_query_block() to reject undersized data
platform/wmi: Replace .no_notify_data with .min_event_size

.../wmi/driver-development-guide.rst | 11 ++-
drivers/platform/wmi/core.c | 89 ++++++++++++++-----
drivers/platform/wmi/internal.h | 3 +-
drivers/platform/wmi/marshalling.c | 6 +-
.../platform/wmi/tests/marshalling_kunit.c | 24 ++++-
drivers/platform/x86/bitland-mifs-wmi.c | 24 ++---
drivers/platform/x86/dell/dell-wmi-base.c | 1 +
.../platform/x86/intel/wmi/sbl-fw-update.c | 7 +-
drivers/platform/x86/intel/wmi/thunderbolt.c | 2 +-
drivers/platform/x86/lenovo/ideapad-laptop.c | 1 +
drivers/platform/x86/lenovo/wmi-camera.c | 1 +
drivers/platform/x86/lenovo/wmi-events.c | 1 +
drivers/platform/x86/lenovo/ymc.c | 1 +
drivers/platform/x86/lenovo/yogabook.c | 2 +-
drivers/platform/x86/redmi-wmi.c | 1 +
drivers/platform/x86/uniwill/uniwill-wmi.c | 1 +
drivers/platform/x86/wmi-bmof.c | 2 +-
drivers/platform/x86/xiaomi-wmi.c | 1 +
include/linux/wmi.h | 15 +++-
19 files changed, 135 insertions(+), 58 deletions(-)

--
2.39.5