Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: dock: fix oops when _DCK evaluation fails

Data returned by acpi_get_name in acpi_buffer is not acpi_object and
therefore should not be cast to it, otherwise we'll get an nice oops
trying to print error message.

Also print name of the ACPI object corresponding to the docking station
and elevate severity of the message printed when _DCK fails to KERN_ERR.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Dmitry Torokhov and committed by
Len Brown
9254bc84 3f8698d4

+4 -4
+4 -4
drivers/acpi/dock.c
··· 396 396 union acpi_object arg; 397 397 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 398 398 struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 399 - union acpi_object *obj; 400 399 401 400 acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer); 402 - obj = name_buffer.pointer; 403 401 404 - printk(KERN_INFO PREFIX "%s\n", dock ? "docking" : "undocking"); 402 + printk(KERN_INFO PREFIX "%s - %s\n", 403 + (char *)name_buffer.pointer, dock ? "docking" : "undocking"); 405 404 406 405 /* _DCK method has one argument */ 407 406 arg_list.count = 1; ··· 409 410 arg.integer.value = dock; 410 411 status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); 411 412 if (ACPI_FAILURE(status)) 412 - pr_debug("%s: failed to execute _DCK\n", obj->string.pointer); 413 + printk(KERN_ERR PREFIX "%s - failed to execute _DCK\n", 414 + (char *)name_buffer.pointer); 413 415 kfree(buffer.pointer); 414 416 kfree(name_buffer.pointer); 415 417 }