Linux ACPI
 help / color / mirror / Atom feed
From: Betty Dall <betty.dall@hp.com>
To: lenb@kernel.org, rjw@rjwysocki.net, bhelgaas@google.com
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, Betty Dall <betty.dall@hp.com>
Subject: [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse()
Date: Fri, 13 Dec 2013 08:23:16 -0700	[thread overview]
Message-ID: <1386948196-9409-1-git-send-email-betty.dall@hp.com> (raw)

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) {

             reply	other threads:[~2013-12-13 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 15:23 Betty Dall [this message]
2013-12-13 22:16 ` [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386948196-9409-1-git-send-email-betty.dall@hp.com \
    --to=betty.dall@hp.com \
    --cc=bhelgaas@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox