Skip to content

Commit 4aa2fb4

Browse files
committed
Merge tag 'platform-drivers-x86-v5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: "Two last minute small but important fixes. The hp-wmi change fixes an issue which is actively being hit by users: https://bugzilla.redhat.com/show_bug.cgi?id=1918255 https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3564 And the dell-wmi-sysman patch fixes a bug in the new dell-wmi-sysman driver which causes some systems to hang at boot when the driver loads" * tag 'platform-drivers-x86-v5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: dell-wmi-sysman: fix a NULL pointer dereference platform/x86: hp-wmi: Disable tablet-mode reporting by default
2 parents 3aaf0a2 + 215164b commit 4aa2fb4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

drivers/platform/x86/dell-wmi-sysman/sysman.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,17 @@ static int init_bios_attributes(int attr_type, const char *guid)
419419
return retval;
420420
/* need to use specific instance_id and guid combination to get right data */
421421
obj = get_wmiobj_pointer(instance_id, guid);
422-
if (!obj)
422+
if (!obj || obj->type != ACPI_TYPE_PACKAGE)
423423
return -ENODEV;
424424
elements = obj->package.elements;
425425

426426
mutex_lock(&wmi_priv.mutex);
427427
while (elements) {
428428
/* sanity checking */
429+
if (elements[ATTR_NAME].type != ACPI_TYPE_STRING) {
430+
pr_debug("incorrect element type\n");
431+
goto nextobj;
432+
}
429433
if (strlen(elements[ATTR_NAME].string.pointer) == 0) {
430434
pr_debug("empty attribute found\n");
431435
goto nextobj;

drivers/platform/x86/hp-wmi.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ MODULE_LICENSE("GPL");
3232
MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
3333
MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
3434

35+
static int enable_tablet_mode_sw = -1;
36+
module_param(enable_tablet_mode_sw, int, 0444);
37+
MODULE_PARM_DESC(enable_tablet_mode_sw, "Enable SW_TABLET_MODE reporting (-1=auto, 0=no, 1=yes)");
38+
3539
#define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
3640
#define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
3741

@@ -654,10 +658,12 @@ static int __init hp_wmi_input_setup(void)
654658
}
655659

656660
/* Tablet mode */
657-
val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
658-
if (!(val < 0)) {
659-
__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
660-
input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
661+
if (enable_tablet_mode_sw > 0) {
662+
val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
663+
if (val >= 0) {
664+
__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
665+
input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
666+
}
661667
}
662668

663669
err = sparse_keymap_setup(hp_wmi_input_dev, hp_wmi_keymap, NULL);

0 commit comments

Comments
 (0)