From patchwork Tue Nov 17 06:05:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 7633251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBDB09F1C2 for ; Tue, 17 Nov 2015 06:12:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A41620528 for ; Tue, 17 Nov 2015 06:12:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5134F20525 for ; Tue, 17 Nov 2015 06:12:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyZTh-0007Qo-Rv; Tue, 17 Nov 2015 06:10:53 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyZTd-0007G2-T2 for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 06:10:50 +0000 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXY02ZX33TF1H60@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 15:10:27 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.122]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 90.9E.05272.3D4CA465; Tue, 17 Nov 2015 15:10:27 +0900 (KST) X-AuditID: cbfee68e-f791c6d000001498-8b-564ac4d33b22 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id D1.00.18629.3D4CA465; Tue, 17 Nov 2015 15:10:27 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NXY00GBB3PUDS00@mmp2.samsung.com>; Tue, 17 Nov 2015 15:10:27 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v6 2/9] ARM: EXYNOS: Fix potential NULL pointer access in exynos_sys_powerdown_conf Date: Tue, 17 Nov 2015 11:35:44 +0530 Message-id: <1447740351-14246-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.4.5 In-reply-to: <1447740351-14246-1-git-send-email-pankaj.dubey@samsung.com> References: <1447740351-14246-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsWyRsSkSvfyEa8wg5Nv5Sw+rn7JZvF30jF2 i9cvDC16F1xls/h6eAWjxabH11gtLu+aw2bxufcIo8WM8/uYLE5d/8xmsWjrF3aLjmWMDjwe v39NYvTYOesuu8eda3vYPDYvqfe4cqKJ1aNvyypGj8+b5ALYo7hsUlJzMstSi/TtErgyGrd1 sxSs5qh41v2PqYGxk72LkZNDQsBE4tnufiYIW0ziwr31bF2MXBxCAisYJU51n2SFKere9BAq MYtRYs7/80wQTiuTxOKDe1lAqtgEdCWevJ/LDJIQEWhllFi2/z9YFbPAAUaJHeteMXYxcnAI C6RK9G43BmlgEVCV2NR/nw3E5hXwkOj99oYFpERCQE5iaXMtSJhTwFNix9IjTCBhIaCSdyfU QSZKCFxil/jy5R0jxBgBiW+TD0G1ykpsOsAM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Ss1NTC1KLYPqYODilGhh3HU3Z+CLr yTK5e8HLhC0qnioK+pzavFRegf/EMxfp8LPvhIrqPj+b0n1ht52JAsezmlfLzlgb2esu58zU Ybxzu6VM10+bR//E8hb1TROq9u86dkWvKi4k/sK79v9BHy4d3Wp9ad7mst9R3+bKTXu+y63D bk6GNr8zk83pvBOnPhxg69XsWv9XiaU4I9FQi7moOBEAi0RvudsCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151116_221050_092985_4745791A X-CRM114-Status: GOOD ( 12.26 ) X-Spam-Score: -7.7 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amitdanielk@gmail.com, k.kozlowski@samsung.com, kgene.kim@samsung.com, arnd@arndb.de, khilman@linaro.org, Pankaj Dubey , thomas.ab@samsung.com, olof@lixom.net MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If no platform devices binded to the driver but driver itself loaded and exynos_sys_powerdown_conf is called from arch/arm/mach-exynos/{suspend.c, pm.c} it will result in NULL pointer access, to prevent this added check on pmu_context for NULL. Signed-off-by: Pankaj Dubey Reviewed-by: Krzysztof Kozlowski --- arch/arm/mach-exynos/pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c index 64ea7d6..d40f7e9 100644 --- a/arch/arm/mach-exynos/pmu.c +++ b/arch/arm/mach-exynos/pmu.c @@ -749,8 +749,12 @@ static void exynos5_powerdown_conf(enum sys_powerdown mode) void exynos_sys_powerdown_conf(enum sys_powerdown mode) { unsigned int i; + const struct exynos_pmu_data *pmu_data; + + if (!pmu_context) + return; - const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data; + pmu_data = pmu_context->pmu_data; if (pmu_data->powerdown_conf) pmu_data->powerdown_conf(mode);