* [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
@ 2016-08-25 18:50 Azael Avalos
2016-08-28 17:00 ` Darren Hart
0 siblings, 1 reply; 6+ messages in thread
From: Azael Avalos @ 2016-08-25 18:50 UTC (permalink / raw)
To: Darren Hart, platform-driver-x86, linux-kernel; +Cc: Azael Avalos
Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
is not Toshiba specific, and as such, the driver was being loaded
on non Toshiba laptops too.
This patch adds a DMI matching list checking for TOSHIBA as the
vendor, refusing to load if it is not.
Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
better reflect that such GUID is not a Toshiba specific one.
Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
---
Hi Darren,
I was waiting on input from the bug above, but haven't received an
answer (as of yet), so I decided to send this to the mailing list
for feedback as to whether this is the correct approach for this
issue.
drivers/platform/x86/toshiba-wmi.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c
index feac457..0c92887 100644
--- a/drivers/platform/x86/toshiba-wmi.c
+++ b/drivers/platform/x86/toshiba-wmi.c
@@ -24,14 +24,15 @@
#include <linux/acpi.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
+#include <linux/dmi.h>
MODULE_AUTHOR("Azael Avalos");
MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver");
MODULE_LICENSE("GPL");
-#define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
+#define WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
-MODULE_ALIAS("wmi:"TOSHIBA_WMI_EVENT_GUID);
+MODULE_ALIAS("wmi:"WMI_EVENT_GUID);
static struct input_dev *toshiba_wmi_input_dev;
@@ -63,6 +64,16 @@ static void toshiba_wmi_notify(u32 value, void *context)
kfree(response.pointer);
}
+static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = {
+ {
+ .ident = "Toshiba laptop",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+ },
+ },
+ {}
+};
+
static int __init toshiba_wmi_input_setup(void)
{
acpi_status status;
@@ -81,7 +92,7 @@ static int __init toshiba_wmi_input_setup(void)
if (err)
goto err_free_dev;
- status = wmi_install_notify_handler(TOSHIBA_WMI_EVENT_GUID,
+ status = wmi_install_notify_handler(WMI_EVENT_GUID,
toshiba_wmi_notify, NULL);
if (ACPI_FAILURE(status)) {
err = -EIO;
@@ -95,7 +106,7 @@ static int __init toshiba_wmi_input_setup(void)
return 0;
err_remove_notifier:
- wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
+ wmi_remove_notify_handler(WMI_EVENT_GUID);
err_free_keymap:
sparse_keymap_free(toshiba_wmi_input_dev);
err_free_dev:
@@ -105,7 +116,7 @@ static int __init toshiba_wmi_input_setup(void)
static void toshiba_wmi_input_destroy(void)
{
- wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
+ wmi_remove_notify_handler(WMI_EVENT_GUID);
sparse_keymap_free(toshiba_wmi_input_dev);
input_unregister_device(toshiba_wmi_input_dev);
}
@@ -114,7 +125,8 @@ static int __init toshiba_wmi_init(void)
{
int ret;
- if (!wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
+ if (!wmi_has_guid(WMI_EVENT_GUID) ||
+ !dmi_check_system(toshiba_wmi_dmi_table))
return -ENODEV;
ret = toshiba_wmi_input_setup();
@@ -130,7 +142,7 @@ static int __init toshiba_wmi_init(void)
static void __exit toshiba_wmi_exit(void)
{
- if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
+ if (wmi_has_guid(WMI_EVENT_GUID))
toshiba_wmi_input_destroy();
}
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
2016-08-25 18:50 [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops Azael Avalos
@ 2016-08-28 17:00 ` Darren Hart
2016-10-12 16:26 ` Azael Avalos
0 siblings, 1 reply; 6+ messages in thread
From: Darren Hart @ 2016-08-28 17:00 UTC (permalink / raw)
To: Azael Avalos; +Cc: platform-driver-x86, linux-kernel, carlos
On Thu, Aug 25, 2016 at 12:50:55PM -0600, Azael Avalos wrote:
> Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
> is not Toshiba specific, and as such, the driver was being loaded
> on non Toshiba laptops too.
>
> This patch adds a DMI matching list checking for TOSHIBA as the
> vendor, refusing to load if it is not.
>
> Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
> better reflect that such GUID is not a Toshiba specific one.
>
> Cc: <stable@vger.kernel.org> # 4.4+
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
> Hi Darren,
>
> I was waiting on input from the bug above, but haven't received an
> answer (as of yet), so I decided to send this to the mailing list
> for feedback as to whether this is the correct approach for this
> issue.
Thanks. Let's see if Carlos (wmi.c author) has an opinion...
Carlos?
>
> drivers/platform/x86/toshiba-wmi.c | 26 +++++++++++++++++++-------
> 1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c
> index feac457..0c92887 100644
> --- a/drivers/platform/x86/toshiba-wmi.c
> +++ b/drivers/platform/x86/toshiba-wmi.c
> @@ -24,14 +24,15 @@
> #include <linux/acpi.h>
> #include <linux/input.h>
> #include <linux/input/sparse-keymap.h>
> +#include <linux/dmi.h>
>
> MODULE_AUTHOR("Azael Avalos");
> MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver");
> MODULE_LICENSE("GPL");
>
> -#define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
> +#define WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
>
> -MODULE_ALIAS("wmi:"TOSHIBA_WMI_EVENT_GUID);
> +MODULE_ALIAS("wmi:"WMI_EVENT_GUID);
>
> static struct input_dev *toshiba_wmi_input_dev;
>
> @@ -63,6 +64,16 @@ static void toshiba_wmi_notify(u32 value, void *context)
> kfree(response.pointer);
> }
>
> +static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = {
> + {
> + .ident = "Toshiba laptop",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
> + },
> + },
> + {}
> +};
> +
> static int __init toshiba_wmi_input_setup(void)
> {
> acpi_status status;
> @@ -81,7 +92,7 @@ static int __init toshiba_wmi_input_setup(void)
> if (err)
> goto err_free_dev;
>
> - status = wmi_install_notify_handler(TOSHIBA_WMI_EVENT_GUID,
> + status = wmi_install_notify_handler(WMI_EVENT_GUID,
> toshiba_wmi_notify, NULL);
> if (ACPI_FAILURE(status)) {
> err = -EIO;
> @@ -95,7 +106,7 @@ static int __init toshiba_wmi_input_setup(void)
> return 0;
>
> err_remove_notifier:
> - wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
> + wmi_remove_notify_handler(WMI_EVENT_GUID);
> err_free_keymap:
> sparse_keymap_free(toshiba_wmi_input_dev);
> err_free_dev:
> @@ -105,7 +116,7 @@ static int __init toshiba_wmi_input_setup(void)
>
> static void toshiba_wmi_input_destroy(void)
> {
> - wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
> + wmi_remove_notify_handler(WMI_EVENT_GUID);
> sparse_keymap_free(toshiba_wmi_input_dev);
> input_unregister_device(toshiba_wmi_input_dev);
> }
> @@ -114,7 +125,8 @@ static int __init toshiba_wmi_init(void)
> {
> int ret;
>
> - if (!wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
> + if (!wmi_has_guid(WMI_EVENT_GUID) ||
> + !dmi_check_system(toshiba_wmi_dmi_table))
> return -ENODEV;
>
> ret = toshiba_wmi_input_setup();
> @@ -130,7 +142,7 @@ static int __init toshiba_wmi_init(void)
>
> static void __exit toshiba_wmi_exit(void)
> {
> - if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
> + if (wmi_has_guid(WMI_EVENT_GUID))
> toshiba_wmi_input_destroy();
> }
>
> --
> 2.9.3
>
>
--
Darren Hart
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
2016-08-28 17:00 ` Darren Hart
@ 2016-10-12 16:26 ` Azael Avalos
2016-10-19 20:26 ` Darren Hart
0 siblings, 1 reply; 6+ messages in thread
From: Azael Avalos @ 2016-10-12 16:26 UTC (permalink / raw)
To: Darren Hart
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
carlos
*ping*
2016-08-28 11:00 GMT-06:00 Darren Hart <dvhart@infradead.org>:
> On Thu, Aug 25, 2016 at 12:50:55PM -0600, Azael Avalos wrote:
>> Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
>> is not Toshiba specific, and as such, the driver was being loaded
>> on non Toshiba laptops too.
>>
>> This patch adds a DMI matching list checking for TOSHIBA as the
>> vendor, refusing to load if it is not.
>>
>> Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
>> better reflect that such GUID is not a Toshiba specific one.
>>
>> Cc: <stable@vger.kernel.org> # 4.4+
>> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
>> ---
>> Hi Darren,
>>
>> I was waiting on input from the bug above, but haven't received an
>> answer (as of yet), so I decided to send this to the mailing list
>> for feedback as to whether this is the correct approach for this
>> issue.
>
> Thanks. Let's see if Carlos (wmi.c author) has an opinion...
>
> Carlos?
Any input on this?
>
>>
>> drivers/platform/x86/toshiba-wmi.c | 26 +++++++++++++++++++-------
>> 1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c
>> index feac457..0c92887 100644
>> --- a/drivers/platform/x86/toshiba-wmi.c
>> +++ b/drivers/platform/x86/toshiba-wmi.c
>> @@ -24,14 +24,15 @@
>> #include <linux/acpi.h>
>> #include <linux/input.h>
>> #include <linux/input/sparse-keymap.h>
>> +#include <linux/dmi.h>
>>
>> MODULE_AUTHOR("Azael Avalos");
>> MODULE_DESCRIPTION("Toshiba WMI Hotkey Driver");
>> MODULE_LICENSE("GPL");
>>
>> -#define TOSHIBA_WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
>> +#define WMI_EVENT_GUID "59142400-C6A3-40FA-BADB-8A2652834100"
>>
>> -MODULE_ALIAS("wmi:"TOSHIBA_WMI_EVENT_GUID);
>> +MODULE_ALIAS("wmi:"WMI_EVENT_GUID);
>>
>> static struct input_dev *toshiba_wmi_input_dev;
>>
>> @@ -63,6 +64,16 @@ static void toshiba_wmi_notify(u32 value, void *context)
>> kfree(response.pointer);
>> }
>>
>> +static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = {
>> + {
>> + .ident = "Toshiba laptop",
>> + .matches = {
>> + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
>> + },
>> + },
>> + {}
>> +};
>> +
>> static int __init toshiba_wmi_input_setup(void)
>> {
>> acpi_status status;
>> @@ -81,7 +92,7 @@ static int __init toshiba_wmi_input_setup(void)
>> if (err)
>> goto err_free_dev;
>>
>> - status = wmi_install_notify_handler(TOSHIBA_WMI_EVENT_GUID,
>> + status = wmi_install_notify_handler(WMI_EVENT_GUID,
>> toshiba_wmi_notify, NULL);
>> if (ACPI_FAILURE(status)) {
>> err = -EIO;
>> @@ -95,7 +106,7 @@ static int __init toshiba_wmi_input_setup(void)
>> return 0;
>>
>> err_remove_notifier:
>> - wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
>> + wmi_remove_notify_handler(WMI_EVENT_GUID);
>> err_free_keymap:
>> sparse_keymap_free(toshiba_wmi_input_dev);
>> err_free_dev:
>> @@ -105,7 +116,7 @@ static int __init toshiba_wmi_input_setup(void)
>>
>> static void toshiba_wmi_input_destroy(void)
>> {
>> - wmi_remove_notify_handler(TOSHIBA_WMI_EVENT_GUID);
>> + wmi_remove_notify_handler(WMI_EVENT_GUID);
>> sparse_keymap_free(toshiba_wmi_input_dev);
>> input_unregister_device(toshiba_wmi_input_dev);
>> }
>> @@ -114,7 +125,8 @@ static int __init toshiba_wmi_init(void)
>> {
>> int ret;
>>
>> - if (!wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
>> + if (!wmi_has_guid(WMI_EVENT_GUID) ||
>> + !dmi_check_system(toshiba_wmi_dmi_table))
>> return -ENODEV;
>>
>> ret = toshiba_wmi_input_setup();
>> @@ -130,7 +142,7 @@ static int __init toshiba_wmi_init(void)
>>
>> static void __exit toshiba_wmi_exit(void)
>> {
>> - if (wmi_has_guid(TOSHIBA_WMI_EVENT_GUID))
>> + if (wmi_has_guid(WMI_EVENT_GUID))
>> toshiba_wmi_input_destroy();
>> }
>>
>> --
>> 2.9.3
>>
>>
>
> --
> Darren Hart
> Intel Open Source Technology Center
--
-- El mundo apesta y vosotros apestais tambien --
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
2016-10-12 16:26 ` Azael Avalos
@ 2016-10-19 20:26 ` Darren Hart
2016-10-19 23:27 ` Azael Avalos
0 siblings, 1 reply; 6+ messages in thread
From: Darren Hart @ 2016-10-19 20:26 UTC (permalink / raw)
To: Azael Avalos
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
carlos
On Wed, Oct 12, 2016 at 10:26:43AM -0600, Azael Avalos wrote:
> *ping*
>
> 2016-08-28 11:00 GMT-06:00 Darren Hart <dvhart@infradead.org>:
> > On Thu, Aug 25, 2016 at 12:50:55PM -0600, Azael Avalos wrote:
> >> Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
> >> is not Toshiba specific, and as such, the driver was being loaded
> >> on non Toshiba laptops too.
> >>
> >> This patch adds a DMI matching list checking for TOSHIBA as the
> >> vendor, refusing to load if it is not.
> >>
> >> Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
> >> better reflect that such GUID is not a Toshiba specific one.
> >>
> >> Cc: <stable@vger.kernel.org> # 4.4+
> >> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> >> ---
> >> Hi Darren,
> >>
> >> I was waiting on input from the bug above, but haven't received an
> >> answer (as of yet), so I decided to send this to the mailing list
> >> for feedback as to whether this is the correct approach for this
> >> issue.
> >
> > Thanks. Let's see if Carlos (wmi.c author) has an opinion...
> >
> > Carlos?
>
> Any input on this?
Looks like a sane workaround to me. Queued to fixes.
Want to going to stable?
--
Darren Hart
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
2016-10-19 20:26 ` Darren Hart
@ 2016-10-19 23:27 ` Azael Avalos
2016-10-21 5:01 ` Darren Hart
0 siblings, 1 reply; 6+ messages in thread
From: Azael Avalos @ 2016-10-19 23:27 UTC (permalink / raw)
To: Darren Hart
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
Carlos Corbacho
Hi Darren,
2016-10-19 14:26 GMT-06:00 Darren Hart <dvhart@infradead.org>:
> On Wed, Oct 12, 2016 at 10:26:43AM -0600, Azael Avalos wrote:
>> *ping*
>>
>> 2016-08-28 11:00 GMT-06:00 Darren Hart <dvhart@infradead.org>:
>> > On Thu, Aug 25, 2016 at 12:50:55PM -0600, Azael Avalos wrote:
>> >> Bug 150611 uncovered that the WMI ID used by the toshiba-wmi driver
>> >> is not Toshiba specific, and as such, the driver was being loaded
>> >> on non Toshiba laptops too.
>> >>
>> >> This patch adds a DMI matching list checking for TOSHIBA as the
>> >> vendor, refusing to load if it is not.
>> >>
>> >> Also the WMI GUID was renamed, dropping the TOSHIBA_ prefix, to
>> >> better reflect that such GUID is not a Toshiba specific one.
>> >>
>> >> Cc: <stable@vger.kernel.org> # 4.4+
>> >> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
>> >> ---
>> >> Hi Darren,
>> >>
>> >> I was waiting on input from the bug above, but haven't received an
>> >> answer (as of yet), so I decided to send this to the mailing list
>> >> for feedback as to whether this is the correct approach for this
>> >> issue.
>> >
>> > Thanks. Let's see if Carlos (wmi.c author) has an opinion...
>> >
>> > Carlos?
>>
>> Any input on this?
>
> Looks like a sane workaround to me. Queued to fixes.
Thanks.
>
> Want to going to stable?
If possible, yes, as this issue affects other laptop manufacturers,
we may never know if someone might try to load an older kernel
on an affected laptop and end up with the toshiba_wmi loaded
instead of the actual laptop support module, however, I'm not
sure if this is a "big" issue to bother stable, if not, simply drop
the cc to stable for me please.
> --
> Darren Hart
> Intel Open Source Technology Center
Cheers
Azael
--
-- El mundo apesta y vosotros apestais tambien --
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops
2016-10-19 23:27 ` Azael Avalos
@ 2016-10-21 5:01 ` Darren Hart
0 siblings, 0 replies; 6+ messages in thread
From: Darren Hart @ 2016-10-21 5:01 UTC (permalink / raw)
To: Azael Avalos
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org,
Carlos Corbacho
On Wed, Oct 19, 2016 at 05:27:49PM -0600, Azael Avalos wrote:
> Hi Darren,
>
> 2016-10-19 14:26 GMT-06:00 Darren Hart <dvhart@infradead.org>:
>
> >
> > Want to going to stable?
>
> If possible, yes, as this issue affects other laptop manufacturers,
> we may never know if someone might try to load an older kernel
> on an affected laptop and end up with the toshiba_wmi loaded
> instead of the actual laptop support module, however, I'm not
> sure if this is a "big" issue to bother stable, if not, simply drop
> the cc to stable for me please.
My addled brain somehow skipped right over the Cc stable in your original patch,
I saw it later :-) Kept it.
--
Darren Hart
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-10-21 5:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 18:50 [PATCH] toshiba-wmi: Fix loading the driver on non Toshiba laptops Azael Avalos
2016-08-28 17:00 ` Darren Hart
2016-10-12 16:26 ` Azael Avalos
2016-10-19 20:26 ` Darren Hart
2016-10-19 23:27 ` Azael Avalos
2016-10-21 5:01 ` Darren Hart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox