]> Git Repo - linux.git/commitdiff
drivers/cpufreq/pcc-cpufreq.c: avoid NULL pointer dereference
authorNaga Chumbalkar <[email protected]>
Wed, 14 Sep 2011 23:22:23 +0000 (16:22 -0700)
committerLinus Torvalds <[email protected]>
Thu, 15 Sep 2011 01:09:38 +0000 (18:09 -0700)
per_cpu(processors, n) can be NULL, resulting in:

  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 avoid the oops by failing the driver, and allowing the
system to boot.

Signed-off-by: Naga Chumbalkar <[email protected]>
Cc: Dave Jones <[email protected]>
Cc: Len Brown <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/cpufreq/pcc-cpufreq.c

index 7b0603eb01297a7088c24d0ab1101e5e9625713b..cdc02ac8f41a7ff5d3f121e2b0927fd8bf99ae7a 100644 (file)
@@ -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;
This page took 0.059312 seconds and 4 git commands to generate.