Skip to content

platform/wmi: Use WMI driver core for size checks

Armin Wolf lkml platform-driver-x86 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6platform/wmi: Add wmidev_invoke_procedure()Documentation/wmi/driver-development-guide.rst drivers/platform/wmi/core.c include/linux/wmi.h+49 -10 replies
2/6platform/wmi: Convert drivers to use wmidev_invoke_procedure()drivers/platform/x86/bitland-mifs-wmi.c drivers/platform/x86/intel/wmi/thunderbolt.c+10 -90 replies
3/6platform/wmi: Prepare to reject undersized unmarshalling resultsdrivers/platform/wmi/core.c drivers/platform/wmi/internal.h drivers/platform/wmi/marshalling.c +1 more+32 -70 replies
4/6platform/wmi: Extend wmidev_invoke_method() to reject undersized datadrivers/platform/wmi/core.c drivers/platform/x86/bitland-mifs-wmi.c include/linux/wmi.h+14 -220 replies
5/6platform/wmi: Extend wmidev_query_block() to reject undersized datadrivers/platform/wmi/core.c drivers/platform/x86/intel/wmi/sbl-fw-update.c drivers/platform/x86/wmi-bmof.c +1 more+10 -120 replies
6/6platform/wmi: Replace .no_notify_data with .min_event_sizeDocumentation/wmi/driver-development-guide.rst drivers/platform/wmi/core.c drivers/platform/x86/bitland-mifs-wmi.c +10 more+29 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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(-)
Signature · 1 line
2.39.5