• Rafael J. Wysocki's avatar
    ACPI: utils: Fix error path in acpi_evaluate_reference() · 8f0b960a
    Rafael J. Wysocki authored
    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: 2e57d10a ("ACPI: utils: Dynamically determine acpi_handle_list size")
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: default avatarWoody Suwalski <terraluna977@gmail.com>
    8f0b960a
utils.c 28.8 KB