Commit 40599072 authored by Pavel Machek's avatar Pavel Machek Committed by Len Brown

ACPI: scheduling in atomic via acpi_evaluate_integer ()

Now I know why I had strange "scheduling in atomic" problems:
acpi_evaluate_integer() does malloc(..., irqs_disabled() ? GFP_ATOMIC
: GFP_KERNEL)... which is (of course) broken.

There's no way to reliably tell if we need GFP_ATOMIC or not from
code, this one for example fails to detect spinlocks held.

Fortunately, allocation seems small enough to be done on stack.
Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
Acked-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 558073dd
...@@ -259,34 +259,26 @@ acpi_evaluate_integer(acpi_handle handle, ...@@ -259,34 +259,26 @@ acpi_evaluate_integer(acpi_handle handle,
struct acpi_object_list *arguments, unsigned long long *data) struct acpi_object_list *arguments, unsigned long long *data)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_object *element; union acpi_object element;
struct acpi_buffer buffer = { 0, NULL }; struct acpi_buffer buffer = { 0, NULL };
if (!data) if (!data)
return AE_BAD_PARAMETER; return AE_BAD_PARAMETER;
element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
if (!element)
return AE_NO_MEMORY;
buffer.length = sizeof(union acpi_object); buffer.length = sizeof(union acpi_object);
buffer.pointer = element; buffer.pointer = &element;
status = acpi_evaluate_object(handle, pathname, arguments, &buffer); status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_util_eval_error(handle, pathname, status); acpi_util_eval_error(handle, pathname, status);
kfree(element);
return status; return status;
} }
if (element->type != ACPI_TYPE_INTEGER) { if (element.type != ACPI_TYPE_INTEGER) {
acpi_util_eval_error(handle, pathname, AE_BAD_DATA); acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
kfree(element);
return AE_BAD_DATA; return AE_BAD_DATA;
} }
*data = element->integer.value; *data = element.integer.value;
kfree(element);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment