From patchwork Fri Nov 23 02:50:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 201235 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id C78312C01FD for ; Fri, 23 Nov 2012 13:50:40 +1100 (EST) Received: from mail-da0-f51.google.com (mail-da0-f51.google.com [209.85.210.51]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 64CE72C0097 for ; Fri, 23 Nov 2012 13:50:11 +1100 (EST) Received: by mail-da0-f51.google.com with SMTP id i30so1941950dad.38 for ; Thu, 22 Nov 2012 18:50:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:x-gm-message-state; bh=Xs5AVf7OJb3kQ7C7cD+kfqWmunyu5h4AbqOVjADppik=; b=lQvS0HltAMLadlyx8YR0FhFCy+5q4f1ymRsFVNAa0QrslSmyvpDSC4KwKcM73R7KkL ZI5x/DWrrvA6Vb7yBCTEtm7II9NEvqgdGzk15Ejo0dn22fCH9hNw7ls+T4IPWlQEHeqn 9FTNWQI3F8JlF9IPIWRBsDII7KEw5qtub8kxGZ+DqYfwCq6WjnFIV8VvD1zHIsitzhv2 oKEhLk64ZywOE5K/KBDHlcYBByIspZ00bvb0E8lUayzROPIlZvP5OpvZPdBjV8r7gNTA ecvhaYuy79Iput9AJtHdFxuCcLBrteyt6JUzc3v+SZmwk8WnrzgAtjknrCFshe0OTXnb snyw== Received: by 10.68.194.169 with SMTP id hx9mr10029757pbc.98.1353639009186; Thu, 22 Nov 2012 18:50:09 -0800 (PST) Received: from [10.61.2.175] (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id tm8sm2983094pbc.48.2012.11.22.18.50.06 (version=SSLv3 cipher=OTHER); Thu, 22 Nov 2012 18:50:08 -0800 (PST) Message-ID: <50AEE45C.80603@ozlabs.ru> Date: Fri, 23 Nov 2012 13:50:04 +1100 From: Alexey Kardashevskiy User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: Benjamin Herrenschmidt Subject: [PATCH] powerpc/pseries: Fix kernel crash caused by NULL PE X-Gm-Message-State: ALoCoQmVFP/6EsyJEGXVql6qFZcsupbxHcqsLtSVOr4h/bQAgjhXsCTCm3/fBdbp9MXLOs2LCq/E Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, David Gibson X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" While hooking MSI interrupts, the corresponding device tree node of the PE that the PCI device has been put into should be checked. However, those PCI devices (e.g. VirtIO based PCI devices) that don't have EEH capability shouldn't have the associated PE. So we shouldn't try to get the PE's device tree node. Otherwise, it would cause kernel crash. Actually, it was introduced by commit 66523d9f ("powerpc/eeh: Trace error based on PE from beginning"). Signed-off-by: Alexey Kardashevskiy Signed-off-by: Gavin Shan --- arch/powerpc/platforms/pseries/msi.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index d19f497..9284e42 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -218,9 +218,16 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) if (!dn) return NULL; - /* Get the top level device in the PE */ + /* + * Get the top level device in the PE, but some PCI devices + * without EEH capability (e.g. VirtIO based PCI devices) + * don't have the associated PE. So we should not get the + * top level device from PE for those PCI devices. + */ edev = of_node_to_eeh_dev(dn); - edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); + if (edev->pe) + edev = list_first_entry(&edev->pe->edevs, + struct eeh_dev, list); dn = eeh_dev_to_of_node(edev); if (!dn) return NULL;