Skip to content

Commit 8f0b960

Browse files
committed
ACPI: utils: Fix error path in acpi_evaluate_reference()
If a pointer to an uninitialized struct acpi_handle_list is passed to acpi_evaluate_reference() and it decides to bail out early, either because acpi_evaluate_object() fails, or because it produces invalid data, the handles pointer from the struct acpi_handle_list will be passed to kfree() and if it is not NULL, the kernel will crash on an attempt to free unallocated memory. Address this by moving the "end" label in acpi_evaluate_reference() to the end of the function, which is sufficient, because no cleanup is needed in that case. Fixes: 2e57d10 ("ACPI: utils: Dynamically determine acpi_handle_list size") Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Woody Suwalski <[email protected]>
1 parent 33cc938 commit 8f0b960

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ acpi_evaluate_reference(acpi_handle handle,
399399
acpi_handle_debug(list->handles[i], "Found in reference list\n");
400400
}
401401

402-
end:
403402
if (ACPI_FAILURE(status)) {
404403
list->count = 0;
405404
kfree(list->handles);
406405
list->handles = NULL;
407406
}
408407

408+
end:
409409
kfree(buffer.pointer);
410410

411411
return status;

0 commit comments

Comments
 (0)