Skip to content

Commit f890157

Browse files
rafaelmsoaresrafaeljw
authored andcommitted
ACPI: PCC: Release resources on address space setup failure path
The allocated memory for the pcc_data struct doesn't get freed under an error path in pcc_mbox_request_channel() or acpi_os_ioremap(). Also, the PCC mailbox channel doesn't get freed under an error path in acpi_os_ioremap(). Fixes: 77e2a04 ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Rafael Mendonca <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 521a547 commit f890157

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/acpi/acpi_pcc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
6363
if (IS_ERR(data->pcc_chan)) {
6464
pr_err("Failed to find PCC channel for subspace %d\n",
6565
ctx->subspace_id);
66+
kfree(data);
6667
return AE_NOT_FOUND;
6768
}
6869

@@ -72,6 +73,8 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
7273
if (!data->pcc_comm_addr) {
7374
pr_err("Failed to ioremap PCC comm region mem for %d\n",
7475
ctx->subspace_id);
76+
pcc_mbox_free_channel(data->pcc_chan);
77+
kfree(data);
7578
return AE_NO_MEMORY;
7679
}
7780

0 commit comments

Comments
 (0)