Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-urgent-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull two ACPI CPPC fixes from Rafael Wysocki:
"One of them fixes a crash in KVM encountered by Sebastian in
linux-next and introduced by a recent intel_pstate change that caused
the driver to use the ACPI CPPC code and uncovered a missing NULL
pointer check in it.

The other one fixes a possible use-after-free in the same code area.

Summary:

- Fix a crash in KVM encountered in linux-next and introduced by a
recent intel_pstate change that caused the driver to use the ACPI
CPPC code and uncovered a missing NULL pointer check in it
(Sebastian Andrzej Siewior).

- Fix a possible use-after-free in the same code area (Rafael
Wysocki)"

* tag 'acpi-urgent-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI / CPPC: Fix per-CPU pointer management in acpi_cppc_processor_probe()
ACPI / CPPC: Fix crash in acpi_cppc_processor_exit()

+8 -4
+8 -4
drivers/acpi/cppc_acpi.c
··· 776 776 init_waitqueue_head(&pcc_data.pcc_write_wait_q); 777 777 } 778 778 779 - /* Plug PSD data into this CPUs CPC descriptor. */ 780 - per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr; 781 - 782 779 /* Everything looks okay */ 783 780 pr_debug("Parsed CPC struct for CPU: %d\n", pr->id); 784 781 ··· 786 789 goto out_free; 787 790 } 788 791 792 + /* Plug PSD data into this CPUs CPC descriptor. */ 793 + per_cpu(cpc_desc_ptr, pr->id) = cpc_ptr; 794 + 789 795 ret = kobject_init_and_add(&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj, 790 796 "acpi_cppc"); 791 - if (ret) 797 + if (ret) { 798 + per_cpu(cpc_desc_ptr, pr->id) = NULL; 792 799 goto out_free; 800 + } 793 801 794 802 kfree(output.pointer); 795 803 return 0; ··· 828 826 void __iomem *addr; 829 827 830 828 cpc_ptr = per_cpu(cpc_desc_ptr, pr->id); 829 + if (!cpc_ptr) 830 + return; 831 831 832 832 /* Free all the mapped sys mem areas for this CPU */ 833 833 for (i = 2; i < cpc_ptr->num_entries; i++) {