From: Sudeep Holla <sudeep.holla@kernel.org>
To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@kernel.org>,
acpica-devel@lists.linux.dev,
"Rafael J . Wysocki" <rafael@kernel.org>,
Saket Dumbre <saket.dumbre@intel.com>,
Huisong Li <lihuisong@huawei.com>
Subject: [PATCH v2 3/4] ACPI: PCC: Free channel on OpRegion deactivation
Date: Wed, 22 Jul 2026 14:15:52 +0100 [thread overview]
Message-ID: <20260722131553.2117835-4-sudeep.holla@kernel.org> (raw)
In-Reply-To: <20260722131553.2117835-1-sudeep.holla@kernel.org>
ACPICA calls the address space setup callback with
ACPI_REGION_DEACTIVATE when a PCC OperationRegion is torn down.
The PCC setup callback currently allocates a fresh pcc_data and requests
the mailbox channel before looking at the function argument. If ACPICA
deactivates a region, this can leave the existing region context and
mailbox channel unreleased, and may also request a channel during
teardown.
Handle ACPI_REGION_DEACTIVATE before allocation. Free the PCC mailbox
channel, release the region context and clear the context pointer.
Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype")
Reviewed-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
drivers/acpi/acpi_pcc.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index 9881c9ee293d..57d13b25c1d6 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -55,6 +55,19 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_mbox_chan *pcc_chan;
acpi_status ret;
+ if (function == ACPI_REGION_DEACTIVATE) {
+ data = *region_context;
+ if (data) {
+ pcc_mbox_free_channel(data->pcc_chan);
+ kfree(data);
+ *region_context = NULL;
+ }
+ return AE_OK;
+ }
+
+ if (function != ACPI_REGION_ACTIVATE)
+ return AE_BAD_PARAMETER;
+
data = kzalloc_obj(*data);
if (!data)
return AE_NO_MEMORY;
--
2.43.0
next prev parent reply other threads:[~2026-07-22 13:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 13:15 [PATCH v2 0/4] ACPI/PCC: Correct PCC OperationRegion handling Sudeep Holla
2026-07-22 13:15 ` [PATCH v2 1/4] ACPICA: Fix PCC OperationRegion command offsets Sudeep Holla
2026-08-05 16:46 ` Rafael J. Wysocki (Intel)
2026-08-13 3:00 ` Sudeep Holla
2026-07-22 13:15 ` [PATCH v2 2/4] ACPI: PCC: Preserve shared memory signature in OpRegion handler Sudeep Holla
2026-07-22 13:15 ` Sudeep Holla [this message]
2026-07-22 13:15 ` [PATCH v2 4/4] ACPI: PCC: Cache OpRegion command timeout Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722131553.2117835-4-sudeep.holla@kernel.org \
--to=sudeep.holla@kernel.org \
--cc=acpica-devel@lists.linux.dev \
--cc=lihuisong@huawei.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=saket.dumbre@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.