* [PATCH] ACPI: PCC: Fix race condition by removing static qualifier
@ 2025-12-10 13:26 Pengjie Zhang
2025-12-10 14:54 ` Sudeep Holla
2025-12-15 12:02 ` Rafael J. Wysocki
0 siblings, 2 replies; 5+ messages in thread
From: Pengjie Zhang @ 2025-12-10 13:26 UTC (permalink / raw)
To: rafael
Cc: lenb, lihuisong, sudeep.holla, linux-acpi, linux-kernel,
zhanjie9, zhenglifeng1, yubowen8, linhongye, linuxarm,
jonathan.cameron, zhangpengjie2, wangzhi12
The variable 'ret' in acpi_pcc_address_space_setup() is currently
declared with the 'static' storage specifier. This can lead to race
conditions in a multithreaded environment.
Remove the 'static' qualifier to ensure 'ret' is allocated directly
on the stack as a local variable.
Fixes: a10b1c99e2dc ("ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available")
Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
---
drivers/acpi/acpi_pcc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
index 97064e943768..e3f302b9dee5 100644
--- a/drivers/acpi/acpi_pcc.c
+++ b/drivers/acpi/acpi_pcc.c
@@ -52,7 +52,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
struct pcc_data *data;
struct acpi_pcc_info *ctx = handler_context;
struct pcc_mbox_chan *pcc_chan;
- static acpi_status ret;
+ acpi_status ret;
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
--
2.33.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: PCC: Fix race condition by removing static qualifier
2025-12-10 13:26 [PATCH] ACPI: PCC: Fix race condition by removing static qualifier Pengjie Zhang
@ 2025-12-10 14:54 ` Sudeep Holla
2025-12-11 1:35 ` lihuisong (C)
2025-12-11 3:44 ` zhangpengjie (A)
2025-12-15 12:02 ` Rafael J. Wysocki
1 sibling, 2 replies; 5+ messages in thread
From: Sudeep Holla @ 2025-12-10 14:54 UTC (permalink / raw)
To: Pengjie Zhang
Cc: rafael, lenb, lihuisong, linux-acpi, linux-kernel, zhanjie9,
zhenglifeng1, yubowen8, linhongye, linuxarm, jonathan.cameron,
wangzhi12
On Wed, Dec 10, 2025 at 09:26:34PM +0800, Pengjie Zhang wrote:
> The variable 'ret' in acpi_pcc_address_space_setup() is currently
> declared with the 'static' storage specifier. This can lead to race
> conditions in a multithreaded environment.
>
> Remove the 'static' qualifier to ensure 'ret' is allocated directly
> on the stack as a local variable.
>
Ah, my mistake. I’m not sure how that slipped in other than a simple typo or
copy/paste error. Thanks for catching it. Let me know if you spotted it
because something broke or just from reading the code.
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> Fixes: a10b1c99e2dc ("ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available")
> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> ---
> drivers/acpi/acpi_pcc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
> index 97064e943768..e3f302b9dee5 100644
> --- a/drivers/acpi/acpi_pcc.c
> +++ b/drivers/acpi/acpi_pcc.c
> @@ -52,7 +52,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
> struct pcc_data *data;
> struct acpi_pcc_info *ctx = handler_context;
> struct pcc_mbox_chan *pcc_chan;
> - static acpi_status ret;
> + acpi_status ret;
>
> data = kzalloc(sizeof(*data), GFP_KERNEL);
> if (!data)
> --
> 2.33.0
>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: PCC: Fix race condition by removing static qualifier
2025-12-10 14:54 ` Sudeep Holla
@ 2025-12-11 1:35 ` lihuisong (C)
2025-12-11 3:44 ` zhangpengjie (A)
1 sibling, 0 replies; 5+ messages in thread
From: lihuisong (C) @ 2025-12-11 1:35 UTC (permalink / raw)
To: Sudeep Holla, Pengjie Zhang
Cc: rafael, lenb, linux-acpi, linux-kernel, zhanjie9, zhenglifeng1,
yubowen8, linhongye, linuxarm, jonathan.cameron, wangzhi12
在 2025/12/10 22:54, Sudeep Holla 写道:
> On Wed, Dec 10, 2025 at 09:26:34PM +0800, Pengjie Zhang wrote:
>> The variable 'ret' in acpi_pcc_address_space_setup() is currently
>> declared with the 'static' storage specifier. This can lead to race
>> conditions in a multithreaded environment.
>>
>> Remove the 'static' qualifier to ensure 'ret' is allocated directly
>> on the stack as a local variable.
>>
> Ah, my mistake. I’m not sure how that slipped in other than a simple typo or
> copy/paste error. Thanks for catching it. Let me know if you spotted it
> because something broke or just from reading the code.
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: lihuisong@huawei.com
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: PCC: Fix race condition by removing static qualifier
2025-12-10 14:54 ` Sudeep Holla
2025-12-11 1:35 ` lihuisong (C)
@ 2025-12-11 3:44 ` zhangpengjie (A)
1 sibling, 0 replies; 5+ messages in thread
From: zhangpengjie (A) @ 2025-12-11 3:44 UTC (permalink / raw)
To: Sudeep Holla
Cc: rafael, lenb, lihuisong, linux-acpi, linux-kernel, zhanjie9,
zhenglifeng1, yubowen8, linhongye, linuxarm, jonathan.cameron,
wangzhi12
On 12/10/2025 10:54 PM, Sudeep Holla wrote:
> On Wed, Dec 10, 2025 at 09:26:34PM +0800, Pengjie Zhang wrote:
>> The variable 'ret' in acpi_pcc_address_space_setup() is currently
>> declared with the 'static' storage specifier. This can lead to race
>> conditions in a multithreaded environment.
>>
>> Remove the 'static' qualifier to ensure 'ret' is allocated directly
>> on the stack as a local variable.
>>
Hi, I'm lucky that I didn't run into any problems because of this, I
just found
this issue during code review.
> Ah, my mistake. I’m not sure how that slipped in other than a simple typo or
> copy/paste error. Thanks for catching it. Let me know if you spotted it
> because something broke or just from reading the code.
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>
>> Fixes: a10b1c99e2dc ("ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available")
>> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
>> ---
>> drivers/acpi/acpi_pcc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
>> index 97064e943768..e3f302b9dee5 100644
>> --- a/drivers/acpi/acpi_pcc.c
>> +++ b/drivers/acpi/acpi_pcc.c
>> @@ -52,7 +52,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
>> struct pcc_data *data;
>> struct acpi_pcc_info *ctx = handler_context;
>> struct pcc_mbox_chan *pcc_chan;
>> - static acpi_status ret;
>> + acpi_status ret;
>>
>> data = kzalloc(sizeof(*data), GFP_KERNEL);
>> if (!data)
>> --
>> 2.33.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ACPI: PCC: Fix race condition by removing static qualifier
2025-12-10 13:26 [PATCH] ACPI: PCC: Fix race condition by removing static qualifier Pengjie Zhang
2025-12-10 14:54 ` Sudeep Holla
@ 2025-12-15 12:02 ` Rafael J. Wysocki
1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2025-12-15 12:02 UTC (permalink / raw)
To: Pengjie Zhang
Cc: rafael, lenb, lihuisong, sudeep.holla, linux-acpi, linux-kernel,
zhanjie9, zhenglifeng1, yubowen8, linhongye, linuxarm,
jonathan.cameron, wangzhi12
On Wed, Dec 10, 2025 at 2:26 PM Pengjie Zhang <zhangpengjie2@huawei.com> wrote:
>
> The variable 'ret' in acpi_pcc_address_space_setup() is currently
> declared with the 'static' storage specifier. This can lead to race
> conditions in a multithreaded environment.
>
> Remove the 'static' qualifier to ensure 'ret' is allocated directly
> on the stack as a local variable.
>
> Fixes: a10b1c99e2dc ("ACPI: PCC: Setup PCC Opregion handler only if platform interrupt is available")
> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> ---
> drivers/acpi/acpi_pcc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c
> index 97064e943768..e3f302b9dee5 100644
> --- a/drivers/acpi/acpi_pcc.c
> +++ b/drivers/acpi/acpi_pcc.c
> @@ -52,7 +52,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function,
> struct pcc_data *data;
> struct acpi_pcc_info *ctx = handler_context;
> struct pcc_mbox_chan *pcc_chan;
> - static acpi_status ret;
> + acpi_status ret;
>
> data = kzalloc(sizeof(*data), GFP_KERNEL);
> if (!data)
> --
Applied as 6.19-rc material, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-15 12:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 13:26 [PATCH] ACPI: PCC: Fix race condition by removing static qualifier Pengjie Zhang
2025-12-10 14:54 ` Sudeep Holla
2025-12-11 1:35 ` lihuisong (C)
2025-12-11 3:44 ` zhangpengjie (A)
2025-12-15 12:02 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®