public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
@ 2025-11-10 11:12 Armin Wolf
  2025-11-10 11:12 ` [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices Armin Wolf
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Armin Wolf @ 2025-11-10 11:12 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, lkml

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(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices
  2025-11-10 11:12 [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Armin Wolf
@ 2025-11-10 11:12 ` Armin Wolf
  2025-11-10 12:40   ` Ilpo Järvinen
  2025-11-10 11:12 ` [PATCH 2/2] platform/x86: msi-wmi-platform: Fix typo in WMI GUID Armin Wolf
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Armin Wolf @ 2025-11-10 11:12 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, lkml

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.

Fixes: 9c0beb6b29e7 ("platform/x86: wmi: Add MSI WMI Platform driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/Kconfig            |  1 +
 drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 46e62feeda3c..d96728a0f18d 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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
diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
index dc5e9878cb68..bd2687828a2e 100644
--- a/drivers/platform/x86/msi-wmi-platform.c
+++ b/drivers/platform/x86/msi-wmi-platform.c
@@ -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 <W_Armin@gmx.de>");
 MODULE_DESCRIPTION("MSI WMI platform features");
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] platform/x86: msi-wmi-platform: Fix typo in WMI GUID
  2025-11-10 11:12 [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Armin Wolf
  2025-11-10 11:12 ` [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices Armin Wolf
@ 2025-11-10 11:12 ` Armin Wolf
  2025-11-10 11:31 ` [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Antheas Kapenekakis
  2025-11-10 17:02 ` Antheas Kapenekakis
  3 siblings, 0 replies; 10+ messages in thread
From: Armin Wolf @ 2025-11-10 11:12 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel, lkml

The 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.

Fixes: 9c0beb6b29e7 ("platform/x86: wmi: Add MSI WMI Platform driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 Documentation/wmi/driver-development-guide.rst | 1 +
 drivers/platform/x86/msi-wmi-platform.c        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/wmi/driver-development-guide.rst b/Documentation/wmi/driver-development-guide.rst
index 99ef21fc1c1e..5680303ae314 100644
--- a/Documentation/wmi/driver-development-guide.rst
+++ b/Documentation/wmi/driver-development-guide.rst
@@ -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 },
          { }
   };
diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
index bd2687828a2e..e912fcc12d12 100644
--- a/drivers/platform/x86/msi-wmi-platform.c
+++ b/drivers/platform/x86/msi-wmi-platform.c
@@ -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
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
  2025-11-10 11:12 [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Armin Wolf
  2025-11-10 11:12 ` [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices Armin Wolf
  2025-11-10 11:12 ` [PATCH 2/2] platform/x86: msi-wmi-platform: Fix typo in WMI GUID Armin Wolf
@ 2025-11-10 11:31 ` Antheas Kapenekakis
  2025-11-10 13:03   ` Antheas Kapenekakis
  2025-11-10 17:02 ` Antheas Kapenekakis
  3 siblings, 1 reply; 10+ messages in thread
From: Antheas Kapenekakis @ 2025-11-10 11:31 UTC (permalink / raw)
  To: Armin Wolf; +Cc: hansg, ilpo.jarvinen, platform-driver-x86, linux-kernel

On Mon, 10 Nov 2025 at 12:13, Armin Wolf <W_Armin@gmx.de> wrote:
>
> 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?

> 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

> 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
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices
  2025-11-10 11:12 ` [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices Armin Wolf
@ 2025-11-10 12:40   ` Ilpo Järvinen
  2025-11-10 18:02     ` Armin Wolf
  0 siblings, 1 reply; 10+ messages in thread
From: Ilpo Järvinen @ 2025-11-10 12:40 UTC (permalink / raw)
  To: Armin Wolf; +Cc: Hans de Goede, platform-driver-x86, LKML, lkml

On Mon, 10 Nov 2025, Armin Wolf wrote:

> 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.

> 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 <W_Armin@gmx.de>
> ---
>  drivers/platform/x86/Kconfig            |  1 +
>  drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++-
>  2 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 46e62feeda3c..d96728a0f18d 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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
> diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
> index dc5e9878cb68..bd2687828a2e 100644
> --- a/drivers/platform/x86/msi-wmi-platform.c
> +++ b/drivers/platform/x86/msi-wmi-platform.c
> @@ -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 <W_Armin@gmx.de>");
>  MODULE_DESCRIPTION("MSI WMI platform features");
> 

-- 
 i.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
  2025-11-10 11:31 ` [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Antheas Kapenekakis
@ 2025-11-10 13:03   ` Antheas Kapenekakis
  0 siblings, 0 replies; 10+ messages in thread
From: Antheas Kapenekakis @ 2025-11-10 13:03 UTC (permalink / raw)
  To: Armin Wolf; +Cc: hansg, ilpo.jarvinen, platform-driver-x86, linux-kernel

On Mon, 10 Nov 2025 at 12:31, Antheas Kapenekakis <lkml@antheas.dev> wrote:
>
> On Mon, 10 Nov 2025 at 12:13, Armin Wolf <W_Armin@gmx.de> wrote:
> >
> > 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?
>
> > 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

>
> Thanks,
> Antheas
>
> > 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
> >
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
  2025-11-10 11:12 [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Armin Wolf
                   ` (2 preceding siblings ...)
  2025-11-10 11:31 ` [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Antheas Kapenekakis
@ 2025-11-10 17:02 ` Antheas Kapenekakis
  2025-11-10 17:14   ` Ilpo Järvinen
  3 siblings, 1 reply; 10+ messages in thread
From: Antheas Kapenekakis @ 2025-11-10 17:02 UTC (permalink / raw)
  To: Armin Wolf; +Cc: hansg, ilpo.jarvinen, platform-driver-x86, linux-kernel

On Mon, 10 Nov 2025 at 12:13, Armin Wolf <W_Armin@gmx.de> wrote:
>
> 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.

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 <lkml@antheas.dev>
Tested-by: Antheas Kapenekakis <lkml@antheas.dev>

> 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
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
  2025-11-10 17:02 ` Antheas Kapenekakis
@ 2025-11-10 17:14   ` Ilpo Järvinen
  2025-11-10 17:50     ` Armin Wolf
  0 siblings, 1 reply; 10+ messages in thread
From: Ilpo Järvinen @ 2025-11-10 17:14 UTC (permalink / raw)
  To: Antheas Kapenekakis; +Cc: Armin Wolf, Hans de Goede, platform-driver-x86, LKML

On Mon, 10 Nov 2025, Antheas Kapenekakis wrote:
> On Mon, 10 Nov 2025 at 12:13, Armin Wolf <W_Armin@gmx.de> wrote:
> >
> > 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.
> 
> 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 <lkml@antheas.dev>
> Tested-by: Antheas Kapenekakis <lkml@antheas.dev>

Thanks, I've added these tags to the commits.

-- 
 i.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading
  2025-11-10 17:14   ` Ilpo Järvinen
@ 2025-11-10 17:50     ` Armin Wolf
  0 siblings, 0 replies; 10+ messages in thread
From: Armin Wolf @ 2025-11-10 17:50 UTC (permalink / raw)
  To: Ilpo Järvinen, Antheas Kapenekakis
  Cc: Hans de Goede, platform-driver-x86, LKML

Am 10.11.25 um 18:14 schrieb Ilpo Järvinen:

> On Mon, 10 Nov 2025, Antheas Kapenekakis wrote:
>> On Mon, 10 Nov 2025 at 12:13, Armin Wolf <W_Armin@gmx.de> wrote:
>>> 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.
>> 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 <lkml@antheas.dev>
>> Tested-by: Antheas Kapenekakis <lkml@antheas.dev>
> Thanks, I've added these tags to the commits.
>
Thank you both for the quick reply :)

Thanks,
Armin Wolf


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices
  2025-11-10 12:40   ` Ilpo Järvinen
@ 2025-11-10 18:02     ` Armin Wolf
  0 siblings, 0 replies; 10+ messages in thread
From: Armin Wolf @ 2025-11-10 18:02 UTC (permalink / raw)
  To: Ilpo Järvinen, Corentin Chary, Luke D . Jones
  Cc: Hans de Goede, platform-driver-x86, LKML, lkml

Am 10.11.25 um 13:40 schrieb Ilpo Järvinen:

> On Mon, 10 Nov 2025, Armin Wolf wrote:
>
>> 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

>
>> 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 <W_Armin@gmx.de>
>> ---
>>   drivers/platform/x86/Kconfig            |  1 +
>>   drivers/platform/x86/msi-wmi-platform.c | 41 ++++++++++++++++++++++++-
>>   2 files changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>> index 46e62feeda3c..d96728a0f18d 100644
>> --- a/drivers/platform/x86/Kconfig
>> +++ b/drivers/platform/x86/Kconfig
>> @@ -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
>> diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
>> index dc5e9878cb68..bd2687828a2e 100644
>> --- a/drivers/platform/x86/msi-wmi-platform.c
>> +++ b/drivers/platform/x86/msi-wmi-platform.c
>> @@ -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 <W_Armin@gmx.de>");
>>   MODULE_DESCRIPTION("MSI WMI platform features");
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-11-10 18:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 11:12 [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Armin Wolf
2025-11-10 11:12 ` [PATCH 1/2] platform/x86: msi-wmi-platform: Only load on MSI devices Armin Wolf
2025-11-10 12:40   ` Ilpo Järvinen
2025-11-10 18:02     ` Armin Wolf
2025-11-10 11:12 ` [PATCH 2/2] platform/x86: msi-wmi-platform: Fix typo in WMI GUID Armin Wolf
2025-11-10 11:31 ` [PATCH 0/2] platform/x86: msi-wmi-platform: Fix autoloading Antheas Kapenekakis
2025-11-10 13:03   ` Antheas Kapenekakis
2025-11-10 17:02 ` Antheas Kapenekakis
2025-11-10 17:14   ` Ilpo Järvinen
2025-11-10 17:50     ` Armin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox