From patchwork Mon Oct 17 21:44:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Li X-Patchwork-Id: 9380851 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 39957600CA for ; Mon, 17 Oct 2016 23:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15AA128C9E for ; Mon, 17 Oct 2016 23:22:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A08C28CBC; Mon, 17 Oct 2016 23:22:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7036A28C9E for ; Mon, 17 Oct 2016 23:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757956AbcJQXWy (ORCPT ); Mon, 17 Oct 2016 19:22:54 -0400 Received: from mail-co1nam03on0052.outbound.protection.outlook.com ([104.47.40.52]:3174 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757948AbcJQXWw (ORCPT ); Mon, 17 Oct 2016 19:22:52 -0400 X-Greylist: delayed 4663 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Oct 2016 19:22:52 EDT Received: from CY1PR03CA0026.namprd03.prod.outlook.com (10.174.128.36) by CY1PR03MB1423.namprd03.prod.outlook.com (10.163.17.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Mon, 17 Oct 2016 21:50:18 +0000 Received: from BN1AFFO11FD056.protection.gbl (2a01:111:f400:7c10::164) by CY1PR03CA0026.outlook.office365.com (2603:10b6:600::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16 via Frontend Transport; Mon, 17 Oct 2016 21:50:18 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD056.mail.protection.outlook.com (10.58.53.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Mon, 17 Oct 2016 21:50:18 +0000 Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.70]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u9HLoGqc005902; Mon, 17 Oct 2016 14:50:17 -0700 From: Li Yang To: Bjorn Helgaas , Minghuan Lian , Mingkai Hu , Roy Zang CC: , , , Stuart Yoder , Li Yang Subject: [PATCH] PCI: layerscape: Fix kernel panic on accessing NULL pointer Date: Mon, 17 Oct 2016 16:44:06 -0500 Message-ID: <1476740647-11155-1-git-send-email-leoyang.li@nxp.com> X-Mailer: git-send-email 1.9.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131212146182637950; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(229853001)(19580395003)(92566002)(8676002)(626004)(11100500001)(47776003)(97736004)(5003940100001)(81156014)(8936002)(69596002)(305945005)(50226002)(81166006)(106466001)(189998001)(105606002)(85426001)(4326007)(5001770100001)(104016004)(586003)(68736007)(36756003)(87936001)(33646002)(50466002)(6862003)(50986999)(19580405001)(86362001)(2906002)(77096005)(6666003)(8666005)(7846002)(48376002)(5660300001)(356003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB1423; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD056; 1:tUOxabaYcxToNF5uofWjIN0olcRca9hkxmN25ztDzsHFYdSRsC9ZNhcJN17dFzzLiP8SFd08gR9X9seAHdf9ToSSK9eB5/7hNscF2HHTF/QIBoqifYB6kcCa1VGfjgrosyemsGQd4HJJQeYrxEvtfR2NwfrbllXxUTtrvXmuGSh0EsnYXyp2hQmTuesBCVUTA0mV2UDFwwzgYDa0i+akD70vZZ9QE4iQErlJgl5m2kAiWxo9abB6vTj7Ie8LnY45Ql8EY/FvL/+E5/kD43m+G2VtDfHjBqV6iHWw2NlvMXk9iddor0NAfAdiqwdvAzIOvnAA7/aP10zpi7VMnqeCkC25cmaVZmaDqoEuthVADb//4kA7PBTaIyGtaZeC+yxnAJlAQ928PolgSNJ97MbrrmOF84Z8oiZYgNDwzp/FSel1bAeBdmt3WP5O1iNokv6QGBX1Rf1oQFVoeXMX8DaP4vHNLqOzzlCLfzUfRO0Khrx44AMLZ7Tll4NOTd1YAInShVVd4NWc0v9lwuM8BSTHdR/+1YaWU6RXpz/sIm3/st3TSYvUsxEWynbfRLF7vNOvrT5jUF/sJOMx2Md22iLJvc6WAB6+Bfrj/ycnhb5S8/Uooo9uFYJOA38TkVnufiwwUETdoUvzVGQjqkrAT9w6zOXgU3xQO0K3S/MkDhhW/W9ZtQ6ZFwFTo45Q2iI/59Wcr2WtjP62N9BQ4I1kIu+066hYjO6AkD+4aHIc9/k3CHw= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 104ec61e-167c-4eca-6821-08d3f6d795e3 X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1423; 2:0pVKUa8IOQFfhZ3SzbREvf7kcB1HADuFtDgg0+SGvgOjuNcgKdHo9SwgQpAw8Pk1pSzNY8iA9WGpLaRBrIMn50DzSx8fU5KiPGIAQZUqpsQxUN7OVA2FFbnADXIzEvfXcyUqXfpLzqmKTFiqEHm5JDnL77fLk7fMWp1HCmPv29uuOpUPM7FAg7AY+oozRfEAfcHfowoqa9yH9P9sfbF5zQ==; 3:5LUiIb75HHf/mjoVFG1E4KZ8yB6UHhQScbE++2BSrxrOaHfVCKJFg5IvtuUj2ZApbKWjN2wFaUEYVjSlOOYiUiPERHfSEKcGxW7NivHvg26EXFeV1O4My6mxiHyZ0al5kj0zYZZdPDyPayhzXjGLzjCjwLekA6BYFSY0PRIhmZpqghkA8fBfOPuGkvGOFdKvnnL583bfuf9JJ9MR4ZG8fMUV+iTAkvLpbiqdnbY8zoVA2DmFKl+cFJ+EcaYD6LKI X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1423; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1423; 25:Mf5yvjSHIUETj/otJ7X4tlGS6EBvenp6a8VYAkac9HMdlF0Ty+mDucdpp2xGPyRELvRTW3xFbHPuP7KmYJSGZtk1PUma3+qMk9yyO6Fm5lYUndkD6ixWyAJM5IJWyN0bjOf4TVbi9kwhOtVy4OUKmiWQgVoism5mrBN3gguqY0mVBqRz9FAAVVchLuwHxZmjFduse3Q0tYseW7J0nZsX2lFfgTW9LiALOpz3EU/YuKarR/A+EP86bO7oYFR66Yi5Cf/jLbvdob78Pe5VVMZwONs2J3a2bL1HBG1suA2mBYK6a0agbp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rtmHUaSjoRuAgFEyYFOYX4rE1tN/P9TnymZwF6Wf0F8bv/eDxHi3o4t1uX/xUPR+qqEUJBJPN8kJvDdW2aSLHp0b8931H5WHyxXBJtissDlgUP1rOEn0g9RtcKZIwtJ3Hix2iS5yxKqdL5BhmA5OSZQfR3AGlLUmfcmAz2Y2OWeqkuOaqGVcQanKQxGCoLCW0BYCuNSJ+T0NUs0cESYPKkeMrETHOvIlv1VjRxOySDBkwu9MjWnF/JWlKNDIC/b9F+EaN9BlPHAmgd5Vrn2FivLiD98qtBKnBpDBZsWx1Uxr3cQwucXgHA+0MSC+RMzoO3KmX6kPk/6zK88 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13015025)(13018025)(13023025)(13024025)(13017025)(10201501046)(3002001)(6055026); SRVR:CY1PR03MB1423; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB1423; X-Forefront-PRVS: 0098BA6C6C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB1423; 23:sBRwVbjW57g87C60YUI+QOe3wroCOwrkC3TwfjM6M?= =?us-ascii?Q?ACh79bLyMjN1uqlqNqp/o4l4SwOsBqij4p6Y7wd27AqDimohHwmpkLmKjfAY?= =?us-ascii?Q?uiyiACBK4h1BzqzlkQlkrQ1hL06EFrGN1C/FQBvOXixdPEYBb+o7EMOv27N0?= =?us-ascii?Q?bmstoL0Fjbv+0sGEUAPdU3n8YUiuihZczmnmLuHR7g6sCOFGzpJTmZWEQGPg?= =?us-ascii?Q?JZPe/SvNThip19FEz2rwIAG/y/UAGGoYYGSmL5NCmLa/tLAJele9sz7sr1x+?= =?us-ascii?Q?3wCsIDyvW+PgsIaqqPFzs/mn+Zmf9YQvEBEYK5pvWfbLrb/P0M6qVS0wW3yJ?= =?us-ascii?Q?NiTp9SnHnu18MYg7Uol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S-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 21:50:18.0297 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1423 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit fefe6733e added reference to the pcie->drvdata before it is initialized which causes a kernel panic. Fix the problem by initializing the pcie->drvdata earlier before it is used. Reported-by: Stuart Yoder Signed-off-by: Li Yang --- drivers/pci/host/pci-layerscape.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index 2cb7315..958187f 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -245,6 +245,7 @@ static int __init ls_pcie_probe(struct platform_device *pdev) if (!pcie) return -ENOMEM; + pcie->drvdata = match->data; pp = &pcie->pp; pp->dev = dev; pp->ops = pcie->drvdata->ops; @@ -256,7 +257,6 @@ static int __init ls_pcie_probe(struct platform_device *pdev) return PTR_ERR(pcie->pp.dbi_base); } - pcie->drvdata = match->data; pcie->lut = pcie->pp.dbi_base + pcie->drvdata->lut_offset; if (!ls_pcie_is_bridge(pcie))