platform/x86: msi-wmi-platform: Fix autoloading
Armin Wolf
maintainercover platform/x86: msi-wmi-platform: Fix autoloading
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.
Compile-tested only.
Armin Wolf (2):
platform/x86: msi-wmi-platform: Only load on MSI devices platform/x86: msi-wmi-platform: Fix typo in WMI GUID
.../wmi/driver-development-guide.rst | 1 + drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 43 ++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.5
Armin Wolf
maintainerPATCH 1/2 platform/x86: msi-wmi-platform: Only load on MSI devices
It turns out that the GUID used by the msi-wmi-platform driver (ABBC0F60-8EA1-11D1-00A0-C90629100000) is not unique, but was instead copied from the WIndows Driver Samples. This means that this driver could load on devices from other manufacturers that also copied this GUID, potentially causing hardware errors.
Prevent this by only loading on devices whitelisted via DMI. The DMI matches where taken from the msi-ec driver.
--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -0
@@ -545,6 +545,7 @@ config MSI_WMI config MSI_WMI_PLATFORM tristate "MSI WMI Platform features" depends on ACPI_WMI + depends on DMI depends on HWMON help Say Y here if you want to have support for WMI-based platform features
drivers/platform/x86/msi-wmi-platform.c +40 -1
53 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices
Quoted 5 lines · Armin Wolf
It turns out that the GUID used by the msi-wmi-platform driver (ABBC0F60-8EA1-11D1-00A0-C90629100000) is not unique, but was instead copied from the WIndows Driver Samples. This means that this driver could load on devices from other manufacturers that also copied this GUID, potentially causing hardware errors.
How unclever of them to copy-paste an unique identifier from an example...
I've applied this series to the review-ilpo-fixes branch.
Quoted 82 lines
Prevent this by only loading on devices whitelisted via DMI. The DMI matches where taken from the msi-ec driver.
Fixes 9c0beb6b29e7 ("platform/x86: wmi: Add MSI WMI Platform driver")Signed-off-by Armin Wolf <[email protected]>--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)drivers/platform/x86/Kconfig +1
-0@@ -545,6 +545,7 @@ config MSI_WMI config MSI_WMI_PLATFORM tristate "MSI WMI Platform features" depends on ACPI_WMI + depends on DMI depends on HWMON help Say Y here if you want to have support for WMI-based platform featuresdrivers/platform/x86/msi-wmi-platform.c +40
-1@@ -14,6 +14,7 @@#include <linux/debugfs.h> #include <linux/device.h> #include <linux/device/driver.h> +#include <linux/dmi.h> #include <linux/errno.h> #include <linux/hwmon.h> #include <linux/kernel.h> @@ -448,7 +449,45 @@ static struct wmi_driver msi_wmi_platform_driver = { .probe = msi_wmi_platform_probe, .no_singleton = true, }; -module_wmi_driver (msi_wmi_platform_driver); + +/* +* MSI reused the WMI GUID from the WMI-ACPI sample code provided by Microsoft, +* so other manufacturers might use it as well for their WMI-ACPI implementations. +*/ +static const struct dmi_system_id msi_wmi_platform_whitelist[]__initconst = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Micro-Star International" ), + }, + }, + { } +}; + +static int __init msi_wmi_platform_module_init (void ) +{ +if (!dmi_check_system (msi_wmi_platform_whitelist)) { +if (!force) +return -ENODEV ; + +pr_warn ("Ignoring DMI whitelist\n" ); + } + +return wmi_driver_register (&msi_wmi_platform_driver); +} + +static void __exit msi_wmi_platform_module_exit(void) +{ +wmi_driver_unregister (&msi_wmi_platform_driver); +} + +module_init (msi_wmi_platform_module_init); +module_exit (msi_wmi_platform_module_exit); +MODULE_AUTHOR ("Armin Wolf <[email protected]>" );MODULE_DESCRIPTION ("MSI WMI platform features" );
Signature · 1 line
i.
Armin Wolf
maintainerRe: [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices
Am 10.11.25 um 13:40 schrieb Ilpo Järvinen:
Quoted 10 lines · Armin Wolf
Quoted 6 lines
It turns out that the GUID used by the msi-wmi-platform driver (ABBC0F60-8EA1-11D1-00A0-C90629100000) is not unique, but was instead copied from the WIndows Driver Samples. This means that this driver could load on devices from other manufacturers that also copied this GUID, potentially causing hardware errors.
How unclever of them to copy-paste an unique identifier from an example...
I've applied this series to the review-ilpo-fixes branch.
Thank you. FYI, it seems that many manufacturers are doing this, for example the eeepc-wmi driver also uses a GUID from the driver samples. I do not know however if said driver has any safeguards against this.
I have CCed the maintainers of the eeepc-wmi driver so that they know of this.
Thanks,
Armin Wolf
Quoted 83 lines
Quoted 83 lines
Prevent this by only loading on devices whitelisted via DMI. The DMI matches where taken from the msi-ec driver.
Fixes 9c0beb6b29e7 ("platform/x86: wmi: Add MSI WMI Platform driver")Signed-off-by Armin Wolf <[email protected]>--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-)drivers/platform/x86/Kconfig +1
-0@@ -545,6 +545,7 @@ config MSI_WMI config MSI_WMI_PLATFORM tristate "MSI WMI Platform features" depends on ACPI_WMI + depends on DMI depends on HWMON help Say Y here if you want to have support for WMI-based platform featuresdrivers/platform/x86/msi-wmi-platform.c +40
-1@@ -14,6 +14,7 @@#include <linux/debugfs.h> #include <linux/device.h> #include <linux/device/driver.h> +#include <linux/dmi.h> #include <linux/errno.h> #include <linux/hwmon.h> #include <linux/kernel.h> @@ -448,7 +449,45 @@ static struct wmi_driver msi_wmi_platform_driver = { .probe = msi_wmi_platform_probe, .no_singleton = true, }; -module_wmi_driver (msi_wmi_platform_driver); + +/* +* MSI reused the WMI GUID from the WMI-ACPI sample code provided by Microsoft, +* so other manufacturers might use it as well for their WMI-ACPI implementations. +*/ +static const struct dmi_system_id msi_wmi_platform_whitelist[]__initconst = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT" ), + }, + }, + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Micro-Star International" ), + }, + }, + { } +}; + +static int __init msi_wmi_platform_module_init (void ) +{ +if (!dmi_check_system (msi_wmi_platform_whitelist)) { +if (!force) +return -ENODEV ; + +pr_warn ("Ignoring DMI whitelist\n" ); + } + +return wmi_driver_register (&msi_wmi_platform_driver); +} + +static void __exit msi_wmi_platform_module_exit(void) +{ +wmi_driver_unregister (&msi_wmi_platform_driver); +} + +module_init (msi_wmi_platform_module_init); +module_exit (msi_wmi_platform_module_exit); +MODULE_AUTHOR ("Armin Wolf <[email protected]>" );MODULE_DESCRIPTION ("MSI WMI platform features" );
Armin Wolf
maintainerPATCH 2/2 platform/x86: msi-wmi-platform: Fix typo in WMI GUID
In reply to Armin WolfThe WMI driver core only supports GUID strings containing only uppercase characters, however the GUID string used by the msi-wmi-platform driver contains a single lowercase character. This prevents the WMI driver core from matching said driver to its WMI device.
Fix this by turning the lowercase character into a uppercase character. Also update the WMI driver development guide to warn about this.
--- Documentation/wmi/driver-development-guide.rst | 1 + drivers/platform/x86/msi-wmi-platform.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Documentation/wmi/driver-development-guide.rst +1 -0
@@ -54,6 +54,7 @@ to matching WMI devices using a struct wmi_device_id table: :: static const struct wmi_device_id foo_id_table[] = { + /* Only use uppercase letters! */ { "936DA01F-9ABD-4D9D-80C7-02AF85C822A8", NULL }, { } };
drivers/platform/x86/msi-wmi-platform.c +1 -1
@@ -29,7 +29,7 @@#define DRIVER_NAME "msi-wmi-platform" -#define MSI_PLATFORM_GUID "ABBC0F6E-8EA1-11d1-00A0-C90629100000" +#define MSI_PLATFORM_GUID "ABBC0F6E-8EA1-11D1-00A0-C90629100000"#define MSI_WMI_PLATFORM_INTERFACE_VERSION 2
Signature · 1 line
2.39.5
Quoted 7 lines · Armin Wolf
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Can you add a closes with a link to that discussion and a reported by?
Quoted 6 lines
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.
Compile-tested only.
I will try to test this in one to two days and will add a tested by.
Thanks,
Antheas
Quoted 13 lines
Armin Wolf (2):
platform/x86: msi-wmi-platform: Only load on MSI devices platform/x86: msi-wmi-platform: Fix typo in WMI GUID.../wmi/driver-development-guide.rst | 1 + drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 43 ++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-)--
2.39.5
Quoted 12 lines · Antheas Kapenekakis
Quoted 7 lines · Armin Wolf
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Can you add a closes with a link to that discussion and a reported by?
Quoted 8 lines
Quoted 6 lines
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.
Compile-tested only.
I will try to test this in one to two days and will add a tested by.
Hi Ilpo,
did you receive this email? I was getting some bounces from your email host last week so Im sending this from my gmail
I can test this series later today and add a Tested-by as it's only compile tested.
Antheas
Quoted 17 lines
Thanks,
AntheasQuoted 13 lines
Armin Wolf (2):
platform/x86: msi-wmi-platform: Only load on MSI devices platform/x86: msi-wmi-platform: Fix typo in WMI GUID.../wmi/driver-development-guide.rst | 1 + drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 43 ++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-)--
2.39.5
Quoted 12 lines · Armin Wolf
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.
Quoted 1 line
Compile-tested only.
Works great. Module loads normally without intervention from userspace.
I could not find an online reference for our discussion so I omit the close tag.
Replying to the cover applies to all patches if my understanding is correct.
Quoted 13 lines
Armin Wolf (2):
platform/x86: msi-wmi-platform: Only load on MSI devices platform/x86: msi-wmi-platform: Fix typo in WMI GUID.../wmi/driver-development-guide.rst | 1 + drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/msi-wmi-platform.c | 43 ++++++++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-)--
2.39.5
Ilpo Järvinen
maintainerQuoted 15 lines · Antheas Kapenekakis
Quoted 12 lines · Armin Wolf
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.Quoted 1 line
Compile-tested only.
Quoted 8 lines
Works great. Module loads normally without intervention from userspace.
I could not find an online reference for our discussion so I omit the close tag.
Replying to the cover applies to all patches if my understanding is correct.
Reported-by Antheas Kapenekakis <[email protected]>Tested-by Antheas Kapenekakis <[email protected]>
Thanks, I've added these tags to the commits.
Signature · 1 line
i.
Armin Wolf
maintainerAm 10.11.25 um 18:14 schrieb Ilpo Järvinen:
Quoted 16 lines · Antheas Kapenekakis
Quoted 15 lines · Armin Wolf
Quoted 11 lines
As already noted by Antheas Kapenekakis back in May, the msi-wmi-platform driver fails to automatically load on MSI Claw devices. Back then i suspected an issue with the device firmware, however i just found out that i made a silly mistake when specifying the GUID string of the driver, preventing the WMI driver core from matching it to its WMI device.
Additionally i noticed that said GUID was copied from the Windows driver samples, meaning that it might be shared across different vendors. Because of this we have to prevent this driver from loading on non-MSI devices.Quoted 1 line
Compile-tested only.
Works great. Module loads normally without intervention from userspace.
Quoted 8 lines
Quoted 6 lines
I could not find an online reference for our discussion so I omit the close tag.
Replying to the cover applies to all patches if my understanding is correct.
Reported-by Antheas Kapenekakis <[email protected]>Tested-by Antheas Kapenekakis <[email protected]>Thanks, I've added these tags to the commits.
Thank you both for the quick reply :)
Thanks,
Armin Wolf