Skip to content
/ linux Public

Commit edf4c2a

Browse files
rafaeljwgregkh
authored andcommitted
ACPI: processor: Fix previous acpi_processor_errata_piix4() fix
[ Upstream commit bf504b2 ] After commi f132e08 ("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: f132e08 ("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a6dc742 commit edf4c2a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
102102
PCI_ANY_ID, PCI_ANY_ID, NULL);
103103
if (ide_dev) {
104104
errata.piix4.bmisx = pci_resource_start(ide_dev, 4);
105+
if (errata.piix4.bmisx)
106+
dev_dbg(&ide_dev->dev,
107+
"Bus master activity detection (BM-IDE) erratum enabled\n");
108+
105109
pci_dev_put(ide_dev);
106110
}
107111

@@ -120,20 +124,17 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
120124
if (isa_dev) {
121125
pci_read_config_byte(isa_dev, 0x76, &value1);
122126
pci_read_config_byte(isa_dev, 0x77, &value2);
123-
if ((value1 & 0x80) || (value2 & 0x80))
127+
if ((value1 & 0x80) || (value2 & 0x80)) {
124128
errata.piix4.fdma = 1;
129+
dev_dbg(&isa_dev->dev,
130+
"Type-F DMA livelock erratum (C3 disabled)\n");
131+
}
125132
pci_dev_put(isa_dev);
126133
}
127134

128135
break;
129136
}
130137

131-
if (ide_dev)
132-
dev_dbg(&ide_dev->dev, "Bus master activity detection (BM-IDE) erratum enabled\n");
133-
134-
if (isa_dev)
135-
dev_dbg(&isa_dev->dev, "Type-F DMA livelock erratum (C3 disabled)\n");
136-
137138
return 0;
138139
}
139140

0 commit comments

Comments
 (0)