linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse()
@ 2013-12-13 15:23 Betty Dall
  2013-12-13 22:16 ` Bjorn Helgaas
  0 siblings, 1 reply; 6+ messages in thread
From: Betty Dall @ 2013-12-13 15:23 UTC (permalink / raw)
  To: lenb, rjw, bhelgaas; +Cc: linux-acpi, linux-kernel, linux-pci, Betty Dall

aer_hest_parse() could pass a non-AER HEST error source to the function
hest_match_pci(). hest_match_pci() assumes that the HEST error source is
type ACPI_HEST_TYPE_AER_ROOT_PORT, ACPI_HEST_TYPE_AER_ENDPOINT, or
ACPI_HEST_TYPE_AER_BRIDGE. I have a platform that has some
ACPI_HEST_TYPE_GENERIC error sources where hest_match_pci() was trying to
access the structure as if it had the acpi_hest_aer_common fields.

aer_hest_parse() is only ever interested in the AER type HEST error
sources. Add a check on the type of the error souce at the beginning of
aer_hest_parse().

Signed-off-by: Betty Dall <betty.dall@hp.com>
---

 drivers/pci/pcie/aer/aerdrv_acpi.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index cf611ab..39186e3 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -56,6 +56,10 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data)
 	struct acpi_hest_aer_common *p;
 	int ff;
 
+	if (hest_hdr->type != ACPI_HEST_TYPE_AER_ROOT_PORT &&
+		hest_hdr->type != ACPI_HEST_TYPE_AER_ENDPOINT &&
+		hest_hdr->type != ACPI_HEST_TYPE_AER_BRIDGE)
+		return 0;
 	p = (struct acpi_hest_aer_common *)(hest_hdr + 1);
 	ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST);
 	if (p->flags & ACPI_HEST_GLOBAL) {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-16 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13 15:23 [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse() Betty Dall
2013-12-13 22:16 ` Bjorn Helgaas
2013-12-13 22:47   ` Betty Dall
2013-12-13 23:06     ` Bjorn Helgaas
2013-12-16 15:15       ` Betty Dall
2013-12-16 19:12         ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).