Skip to content

Commit 5accb26

Browse files
Wer-Wolfrafaeljw
authored andcommitted
ACPICA: Fix memory leak if acpi_ps_get_next_namepath() fails
ACPICA commit 2802af722bbde7bf1a7ac68df68e179e2555d361 If acpi_ps_get_next_namepath() fails, the previously allocated union acpi_parse_object needs to be freed before returning the status code. The issue was first being reported on the Linux ACPI mailing list: Link: https://lore.kernel.org/linux-acpi/[email protected]/T/ Link: acpica/acpica@2802af72 Signed-off-by: Armin Wolf <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent cff8a9f commit 5accb26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/acpi/acpica/psargs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
820820
acpi_ps_get_next_namepath(walk_state, parser_state,
821821
arg,
822822
ACPI_NOT_METHOD_CALL);
823+
if (ACPI_FAILURE(status)) {
824+
acpi_ps_free_op(arg);
825+
return_ACPI_STATUS(status);
826+
}
823827
} else {
824828
/* Single complex argument, nothing returned */
825829

@@ -854,6 +858,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
854858
acpi_ps_get_next_namepath(walk_state, parser_state,
855859
arg,
856860
ACPI_POSSIBLE_METHOD_CALL);
861+
if (ACPI_FAILURE(status)) {
862+
acpi_ps_free_op(arg);
863+
return_ACPI_STATUS(status);
864+
}
857865

858866
if (arg->common.aml_opcode == AML_INT_METHODCALL_OP) {
859867

0 commit comments

Comments
 (0)