From patchwork Wed Jun 16 15:16:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kirjanov X-Patchwork-Id: 55895 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id E5736100B3A for ; Thu, 17 Jun 2010 01:17:12 +1000 (EST) Received: by ozlabs.org (Postfix) id 943481007D5; Thu, 17 Jun 2010 01:17:06 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D07F1007D4 for ; Thu, 17 Jun 2010 01:17:05 +1000 (EST) Received: from hera.kernel.org (localhost [127.0.0.1]) by hera.kernel.org (8.14.4/8.14.3) with ESMTP id o5GFGxCX020578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jun 2010 15:16:59 GMT X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.95.2 at hera.kernel.org Received: (from dkirjanov@localhost) by hera.kernel.org (8.14.4/8.14.3/Submit) id o5GFGxbI020572; Wed, 16 Jun 2010 15:16:59 GMT Date: Wed, 16 Jun 2010 15:16:59 +0000 From: Denis Kirjanov To: benh@kernel.crashing.org, sfr@canb.auug.org.au Subject: [PATCH] powerpc/iseries: fix possible null pointer dereference in iSeries_pcibios_fixup_resources Message-ID: <20100616151659.GA17669@hera.kernel.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_24_48 autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Wed, 16 Jun 2010 15:16:59 +0000 (UTC) Cc: linuxppc-dev@ozlabs.org, anton@samba.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org I don't know if this is a right fix for the problem since of_get_property can return NULL. Since iseries_device_information is used only for informational purpose, we can skip this function without valid HvSubBusNumber number. Signed-off-by: Denis Kirjanov --- arch/powerpc/platforms/iseries/pci.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index 3fc2e64..ab3962b 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c @@ -445,7 +445,11 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev) } allocate_device_bars(pdev); - iseries_device_information(pdev, bus, *sub_bus); + if (likely(sub_bus)) + iseries_device_information(pdev, bus, *sub_bus); + else + printk(KERN_ERR "PCI: Device node %s has missing or invalid " + "linux,subbus property\n", node->full_name); } /*