Skip to content

Commit 215164b

Browse files
Mario Limonciellojwrdegoede
authored andcommitted
platform/x86: dell-wmi-sysman: fix a NULL pointer dereference
An upcoming Dell platform is causing a NULL pointer dereference in dell-wmi-sysman initialization. Validate that the input from BIOS matches correct ACPI types and abort module initialization if it fails. Signed-off-by: Mario Limonciello <[email protected]> Tested-by: Perry Yuan <[email protected]> Link: https://lore.kernel.org/r/[email protected] [[email protected]: Drop redundant release_attributes_data() call] Signed-off-by: Hans de Goede <[email protected]>
1 parent 67fbe02 commit 215164b

File tree

1 file changed

+5
-1
lines changed
  • drivers/platform/x86/dell-wmi-sysman

1 file changed

+5
-1
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;

0 commit comments

Comments
 (0)