From patchwork Fri Dec 13 15:23:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Betty Dall X-Patchwork-Id: 301059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C48162C009C for ; Sat, 14 Dec 2013 02:32:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752463Ab3LMPcn (ORCPT ); Fri, 13 Dec 2013 10:32:43 -0500 Received: from g4t0017.houston.hp.com ([15.201.24.20]:8643 "EHLO g4t0017.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752045Ab3LMPcm (ORCPT ); Fri, 13 Dec 2013 10:32:42 -0500 Received: from g9t2301.houston.hp.com (g9t2301.houston.hp.com [16.216.185.78]) by g4t0017.houston.hp.com (Postfix) with ESMTP id A9D8038007; Fri, 13 Dec 2013 15:32:41 +0000 (UTC) Received: from linux1.fc.hp.com (linux1.fc.hp.com [16.71.12.34]) by g9t2301.houston.hp.com (Postfix) with ESMTP id 0525167; Fri, 13 Dec 2013 15:32:40 +0000 (UTC) From: Betty Dall 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 Subject: [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse() Date: Fri, 13 Dec 2013 08:23:16 -0700 Message-Id: <1386948196-9409-1-git-send-email-betty.dall@hp.com> X-Mailer: git-send-email 1.7.7.6 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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 --- drivers/pci/pcie/aer/aerdrv_acpi.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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) {