Skip to contentSkip to conversation

ACPI / APEI: Fix parsing HEST that includes Deferred Machine Check subtable

PATCH In review Ghannam, Yazen 3 participants 3 messages Nov 12, 2018 – Jan 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / APEI: Fix parsing HEST that includes Deferred Machine Check subtable

From: Yazen Ghannam <[email protected]>

ACPI 6.2 includes a new definition for a Deferred Machine Check "DMC" subtable.

The definition of this subtable was included in following commit:

c042933df2b1 ("ACPICA: Add support for new HEST subtable")

However, the HEST parsing function was not updated to include this new subtable. Therefore, Linux will fail to parse the HEST on systems that include a DMC entry.

Add the length check for the new DMC subtable so that HEST parsing doesn't fail on systems that include it.

---
 drivers/acpi/apei/hest.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/apei/hest.c +6 -0
index b1e9f81ebeea..0935a0ef37e5 100644
@@ -53,6 +53,7 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
 	[ACPI_HEST_TYPE_AER_BRIDGE] = sizeof(struct acpi_hest_aer_bridge),
 	[ACPI_HEST_TYPE_GENERIC_ERROR] = sizeof(struct acpi_hest_generic),
 	[ACPI_HEST_TYPE_GENERIC_ERROR_V2] = sizeof(struct acpi_hest_generic_v2),
+	[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
@@ -75,6 +76,11 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 		mc = (struct acpi_hest_ia_machine_check *)hest_hdr;
 		len = sizeof(*mc) + mc->num_hardware_banks *
 			sizeof(struct acpi_hest_ia_error_bank);
+	} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
+		struct acpi_hest_ia_deferred_check *mc;
+		mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
+		len = sizeof(*mc) + mc->num_hardware_banks *
+			sizeof(struct acpi_hest_ia_error_bank);
 	}
 	BUG_ON(len == -1);
 
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 36 lines · Yazen

From: Yazen Ghannam <[email protected]>

ACPI 6.2 includes a new definition for a Deferred Machine Check "DMC" subtable.

The definition of this subtable was included in following commit:

c042933df2b1 ("ACPICA: Add support for new HEST subtable")

However, the HEST parsing function was not updated to include this new subtable. Therefore, Linux will fail to parse the HEST on systems that include a DMC entry.

Add the length check for the new DMC subtable so that HEST parsing doesn't fail on systems that include it.

---
 drivers/acpi/apei/hest.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/apei/hest.c +1 -0
index b1e9f81ebeea..0935a0ef37e5 100644
@@ -53,6 +53,7 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
 	[ACPI_HEST_TYPE_AER_BRIDGE] = sizeof(struct acpi_hest_aer_bridge),
 	[ACPI_HEST_TYPE_GENERIC_ERROR] = sizeof(struct acpi_hest_generic),
 	[ACPI_HEST_TYPE_GENERIC_ERROR_V2] = sizeof(struct acpi_hest_generic_v2),
+	[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
@@ -75,6 +76,11 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 		mc = (struct acpi_hest_ia_machine_check *)hest_hdr;

drivers/acpi/apei/hest.c static int hest_esrc_len(struct acpi_hest_header *hest_hdr) · line 86

Quoted 10 lines
drivers/acpi/apei/hest.c +5 -0
 		len = sizeof(*mc) + mc->num_hardware_banks *
 			sizeof(struct acpi_hest_ia_error_bank);
+	} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
+		struct acpi_hest_ia_deferred_check *mc;
+		mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
+		len = sizeof(*mc) + mc->num_hardware_banks *
+			sizeof(struct acpi_hest_ia_error_bank);
 	}
 	BUG_ON(len == -1);
 
Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#2 lore raw
Quoted 33 lines · CET Borislav Petkov
Quoted 32 lines · Yazen

From: Yazen Ghannam <[email protected]>

ACPI 6.2 includes a new definition for a Deferred Machine Check "DMC" subtable.

The definition of this subtable was included in following commit:

c042933df2b1 ("ACPICA: Add support for new HEST subtable")

However, the HEST parsing function was not updated to include this new subtable. Therefore, Linux will fail to parse the HEST on systems that include a DMC entry.

Add the length check for the new DMC subtable so that HEST parsing doesn't fail on systems that include it.

---
 drivers/acpi/apei/hest.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/acpi/apei/hest.c +1 -0
index b1e9f81ebeea..0935a0ef37e5 100644
@@ -53,6 +53,7 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
 	[ACPI_HEST_TYPE_AER_BRIDGE] = sizeof(struct acpi_hest_aer_bridge),
 	[ACPI_HEST_TYPE_GENERIC_ERROR] = sizeof(struct acpi_hest_generic),
 	[ACPI_HEST_TYPE_GENERIC_ERROR_V2] = sizeof(struct acpi_hest_generic_v2),
+	[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
 };
 
Quoted 15 lines

drivers/acpi/apei/hest.c static int hest_esrc_len(struct acpi_hest_header *hest_hdr) · line 86

Quoted 13 lines
drivers/acpi/apei/hest.c +5 -0
 static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
@@ -75,6 +76,11 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
 		mc = (struct acpi_hest_ia_machine_check *)hest_hdr;
 		len = sizeof(*mc) + mc->num_hardware_banks *
 			sizeof(struct acpi_hest_ia_error_bank);
+	} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
+		struct acpi_hest_ia_deferred_check *mc;
+		mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
+		len = sizeof(*mc) + mc->num_hardware_banks *
+			sizeof(struct acpi_hest_ia_error_bank);
 	}
 	BUG_ON(len == -1);
 

Patch applied, thanks!