diff options
| author | Pallipadi, Venkatesh <venkatesh.pallipadi@intel.com> | 2009-06-19 20:14:59 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2009-06-20 00:50:52 -0400 |
| commit | 7b768f07dce463a054c9dd84862d15ccc3d2b712 (patch) | |
| tree | 1c7a2509e1bca6718fd29e897f44b648089f728b | |
| parent | 07a2039b8eb0af4ff464efd3dfd95de5c02648c6 (diff) | |
ACPI: pdc init related memory leak with physical CPU hotplug
arch_acpi_processor_cleanup_pdc() in x86 and ia64 results in memory allocated
for _PDC objects that is never freed and will cause memory leak in case of
physical CPU remove and add. Patch fixes the memory leak by freeing the
objects soon after _PDC is evaluated.
Reported-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | arch/ia64/kernel/acpi-processor.c | 12 | ||||
| -rw-r--r-- | arch/x86/kernel/acpi/processor.c | 13 | ||||
| -rw-r--r-- | drivers/acpi/processor_core.c | 2 | ||||
| -rw-r--r-- | include/acpi/processor.h | 1 |
4 files changed, 28 insertions, 0 deletions
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c index cbe6cee5a550..dbda7bde6112 100644 --- a/arch/ia64/kernel/acpi-processor.c +++ b/arch/ia64/kernel/acpi-processor.c | |||
| @@ -71,3 +71,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); | 73 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); |
| 74 | |||
| 75 | void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr) | ||
| 76 | { | ||
| 77 | if (pr->pdc) { | ||
| 78 | kfree(pr->pdc->pointer->buffer.pointer); | ||
| 79 | kfree(pr->pdc->pointer); | ||
| 80 | kfree(pr->pdc); | ||
| 81 | pr->pdc = NULL; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc); | ||
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c index 7c074eec39fb..d296f4a195c9 100644 --- a/arch/x86/kernel/acpi/processor.c +++ b/arch/x86/kernel/acpi/processor.c | |||
| @@ -72,6 +72,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | |||
| 72 | return; | 72 | return; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | |||
| 75 | /* Initialize _PDC data based on the CPU vendor */ | 76 | /* Initialize _PDC data based on the CPU vendor */ |
| 76 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | 77 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) |
| 77 | { | 78 | { |
| @@ -85,3 +86,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | |||
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); | 88 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); |
| 89 | |||
| 90 | void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr) | ||
| 91 | { | ||
| 92 | if (pr->pdc) { | ||
| 93 | kfree(pr->pdc->pointer->buffer.pointer); | ||
| 94 | kfree(pr->pdc->pointer); | ||
| 95 | kfree(pr->pdc); | ||
| 96 | pr->pdc = NULL; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc); | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 23f0fb84f1c1..d40d45e904a5 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -731,6 +731,8 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
| 731 | /* _PDC call should be done before doing anything else (if reqd.). */ | 731 | /* _PDC call should be done before doing anything else (if reqd.). */ |
| 732 | arch_acpi_processor_init_pdc(pr); | 732 | arch_acpi_processor_init_pdc(pr); |
| 733 | acpi_processor_set_pdc(pr); | 733 | acpi_processor_set_pdc(pr); |
| 734 | arch_acpi_processor_cleanup_pdc(pr); | ||
| 735 | |||
| 734 | #ifdef CONFIG_CPU_FREQ | 736 | #ifdef CONFIG_CPU_FREQ |
| 735 | acpi_processor_ppc_has_changed(pr); | 737 | acpi_processor_ppc_has_changed(pr); |
| 736 | #endif | 738 | #endif |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 4927c063347c..baf1e0a9a7ee 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
| @@ -258,6 +258,7 @@ DECLARE_PER_CPU(struct acpi_processor *, processors); | |||
| 258 | extern struct acpi_processor_errata errata; | 258 | extern struct acpi_processor_errata errata; |
| 259 | 259 | ||
| 260 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr); | 260 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr); |
| 261 | void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr); | ||
| 261 | 262 | ||
| 262 | #ifdef ARCH_HAS_POWER_INIT | 263 | #ifdef ARCH_HAS_POWER_INIT |
| 263 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, | 264 | void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, |
