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

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: processor: Fix previous acpi_processor_errata_piix4() fix

After commi f132e089fe89 ("ACPI: processor: Fix NULL-pointer dereference
in acpi_processor_errata_piix4()"), device pointers may be dereferenced
after dropping references to the device objects pointed to by them,
which may cause a use-after-free to occur.

Moreover, debug messages about enabling the errata may be printed
if the errata flags corresponding to them are unset.

Address all of these issues by moving message printing to the points
in the code where the errata flags are set.

Fixes: f132e089fe89 ("ACPI: processor: Fix NULL-pointer dereference in acpi_processor_errata_piix4()")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/linux-acpi/938e2206-def5-4b7a-9b2c-d1fd37681d8a@roeck-us.net/
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/5975693.DvuYhMxLoT@rafael.j.wysocki

+8 -7
+8 -7
drivers/acpi/acpi_processor.c
··· 113 113 PCI_ANY_ID, PCI_ANY_ID, NULL); 114 114 if (ide_dev) { 115 115 errata.piix4.bmisx = pci_resource_start(ide_dev, 4); 116 + if (errata.piix4.bmisx) 117 + dev_dbg(&ide_dev->dev, 118 + "Bus master activity detection (BM-IDE) erratum enabled\n"); 119 + 116 120 pci_dev_put(ide_dev); 117 121 } 118 122 ··· 135 131 if (isa_dev) { 136 132 pci_read_config_byte(isa_dev, 0x76, &value1); 137 133 pci_read_config_byte(isa_dev, 0x77, &value2); 138 - if ((value1 & 0x80) || (value2 & 0x80)) 134 + if ((value1 & 0x80) || (value2 & 0x80)) { 139 135 errata.piix4.fdma = 1; 136 + dev_dbg(&isa_dev->dev, 137 + "Type-F DMA livelock erratum (C3 disabled)\n"); 138 + } 140 139 pci_dev_put(isa_dev); 141 140 } 142 141 143 142 break; 144 143 } 145 - 146 - if (ide_dev) 147 - dev_dbg(&ide_dev->dev, "Bus master activity detection (BM-IDE) erratum enabled\n"); 148 - 149 - if (isa_dev) 150 - dev_dbg(&isa_dev->dev, "Type-F DMA livelock erratum (C3 disabled)\n"); 151 144 152 145 return 0; 153 146 }