Skip to content

Commit

Permalink
ACPI: PCC: Release resources on address space setup failure path
Browse files Browse the repository at this point in the history
[ Upstream commit f890157 ]

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 <rafaelmendsr@gmail.com>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rafaelmsoares authored and gregkh committed Oct 21, 2022
1 parent 3c2dc93 commit 144c927
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/acpi/acpi_pcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
if (IS_ERR(data->pcc_chan)) {
pr_err("Failed to find PCC channel for subspace %d\n",
ctx->subspace_id);
kfree(data);
return AE_NOT_FOUND;
}

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

Expand Down

0 comments on commit 144c927

Please sign in to comment.