Skip to contentSkip to conversation

trival: fix acpi_hest_firmware_first_pci() caused oops

PATCH In review Shaohua Li 2 participants 4 messages Apr 8, 2010 – May 6, 2010 ACPI

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

PATCH 1/1 trival: fix acpi_hest_firmware_first_pci() caused oops

acpi_hest_firmware_first_pci() could be called when acpi is disabled and cause system oops.

---
 drivers/acpi/hest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/acpi/hest.c +4 -0
index 4bb18c9..1c527a1 100644
@@ -123,6 +123,10 @@ int acpi_hest_firmware_first_pci(struct pci_dev *pci)
 {
 	acpi_status status = AE_NOT_FOUND;
 	struct acpi_table_header *hest = NULL;
+
+	if (acpi_disabled)
+		return 0;
+
 	status = acpi_get_table(ACPI_SIG_HEST, 1, &hest);
 
 	if (ACPI_SUCCESS(status)) {
Signature · 1 line
1.6.3.3
reviewer
#1 lore raw

wouldn't it be better for acpi_get_table()
to return failure for acpi=off?

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 31 lines · Shaohua Li

acpi_hest_firmware_first_pci() could be called when acpi is disabled and cause system oops.

---
 drivers/acpi/hest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/acpi/hest.c +4 -0
index 4bb18c9..1c527a1 100644
@@ -123,6 +123,10 @@ int acpi_hest_firmware_first_pci(struct pci_dev *pci)
 {
 	acpi_status status = AE_NOT_FOUND;
 	struct acpi_table_header *hest = NULL;
+
+	if (acpi_disabled)
+		return 0;
+
 	status = acpi_get_table(ACPI_SIG_HEST, 1, &hest);
 
 	if (ACPI_SUCCESS(status)) {
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw

On Tue, Apr 20, 2010 at 11:01:21PM +0800, Len Brown wrote:
Hmm, the mail is sent at Apr 20, I received it at Apr 29 :(

Quoted 2 lines

wouldn't it be better for acpi_get_table()
to return failure for acpi=off?

but acpi_disabled is a linux variable while acpi_get_table is ACPICA code.

Thanks,
Shaohua

Quoted 34 lines · Shaohua Li
Quoted 32 lines

acpi_hest_firmware_first_pci() could be called when acpi is disabled and cause system oops.

---
 drivers/acpi/hest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/acpi/hest.c +4 -0
index 4bb18c9..1c527a1 100644
@@ -123,6 +123,10 @@ int acpi_hest_firmware_first_pci(struct pci_dev *pci)
 {
 	acpi_status status = AE_NOT_FOUND;
 	struct acpi_table_header *hest = NULL;
+
+	if (acpi_disabled)
+		return 0;
+
 	status = acpi_get_table(ACPI_SIG_HEST, 1, &hest);
 
 	if (ACPI_SUCCESS(status)) {
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
reviewer
#3 lore raw
Quoted 5 lines
Quoted 3 lines

wouldn't it be better for acpi_get_table()
to return failure for acpi=off?

but acpi_disabled is a linux variable while acpi_get_table is ACPICA code.

For the acpi_disabled case, acpi_get_table() will return AE_NOT_FOUND because acpi_gbl_root_table_list.count == 0,
and leave the table pointer unchanged at NULL, yes?

Looking at the other callers of acpi_get_table(), they all seem to be called when acpi is enabled and they know the table in question is going to be there. So I guess it is consistent for hest.c to know this too. But it looks like acpi_get_table() should fail gracefully, so why do we take a fault?

-Len