diff mbox

ACPI/CPC: Don't try to clean up uninitialized CPC data

Message ID 1481913346-16321-1-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Boris Ostrovsky Dec. 16, 2016, 6:35 p.m. UTC
If acpi_cppc_processor_probe() had not executed successfully (for
example, if _CPC object was not found) then cpc_desc_ptr for that
processor will be invalid.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 drivers/acpi/cppc_acpi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Prakash, Prashanth Dec. 16, 2016, 9:52 p.m. UTC | #1
Hi Boris,

On 12/16/2016 11:35 AM, Boris Ostrovsky wrote:
> If acpi_cppc_processor_probe() had not executed successfully (for
> example, if _CPC object was not found) then cpc_desc_ptr for that
> processor will be invalid.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  drivers/acpi/cppc_acpi.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index d0d0504..5bba26e 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -824,6 +824,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
>  	void __iomem *addr;
>  
>  	cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
> +	if (!cpc_ptr)
> +		return;
>  
>  	/* Free all the mapped sys mem areas for this CPU */
>  	for (i = 2; i < cpc_ptr->num_entries; i++) {
I think a recent patch from Sebastian fixed the same issue.
https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=9e9d68dad58c70f40f50adfeabd2fdaa39a743fd

--
Thanks,
Prashanth
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Boris Ostrovsky Dec. 16, 2016, 10:02 p.m. UTC | #2
On 12/16/2016 04:52 PM, Prakash, Prashanth wrote:
> Hi Boris,
>
> On 12/16/2016 11:35 AM, Boris Ostrovsky wrote:
>> If acpi_cppc_processor_probe() had not executed successfully (for
>> example, if _CPC object was not found) then cpc_desc_ptr for that
>> processor will be invalid.
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> ---
>>  drivers/acpi/cppc_acpi.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index d0d0504..5bba26e 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -824,6 +824,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
>>  	void __iomem *addr;
>>  
>>  	cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
>> +	if (!cpc_ptr)
>> +		return;
>>  
>>  	/* Free all the mapped sys mem areas for this CPU */
>>  	for (i = 2; i < cpc_ptr->num_entries; i++) {
> I think a recent patch from Sebastian fixed the same issue.
> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=9e9d68dad58c70f40f50adfeabd2fdaa39a743fd

Ah, excellent! Thanks.

-boris
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index d0d0504..5bba26e 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -824,6 +824,8 @@  void acpi_cppc_processor_exit(struct acpi_processor *pr)
 	void __iomem *addr;
 
 	cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
+	if (!cpc_ptr)
+		return;
 
 	/* Free all the mapped sys mem areas for this CPU */
 	for (i = 2; i < cpc_ptr->num_entries; i++) {