From patchwork Fri Oct 2 18:44:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 525710 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 99B841402C4 for ; Sat, 3 Oct 2015 04:46:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=bAXoVwTj; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753383AbbJBSoQ (ORCPT ); Fri, 2 Oct 2015 14:44:16 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:38074 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753411AbbJBSoN (ORCPT ); Fri, 2 Oct 2015 14:44:13 -0400 Received: by igxx6 with SMTP id x6so22515115igx.1; Fri, 02 Oct 2015 11:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5geoOdYsBddzorVbxEjfu1WDJB6hv7Zbm+yT3q2lZyg=; b=bAXoVwTjuUxwDGoyEHhhUnReppxf3KhD/u7QJ4fcBZwStlZPtindQ3Gv802dzA4Amx O4PdpTRolc4wi8NFj7YA72AOHY+SmWU7w/JGSCGubjzLCs7XsLF69aNuthNYiua5SJ1X SAX9Rnm5rJsH8eowF6iqp7ZSl9CtSanoLR2SxAZhKxjU+7OK0HNeCpmgr1Ozedv2bO13 Yx1IbMnZbLIxslps3G3ZI59IKv2lreaKVMgAIYSpPGR5hX2ZI7DE3zuP755qFnoC/RRR rUWdbUD+1DjfNFmPNHv/2TMihLDlpS6vUG5dw3xuqbp8TttpLKjpYWRE6VxOCFwypnk0 28RA== X-Received: by 10.50.47.81 with SMTP id b17mr432915ign.39.1443811452242; Fri, 02 Oct 2015 11:44:12 -0700 (PDT) Received: from dl.caveonetworks.com (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id ql6sm115743igc.15.2015.10.02.11.44.09 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 Oct 2015 11:44:10 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id t92Ii8gh018938; Fri, 2 Oct 2015 11:44:08 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t92Ii8IE018937; Fri, 2 Oct 2015 11:44:08 -0700 From: David Daney To: linux-kernel@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Will Deacon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Marc Zyngier Cc: David Daney Subject: [PATCH v4 5/5] PCI: generic: Pass proper starting bus number to pci_scan_root_bus(). Date: Fri, 2 Oct 2015 11:44:03 -0700 Message-Id: <1443811443-18878-6-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1443811443-18878-1-git-send-email-ddaney.cavm@gmail.com> References: <1443811443-18878-1-git-send-email-ddaney.cavm@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: David Daney If the bus is being configured with a bus-range that does not start at zero, pass that starting bus number to pci_scan_root_bus(). Passing the incorrect value of zero causes attempted config accesses outside of the supported range, which cascades to an OOPs spew and eventual kernel panic. Acked-by: Will Deacon Signed-off-by: David Daney --- No change from v3. drivers/pci/host/pci-host-generic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 5cce837..eb4b7c7 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c @@ -264,7 +264,8 @@ static int gen_pci_probe(struct platform_device *pdev) if (!pci_has_flag(PCI_PROBE_ONLY)) pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); - bus = pci_scan_root_bus(dev, 0, + + bus = pci_scan_root_bus(dev, pci->cfg.bus_range->start, &pci->cfg.ops->ops, pci, &pci->resources); if (!bus) { dev_err(dev, "Scanning rootbus failed");