From patchwork Tue Mar 7 10:54:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 9608601 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 82AE960414 for ; Tue, 7 Mar 2017 10:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69A39284CE for ; Tue, 7 Mar 2017 10:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E490284E7; Tue, 7 Mar 2017 10:54:42 +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 CB03E284EE for ; Tue, 7 Mar 2017 10:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754607AbdCGKyd (ORCPT ); Tue, 7 Mar 2017 05:54:33 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:47847 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754822AbdCGKyL (ORCPT ); Tue, 7 Mar 2017 05:54:11 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OMF032VOYA7U7C0@mailout3.samsung.com>; Tue, 07 Mar 2017 19:54:07 +0900 (KST) Received: from epsmges5p5.samsung.com (unknown [182.195.40.64]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170307105407epcas1p2dce366f05a324e4a5d6cf9fd48811939~plCcmgBdv1773417734epcas1p2k; Tue, 7 Mar 2017 10:54:07 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p5.samsung.com (EPCPMTA) with SMTP id 69.FE.04904.F419EB85; Tue, 7 Mar 2017 19:54:07 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb~plCcU4sFA1988419884epcas5p3z; Tue, 7 Mar 2017 10:54:07 +0000 (GMT) X-AuditID: b6c32a59-f79736d000001328-1a-58be914f5d63 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 66.65.06422.F419EB85; Tue, 7 Mar 2017 19:54:07 +0900 (KST) Received: from localhost.localdomain ([10.113.62.216]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OMF00IMPYA7GO00@mmp1.samsung.com>; Tue, 07 Mar 2017 19:54:07 +0900 (KST) From: Jaehoon Chung To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, helgaas@kernel.org, jingoohan1@gmail.com, Jaehoon Chung Subject: [PATCH] PCI: exynos: fix the NULL pointer dereference about elbi_base Date: Tue, 07 Mar 2017 19:54:05 +0900 Message-id: <20170307105405.7874-1-jh80.chung@samsung.com> X-Mailer: git-send-email 2.10.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCKsWRmVeSWpSXmKPExsWy7bCmpq7/xH0RBscuqFu8OrOWzeLGrzZW ixVfZrJbXN41h83i7LzjbA6sHjtn3WX32LSqk82jb8sqRo/Pm+QCWKJSbTJSE1NSixRS85Lz UzLz0m2VvIPjneNNzQwMdQ0tLcyVFPISc1NtlV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0cXIySEhYCLx8Ok/JghbTOICUK6LkYtDSGApo8T6vxOZIJwfjBI9f+Yxg1Sx CehIbP92HKxDREBW4uPlPWwgNrNAicSBT1PA4sICfhI/nrxlAbFZBFQl7l85CGbzClhJTF2w HWqbvMTC80eYJjByL2BkWMUokVqQXFCclJ5rlJdarlecmFtcmpeul5yfu4kRHIbPpHcwHt7l fohRgINRiYc3IXtvhBBrYllxZe4hRgkOZiUR3rDufRFCvCmJlVWpRfnxRaU5qcWHGE2BDpjI LCWanA+MkbySeEMTcxNzYwMLc0tLEyMlcd7G2c/ChQTSE0tSs1NTC1KLYPqYODilGhgP5Kan H//XVqGe9UavNzChi+ftIZ01K+6bPJPL5IjsOSmducRIdjFQVo9j3xL7yc6X1I8vdOYQjD29 eIFRde3yX+viTl68fHbXqVDRT3Mmy/Ip/PkZsGrx/kN/N19Z7n3PLmv/mQ+CG1cXrF51QmXR Qt+eKPXjlt9nZG2cbPjj6a+Azz+d199QYinOSDTUYi4qTgQAsUw9rVkCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?7KCV7J6s7ZuIG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?SmFlaG9vbiBDaHVuZxtUaXplbiBQbGF0Zm9ybSBMYWIuG1Nh?= =?UTF-8?B?bXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb X-RootMTR: 20170307105407epcas5p3e77181793b26a5d2710bb6d7557033bb References: 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 Even though using phy framework, it has to get the elbi_base. Before this patch, elbi_base should be NULL pointer. Fixes: e7cd7ef58e1f ("PCI: exynos: Support the PHY generic framework") Signed-off-by: Jaehoon Chung --- drivers/pci/dwc/pci-exynos.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c index 993b650..44f774c 100644 --- a/drivers/pci/dwc/pci-exynos.c +++ b/drivers/pci/dwc/pci-exynos.c @@ -132,10 +132,6 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, struct device *dev = pci->dev; struct resource *res; - /* If using the PHY framework, doesn't need to get other resource */ - if (ep->using_phy) - return 0; - ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL); if (!ep->mem_res) return -ENOMEM; @@ -145,6 +141,10 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev, if (IS_ERR(ep->mem_res->elbi_base)) return PTR_ERR(ep->mem_res->elbi_base); + /* If using the PHY framework, doesn't need to get other resource */ + if (ep->using_phy) + return 0; + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); ep->mem_res->phy_base = devm_ioremap_resource(dev, res); if (IS_ERR(ep->mem_res->phy_base))