* [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a NULL pointer dereference
@ 2011-08-31 20:08 Naga Chumbalkar
2011-09-08 23:52 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Naga Chumbalkar @ 2011-08-31 20:08 UTC (permalink / raw)
To: davej; +Cc: Naga Chumbalkar, linux-kernel, cpufreq, stable
If, for whatever reason, "pr" ends up being NULL we would end up in a PANIC
as seen below:
Loading CPUFreq modules[ 437.661360] BUG: unable to handle kernel NULL pointer
dereference at (null)
IP: [<ffffffffa0434314>] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq]
It's better to prevent the PANIC by failing the driver, and allowing the system to boot.
Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
Cc: stable@kernel.org
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
index 7b0603e..cdc02ac 100644
--- a/drivers/cpufreq/pcc-cpufreq.c
+++ b/drivers/cpufreq/pcc-cpufreq.c
@@ -261,6 +261,9 @@ static int pcc_get_offset(int cpu)
pr = per_cpu(processors, cpu);
pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu);
+ if (!pr)
+ return -ENODEV;
+
status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer);
if (ACPI_FAILURE(status))
return -ENODEV;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a NULL pointer dereference
2011-08-31 20:08 [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a NULL pointer dereference Naga Chumbalkar
@ 2011-09-08 23:52 ` Andrew Morton
2011-09-12 17:05 ` Chumbalkar, Nagananda
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2011-09-08 23:52 UTC (permalink / raw)
To: Naga Chumbalkar; +Cc: davej, linux-kernel, cpufreq, stable
On Wed, 31 Aug 2011 20:08:45 +0000 (UTC)
Naga Chumbalkar <nagananda.chumbalkar@hp.com> wrote:
> If, for whatever reason, "pr" ends up being NULL we would end up in a PANIC
> as seen below:
>
> Loading CPUFreq modules[ 437.661360] BUG: unable to handle kernel NULL pointer
> dereference at (null)
> IP: [<ffffffffa0434314>] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq]
>
> It's better to prevent the PANIC by failing the driver, and allowing the system to boot.
>
> Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
> Cc: stable@kernel.org
>
> diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
> index 7b0603e..cdc02ac 100644
> --- a/drivers/cpufreq/pcc-cpufreq.c
> +++ b/drivers/cpufreq/pcc-cpufreq.c
> @@ -261,6 +261,9 @@ static int pcc_get_offset(int cpu)
> pr = per_cpu(processors, cpu);
> pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu);
>
> + if (!pr)
> + return -ENODEV;
> +
> status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer);
> if (ACPI_FAILURE(status))
> return -ENODEV;
hm, from reading drivers/acpi/processor_driver.c it appears that
per_cpu(processors, n)==NULL is an expected and valid state. Heaven
knows what that state actually *means* - apparently this is a secret.
I assume that you've hit this crash in real live code, hence your
suggestion of a -stable backport?
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a NULL pointer dereference
2011-09-08 23:52 ` Andrew Morton
@ 2011-09-12 17:05 ` Chumbalkar, Nagananda
0 siblings, 0 replies; 3+ messages in thread
From: Chumbalkar, Nagananda @ 2011-09-12 17:05 UTC (permalink / raw)
To: Andrew Morton; +Cc: davej, linux-kernel, cpufreq, stable
>-----Original Message-----
>From: Andrew Morton [mailto:akpm@linux-foundation.org]
>Sent: Thursday, September 08, 2011 6:53 PM
>To: Chumbalkar, Nagananda
>Cc: davej@codemonkey.org.uk; linux-kernel@vger.kernel.org;
>cpufreq@vger.kernel.org; stable@kernel.org
>Subject: Re: [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a
>NULL pointer dereference
>
>On Wed, 31 Aug 2011 20:08:45 +0000 (UTC)
>Naga Chumbalkar <nagananda.chumbalkar@hp.com> wrote:
>
>> If, for whatever reason, "pr" ends up being NULL we would end up in a
>PANIC
>> as seen below:
>>
>> Loading CPUFreq modules[ 437.661360] BUG: unable to handle kernel
>NULL pointer
>> dereference at (null)
>> IP: [<ffffffffa0434314>] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq]
>>
>> It's better to prevent the PANIC by failing the driver, and allowing
>the system to boot.
>>
>> Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
>> Cc: stable@kernel.org
>>
>> diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-
>cpufreq.c
>> index 7b0603e..cdc02ac 100644
>> --- a/drivers/cpufreq/pcc-cpufreq.c
>> +++ b/drivers/cpufreq/pcc-cpufreq.c
>> @@ -261,6 +261,9 @@ static int pcc_get_offset(int cpu)
>> pr = per_cpu(processors, cpu);
>> pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu);
>>
>> + if (!pr)
>> + return -ENODEV;
>> +
>> status = acpi_evaluate_object(pr->handle, "PCCP", NULL, &buffer);
>> if (ACPI_FAILURE(status))
>> return -ENODEV;
>
>hm, from reading drivers/acpi/processor_driver.c it appears that
>per_cpu(processors, n)==NULL is an expected and valid state. Heaven
>knows what that state actually *means* - apparently this is a secret.
>
>I assume that you've hit this crash in real live code, hence your
>suggestion of a -stable backport?
Yes - the above oops can be reproduced on a shipping Linux distro when,
for x2APIC implementations, the BIOS does not use the ACPI "Device"
declaration for processors with Local APIC ID >= 255. Such a declaration
is necessitated by Sec 8.4 of ACPI 4.0a.
- naga -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-12 17:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 20:08 [PATCH] cpufreq: pcc-cpufreq: sanity check to prevent a NULL pointer dereference Naga Chumbalkar
2011-09-08 23:52 ` Andrew Morton
2011-09-12 17:05 ` Chumbalkar, Nagananda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome