Skip to content

Commit ecf02a6

Browse files
committed
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Pull x86 platform driver bugfixes from Matthew Garrett. * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: asus-laptop: Fix potential invalid pointer dereference Update MAINTAINERS entry asus-laptop: Do not call HWRS on init sony-laptop: fix SNC buffer calls when SN06 returns Integers samsung-laptop: Add quirk for broken acpi_video backlight on N250P acer-wmi: add Aspire 5741G touchpad toggle key acer-wmi: change to emit touchpad on off key acer-wmi: fix obj is NULL but dereferenced MAINTAINERS: change the mail address of acer-wmi/msi-laptop maintainer
2 parents ccae663 + 9f89748 commit ecf02a6

File tree

5 files changed

+62
-48
lines changed

5 files changed

+62
-48
lines changed

MAINTAINERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ S: Maintained
228228
F: drivers/platform/x86/acerhdf.c
229229

230230
ACER WMI LAPTOP EXTRAS
231-
M: Joey Lee <jlee@novell.com>
231+
M: "Lee, Chun-Yi" <jlee@suse.com>
232232
233233
S: Maintained
234234
F: drivers/platform/x86/acer-wmi.c
@@ -5077,7 +5077,7 @@ S: Maintained
50775077
F: drivers/media/radio/radio-mr800.c
50785078

50795079
MSI LAPTOP SUPPORT
5080-
M: "Lee, Chun-Yi" <jlee@novell.com>
5080+
M: "Lee, Chun-Yi" <jlee@suse.com>
50815081
50825082
S: Maintained
50835083
F: drivers/platform/x86/msi-laptop.c
@@ -8526,7 +8526,7 @@ F: Documentation/x86/
85268526
F: arch/x86/
85278527

85288528
X86 PLATFORM DRIVERS
8529-
M: Matthew Garrett <mjg@redhat.com>
8529+
M: Matthew Garrett <matthew.garrett@nebula.com>
85308530
85318531
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git
85328532
S: Maintained

