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: 7633121 Return-Path: X-Original-To: patchwork-linux-pm@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 161E79F1C2 for ; Tue, 17 Nov 2015 06:10:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A045202E5 for ; Tue, 17 Nov 2015 06:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CAD9202B4 for ; Tue, 17 Nov 2015 06:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263AbbKQGKb (ORCPT ); Tue, 17 Nov 2015 01:10:31 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:55250 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752243AbbKQGK3 (ORCPT ); Tue, 17 Nov 2015 01:10:29 -0500 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>; 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 Cc: kgene.kim@samsung.com, k.kozlowski@samsung.com, thomas.ab@samsung.com, amitdanielk@gmail.com, olof@lixom.net, khilman@linaro.org, arnd@arndb.de, Pankaj Dubey 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+TD0G1ykpsOsAMcbSkxMEVN1gmMA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ilGhh3HU3Z+CLr yTK5e8HLhC0qnioK+pzavFRegf/EMxfp8LPvhIrqPj+b0n1ht52JAsezmlfLzlgb2esu58zU Ybxzu6VM10+bR//E8hb1TROq9u86dkWvKi4k/sK79v9BHy4d3Wp9ad7mst9R3+bKTXu+y63D bk6GNr8zk83pvBOnPhxg69XsWv9XiaU4I9FQi7moOBEAi0RvudsCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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);