From patchwork Mon Jan 22 02:28:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 10177211 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 6AD41600F5 for ; Mon, 22 Jan 2018 02:29:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50AC827FAE for ; Mon, 22 Jan 2018 02:29:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 451E127FB3; Mon, 22 Jan 2018 02:29:02 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 DBB6627FB0 for ; Mon, 22 Jan 2018 02:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751085AbeAVC27 (ORCPT ); Sun, 21 Jan 2018 21:28:59 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:41424 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbeAVC26 (ORCPT ); Sun, 21 Jan 2018 21:28:58 -0500 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180122022856epoutp02720f61a73161db09802141eeae3f7997~MAOAQxQD42958929589epoutp02l; Mon, 22 Jan 2018 02:28:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180122022856epoutp02720f61a73161db09802141eeae3f7997~MAOAQxQD42958929589epoutp02l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1516588136; bh=EucegjT4GdeC9HKqm0sYQYmxh/7g7MrhlPiL6tnND1c=; h=From:To:Cc:Subject:Date:References:From; b=OE3QcWEhNiDHrmTDyKGVbeVfmkA+VLTlHI3ZwhfzlMKjjmBiXSxyOu3l7d3wkQvx/ YwzL6CXF5wkSFzmtyTEpFpXl8SFy2MufcZtDSyedTT1PbJigj/vfuht9W6H/wWJhb8 XVK3hRTcr1uhMcDROkMy97HOcsyqDccyTOxvfSD0= Received: from epsmges1p5.samsung.com (unknown [182.195.40.66]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20180122022856epcas1p2b1d632a0f9a4978e5832ddeff1765cd8~MAN-_MdO11953219532epcas1p2t; Mon, 22 Jan 2018 02:28:56 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 83.05.04037.86C456A5; Mon, 22 Jan 2018 11:28:56 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180122022856epcas1p494a9efeae478b299e3e8006adad71e6a~MAN-xcdVh1711717117epcas1p4d; Mon, 22 Jan 2018 02:28:56 +0000 (GMT) X-AuditID: b6c32a39-467ff70000000fc5-2e-5a654c684c4c Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 62.C2.03826.86C456A5; Mon, 22 Jan 2018 11:28:56 +0900 (KST) Received: from localhost.localdomain ([10.113.77.174]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P2X00EDVQW7RX10@mmp1.samsung.com>; Mon, 22 Jan 2018 11:28:56 +0900 (KST) From: Jaehoon Chung To: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, jingoohan1@gmail.com, lorenzo.pieralisi@arm.com, kgene@kernel.org, krzk@kernel.org, Jaehoon Chung Subject: [PATCH] PCI: exynos: fix the potential null pointer dereference Date: Mon, 22 Jan 2018 11:28:54 +0900 Message-id: <20180122022854.3634-1-jh80.chung@samsung.com> X-Mailer: git-send-email 2.15.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCKsWRmVeSWpSXmKPExsWy7bCmvm6GT2qUwdlrChY3frWxWqz4MpPd ov/xa2aL8+c3sFtsenyN1eLsvONsFjPO72OyePP7BbsDh8eaeWsYPXbOusvusWlVJ5vH5iX1 Hn1bVjF6fN4kF8AWlWqTkZqYklqkkJqXnJ+SmZduq+QdHO8cb2pmYKhraGlhrqSQl5ibaqvk 4hOg65aZA3SPkkJZYk4pUCggsbhYSd/Opii/tCRVISO/uMRWKdrQ0EjP0MBcz8jISM/EONbK yBSoJCE14/v3ftaC5+wVq6bdZW5gPMDWxcjJISFgIjHv8C12EFtIYAejxOr1gV2MXED2d0aJ TXfuscIUrbn4hRkisZtRYuLnsywQzg9GiZfdM8FGsQnoSGz/dpwJxBYRkJX4eHkPG0gRs8Bp RoklW58wgiSEBTwkrq/bCWazCKhKTGh+C9bAK2AlMWviPXaIdfISE7Y0gW2QEGhkkzjwrZMR IuEi8bLtMlSRsMSr41uAbA4gW1ri0lFbiHA7o8TZ2cIQvVMYJVbM6GaCSBhLPFvYBWYzC/BJ vPvawwrRyyvR0SYEUeIhcXTxGmYI21Hi7O5eFpASIYFYiSvngyYwSi5gZFjFKJZaUJybnlps WGCqV5yYW1yal66XnJ+7iRGcQrQsdzAeO+dziFGAg1GJh7fDIDVKiDWxrLgy9xCjBAezkgjv tLyUKCHelMTKqtSi/Pii0pzU4kOMpsDQmMgsJZqcD0xveSXxhiaWBiZmRsDotzQ0VBLnDQhw iRISSE8sSc1OTS1ILYLpY+LglGpg3Pc4QHBuofvF/esiElLeS/2p6n342Kf6+ZQC5gt5rhcX Ob/cfW1GvJ6mhmecyTFXq6p/jve9Mn8HW0Y6cs4sT/PjuVDP17PilXd8qszWfbureN12ZCx1 FmSI2bcy7v238zoTpx62WvXH+doKFgM1a3+n3b8XMvKLL3l4zqQuJcfCxemcV521EktxRqKh FnNRcSIA5AGGwjcDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t9jAd0Mn9Qogw99QhY3frWxWqz4MpPd ov/xa2aL8+c3sFtsenyN1eLsvONsFjPO72OyePP7BbsDh8eaeWsYPXbOusvusWlVJ5vH5iX1 Hn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJXx/Xs/a8Fz9opV0+4yNzAeYOti5OSQEDCRWHPx C3MXIxeHkMBORolrSzYzQjg/GCVWnVzMAlLFJqAjsf3bcSYQW0RAVuLj5T1sIEXMAqcZJaa3 v2AHSQgLeEhcX7eTEcRmEVCVmND8FqyBV8BKYtbEe+wQ6+QlJmxpYpnAyLWAkWEVo2RqQXFu em6xUYFhXmq5XnFibnFpXrpecn7uJkZgqGw7rNW3g/H+kvhDjAIcjEo8vAZ6qVFCrIllxZW5 hxglOJiVRHin5aVECfGmJFZWpRblxxeV5qQWH2KU5mBREue9nXcsUkggPbEkNTs1tSC1CCbL xMEp1cCYUuK0SCB7X9Y261kirFpP1s3z8z94+cY/gbsLqovNN32p9TVxi1Dz6Xr/+eYlE7nU LXWiOe9eGZp6/eJUYVg8y2pG+dmDx+9nfvv2WaLm7NzJJfWbHwSqtGp/7ZZfM1PW5uAU4fd/ Ft/xXcc3tU20YU5g0j/3nB3+G+u8D3341vuFSVrMSFheiaU4I9FQi7moOBEALuKLgxECAAA= X-CMS-MailID: 20180122022856epcas1p494a9efeae478b299e3e8006adad71e6a X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20180122022856epcas1p494a9efeae478b299e3e8006adad71e6a X-RootMTR: 20180122022856epcas1p494a9efeae478b299e3e8006adad71e6a 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 Before calling the callback function, it needs to check whether init_clk_resources is assigned or not. Otherwise, it can be occurred the NULL pointer dereference when init_clk_resources is not assigned. Even though init_clk_resources is assigned now, it needs to prevent the potential NULL pointer dereference in future. Signed-off-by: Jaehoon Chung Acked-by: Jingoo Han --- drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c index 56f32aeebd0a..39f08881f9a4 100644 --- a/drivers/pci/dwc/pci-exynos.c +++ b/drivers/pci/dwc/pci-exynos.c @@ -499,7 +499,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) return ret; } - if (ep->ops && ep->ops->get_clk_resources) { + if (ep->ops && ep->ops->get_clk_resources && + ep->ops->init_clk_resources) { ret = ep->ops->get_clk_resources(ep); if (ret) return ret;