drivers/platform/x86/acer-wmi.c

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ static const struct key_entry acer_wmi_keymap[] = {
125125
{KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} },
126126
{KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
127127
{KE_IGNORE, 0x81, {KEY_SLEEP} },
128-
{KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */
128+
{KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
129+
{KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
130+
{KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
129131
{KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
132+
{KE_KEY, 0x85, {KEY_TOUCHPAD_TOGGLE} },
130133
{KE_END, 0}
131134
};
132135

@@ -147,6 +150,7 @@ struct event_return_value {
147150
#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */
148151
#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */
149152
#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */
153+
#define ACER_WMID3_GDS_TOUCHPAD (1<<1) /* Touchpad */
150154

151155
struct lm_input_params {
152156
u8 function_num; /* Function Number */
@@ -875,7 +879,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
875879
struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) };
876880
struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL };
877881
union acpi_object *obj;
878-
u32 tmp;
882+
u32 tmp = 0;
879883
acpi_status status;
880884

881885
status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
@@ -884,14 +888,14 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
884888
return status;
885889

886890
obj = (union acpi_object *) result.pointer;
887-
if (obj && obj->type == ACPI_TYPE_BUFFER &&
888-
(obj->buffer.length == sizeof(u32) ||
889-
obj->buffer.length == sizeof(u64))) {
890-
tmp = *((u32 *) obj->buffer.pointer);
891-
} else if (obj->type == ACPI_TYPE_INTEGER) {
892-
tmp = (u32) obj->integer.value;
893-
} else {
894-
tmp = 0;
891+
if (obj) {
892+
if (obj->type == ACPI_TYPE_BUFFER &&
893+
(obj->buffer.length == sizeof(u32) ||
894+
obj->buffer.length == sizeof(u64))) {
895+
tmp = *((u32 *) obj->buffer.pointer);
896+
} else if (obj->type == ACPI_TYPE_INTEGER) {
897+
tmp = (u32) obj->integer.value;
898+
}
895899
}
896900

897901
if (out)
@@ -1193,12 +1197,14 @@ static acpi_status WMID_set_capabilities(void)
11931197
return status;
11941198

11951199
obj = (union acpi_object *) out.pointer;
1196-
if (obj && obj->type == ACPI_TYPE_BUFFER &&
1197-
(obj->buffer.length == sizeof(u32) ||
1198-
obj->buffer.length == sizeof(u64))) {
1199-
devices = *((u32 *) obj->buffer.pointer);
1200-
} else if (obj->type == ACPI_TYPE_INTEGER) {
1201-
devices = (u32) obj->integer.value;
1200+
if (obj) {
1201+
if (obj->type == ACPI_TYPE_BUFFER &&
1202+
(obj->buffer.length == sizeof(u32) ||
1203+
obj->buffer.length == sizeof(u64))) {
1204+
devices = *((u32 *) obj->buffer.pointer);
1205+
} else if (obj->type == ACPI_TYPE_INTEGER) {
1206+
devices = (u32) obj->integer.value;
1207+
}
12021208
} else {
12031209
kfree(out.pointer);
12041210
return AE_ERROR;
@@ -1676,6 +1682,7 @@ static void acer_wmi_notify(u32 value, void *context)
16761682
acpi_status status;
16771683
u16 device_state;
16781684
const struct key_entry *key;
1685+
u32 scancode;
16791686

16801687
status = wmi_get_event_data(value, &response);
16811688
if (status != AE_OK) {
@@ -1712,6 +1719,7 @@ static void acer_wmi_notify(u32 value, void *context)
17121719
pr_warn("Unknown key number - 0x%x\n",
17131720
return_value.key_num);
17141721
} else {
1722+
scancode = return_value.key_num;
17151723
switch (key->keycode) {
17161724
case KEY_WLAN:
17171725
case KEY_BLUETOOTH:
@@ -1725,9 +1733,11 @@ static void acer_wmi_notify(u32 value, void *context)
17251733
rfkill_set_sw_state(bluetooth_rfkill,
17261734
!(device_state & ACER_WMID3_GDS_BLUETOOTH));
17271735
break;
1736+
case KEY_TOUCHPAD_TOGGLE:
1737+
scancode = (device_state & ACER_WMID3_GDS_TOUCHPAD) ?
1738+
KEY_TOUCHPAD_ON : KEY_TOUCHPAD_OFF;
17281739
}
1729-
sparse_keymap_report_entry(acer_wmi_input_dev, key,
1730-
1, true);
1740+
sparse_keymap_report_event(acer_wmi_input_dev, scancode, 1, true);
17311741
}
17321742
break;
17331743
case WMID_ACCEL_EVENT:
@@ -1946,12 +1956,14 @@ static u32 get_wmid_devices(void)
19461956
return 0;
19471957

19481958
obj = (union acpi_object *) out.pointer;
1949-
if (obj && obj->type == ACPI_TYPE_BUFFER &&
1950-
(obj->buffer.length == sizeof(u32) ||
1951-
obj->buffer.length == sizeof(u64))) {
1952-
devices = *((u32 *) obj->buffer.pointer);
1953-
} else if (obj->type == ACPI_TYPE_INTEGER) {
1954-
devices = (u32) obj->integer.value;
1959+
if (obj) {
1960+
if (obj->type == ACPI_TYPE_BUFFER &&
1961+
(obj->buffer.length == sizeof(u32) ||
1962+
obj->buffer.length == sizeof(u64))) {
1963+
devices = *((u32 *) obj->buffer.pointer);
1964+
} else if (obj->type == ACPI_TYPE_INTEGER) {
1965+
devices = (u32) obj->integer.value;
1966+
}
19551967
}
19561968

19571969
kfree(out.pointer);

drivers/platform/x86/asus-laptop.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,10 @@ static ssize_t show_infos(struct device *dev,
860860
/*
861861
* The HWRS method return informations about the hardware.
862862
* 0x80 bit is for WLAN, 0x100 for Bluetooth.
863+
* 0x40 for WWAN, 0x10 for WIMAX.
863864
* The significance of others is yet to be found.
864-
* If we don't find the method, we assume the device are present.
865+
* We don't currently use this for device detection, and it
866+
* takes several seconds to run on some systems.
865867
*/
866868
rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp);
867869
if (!ACPI_FAILURE(rv))
@@ -1682,7 +1684,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
16821684
{
16831685
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
16841686
union acpi_object *model = NULL;
1685-
unsigned long long bsts_result, hwrs_result;
1687+
unsigned long long bsts_result;
16861688
char *string = NULL;
16871689
acpi_status status;
16881690

@@ -1741,20 +1743,9 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
17411743
return -ENOMEM;
17421744
}
17431745

1744-
if (*string)
1746+
if (string)
17451747
pr_notice(" %s model detected\n", string);
17461748

1747-
/*
1748-
* The HWRS method return informations about the hardware.
1749-
* 0x80 bit is for WLAN, 0x100 for Bluetooth,
1750-
* 0x40 for WWAN, 0x10 for WIMAX.
1751-
* The significance of others is yet to be found.
1752-
*/
1753-
status =
1754-
acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result);
1755-
if (!ACPI_FAILURE(status))
1756-
pr_notice(" HWRS returned %x", (int)hwrs_result);
1757-
17581749
if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL))
17591750
asus->have_rsts = true;
17601751

drivers/platform/x86/samsung-laptop.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
15231523
},
15241524
.driver_data = &samsung_broken_acpi_video,
15251525
},
1526+
{
1527+
.callback = samsung_dmi_matched,
1528+
.ident = "N250P",
1529+
.matches = {
1530+
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1531+
DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
1532+
DMI_MATCH(DMI_BOARD_NAME, "N250P"),
1533+
},
1534+
.driver_data = &samsung_broken_acpi_video,
1535+
},
15261536
{ },
15271537
};
15281538
MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);

drivers/platform/x86/sony-laptop.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -786,28 +786,29 @@ static int sony_nc_int_call(acpi_handle handle, char *name, int *value,
786786
static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
787787
void *buffer, size_t buflen)
788788
{
789+
int ret = 0;
789790
size_t len = len;
790791
union acpi_object *object = __call_snc_method(handle, name, value);
791792

792793
if (!object)
793794
return -EINVAL;
794795

795-
if (object->type == ACPI_TYPE_BUFFER)
796+
if (object->type == ACPI_TYPE_BUFFER) {
796797
len = MIN(buflen, object->buffer.length);
798+
memcpy(buffer, object->buffer.pointer, len);
797799

798-
else if (object->type == ACPI_TYPE_INTEGER)
800+
} else if (object->type == ACPI_TYPE_INTEGER) {
799801
len = MIN(buflen, sizeof(object->integer.value));
802+
memcpy(buffer, &object->integer.value, len);
800803

801-
else {
804+
} else {
802805
pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
803806
ACPI_TYPE_BUFFER, object->type);
804-
kfree(object);
805-
return -EINVAL;
807+
ret = -EINVAL;
806808
}
807809

808-
memcpy(buffer, object->buffer.pointer, len);
809810
kfree(object);
810-
return 0;
811+
return ret;
811812
}
812813

813814
struct sony_nc_handles {

0 commit comments

Comments
 (0)