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: 10177213 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 D24EF600F5 for ; Mon, 22 Jan 2018 02:29:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5C6227FAE for ; Mon, 22 Jan 2018 02:29:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAAA727FB3; Mon, 22 Jan 2018 02:29:19 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39BD227FAE for ; Mon, 22 Jan 2018 02:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: Message-id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:List-Owner; bh=MB3rYiUsTt/KUvACNue8z4h49DSqbXPYUu/mC7Sw+Go=; b=mt IuPw8Hh6+6LHXUUXSUAr8QulqTyku38ppZUHfpjcqi4Y0oH9I1NM1CuPQ5i2hNJMCO32nZ7S6t5Q0 DEF/wRIrlam2hSrVQaknj7n92LCO4UoP/0G5Yn6lG8xMF7fO9VZpWGPt+M9RWnkKw1dFb3eZq87ek VSQB3QGFz8cKxwnIoN2Az8aXoz5ucLRy7xTw/YUP005EamfYjXLVa3n1nNUNzeAH6UWdTLr0FCklx NR4gLjuyC97fYscxES0cbIevKQFG1Bn1h37BeuTvoopxZP7b3f2ZYMDn1mhMeEFESZrNdNONBJtoM JMQy2Gm++3nhlu63OwgsqPbok1ttkklA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1edRrJ-0000sr-A9; Mon, 22 Jan 2018 02:29:17 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1edRrF-0000ow-Ki for linux-arm-kernel@lists.infradead.org; Mon, 22 Jan 2018 02:29:15 +0000 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 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+QdHO8cb2pm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HkMBORolrSzYzQjg/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: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, jingoohan1@gmail.com, krzk@kernel.org, Jaehoon Chung , kgene@kernel.org, lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;