From patchwork Fri Dec 13 22:16:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3342661 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DC33B9F2A9 for ; Fri, 13 Dec 2013 22:16:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10FF820603 for ; Fri, 13 Dec 2013 22:16:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3087B20607 for ; Fri, 13 Dec 2013 22:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848Ab3LMWQZ (ORCPT ); Fri, 13 Dec 2013 17:16:25 -0500 Received: from mail-ie0-f171.google.com ([209.85.223.171]:54914 "EHLO mail-ie0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752825Ab3LMWQY (ORCPT ); Fri, 13 Dec 2013 17:16:24 -0500 Received: by mail-ie0-f171.google.com with SMTP id ar20so3759904iec.2 for ; Fri, 13 Dec 2013 14:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=NxFdvYQmldVGhw8p3vzzAgpEZXHoWUtQH9FTnionVZI=; b=ToG7bQluB78nL/KE+rO/8IFm8UouOumGCrRjqVz/NViwtDeiquuTkMWJZftbt1D7Uu bB+sK6cM0fMTwu6/SzPdlgAZV84fM4rXptiDYhZWeLdr8xIO+VQ7WRLfNoQ3ddqtXUOT BUSnHi+v6PysLMp8j92ZZ61PuUFyBx4oh9L0vhIGqrCMpQVOCsPsMQzLqrK//eb4iRAX jdSCK+YqAq0ci3BbhGh8RDXbzRYpUK28JopI0MFjeq/NY6HVROzvNkaw8M7UtLPlx4St 0/HGOmPIJShDEhwKHQB/nMA79xV88Nn0/85pegfbvcWWOJ98xwT8TAVEnHYDOX7qJX/b kTTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=NxFdvYQmldVGhw8p3vzzAgpEZXHoWUtQH9FTnionVZI=; b=XSmv7qUlfdnzDZY+f4ik7o3fBwNgqbDAMp29GlonK+xc5tRgteFpg8EJUjREalNhJp 3y3e1ATUZzJVVEOLvo7i+sZuRacDs0DDbUsD1j97LSlx0lZYoVfodGvL07GZgSu6336t xq3+BO1HjJy0hT61kAIRG0Cls1SVyOjfqXPY8LwE2Dq2WbC8ho3ry8+XuQtx/oSfiSj3 Ru74uG5djdI7fKWwhK3yK+Kna1poz3Jxdz4MPwEP1YqB2yxv5UMOU5xG+j5bfVZCNtrE krVwjTlSahFHT4a09SdHlRwicEMvb0oBJRnoEH6Cr7Z0s0rVcWvsWiBRIHDHpYDgp4Lo kuLg== X-Gm-Message-State: ALoCoQmjY/gl3RZ10ATigZkbcvkvMSGp2vtWDuqzI9butB1wOG9/LLS1jEpARTqwimEYxrV/Jm1Dn4d38HenRlXoSHN9y6w0o6rUzVfzJcos8dyettUd9g9gpzdrFvUnJV8LL7Tv4ea1OAXUq++gNphoCiy6NFWhdIwB7n/jZ5Rq9omC5bF8G5uPe/1AySQKKlaLFdsGnSqiImdVHQ7nREyWIqgpeVu1iQ== X-Received: by 10.50.83.97 with SMTP id p1mr4766314igy.41.1386972983660; Fri, 13 Dec 2013 14:16:23 -0800 (PST) Received: from google.com ([172.16.48.173]) by mx.google.com with ESMTPSA id w4sm1116149igb.5.2013.12.13.14.16.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:16:22 -0800 (PST) Date: Fri, 13 Dec 2013 15:16:16 -0700 From: Bjorn Helgaas To: Betty Dall Cc: lenb@kernel.org, rjw@rjwysocki.net, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] PCI AER: Handle non-AER HEST error sources in aer_hest_parse() Message-ID: <20131213221616.GC6746@google.com> References: <1386948196-9409-1-git-send-email-betty.dall@hp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1386948196-9409-1-git-send-email-betty.dall@hp.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FSL_HELO_FAKE, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Dec 13, 2013 at 08:23:16AM -0700, Betty Dall wrote: > 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(-) > > > 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) { Hi Betty, I propose the following tweaked version. Will this work for you? PCI/AER: Ingore non-PCIe AER error sources in aer_hest_parse() From: Betty Dall aer_set_firmware_first() searches the HEST for an error source descriptor matching the specified PCI device. It uses the apei_hest_parse() iterator to call aer_hest_parse() for every descriptor in the HEST. Previously, aer_hest_parse() incorrectly assumed every descriptor was for a PCIe error source. This patch adds a check to avoid that error. [bhelgaas: factor check into helper function, changelog] Signed-off-by: Betty Dall Signed-off-by: Bjorn Helgaas --- drivers/pci/pcie/aer/aerdrv_acpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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 cf611ab2193a..f670313479ee 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c @@ -50,12 +50,24 @@ struct aer_hest_parse_info { int firmware_first; }; +static int hest_source_is_pcie_aer(struct acpi_hest_header *hest_hdr) +{ + 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 1; + return 0; +} + static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) { struct aer_hest_parse_info *info = data; struct acpi_hest_aer_common *p; int ff; + if (!hest_source_is_pcie_aer(hest_hdr)) + return 0; + p = (struct acpi_hest_aer_common *)(hest_hdr + 1); ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); if (p->flags & ACPI_HEST_GLOBAL) {