From patchwork Fri Nov 13 09:29:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 7609371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 60AC69F1C2 for ; Fri, 13 Nov 2015 09:36:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97881204D6 for ; Fri, 13 Nov 2015 09:36:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC804202AE for ; Fri, 13 Nov 2015 09:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754674AbbKMJci (ORCPT ); Fri, 13 Nov 2015 04:32:38 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:54744 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670AbbKMJce (ORCPT ); Fri, 13 Nov 2015 04:32:34 -0500 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXQ02A68YI6BX50@mailout3.samsung.com>; Fri, 13 Nov 2015 18:32:30 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.123]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 7E.F8.05272.E2EA5465; Fri, 13 Nov 2015 18:32:30 +0900 (KST) X-AuditID: cbfee68e-f791c6d000001498-fb-5645ae2ed843 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 12.DC.18629.E2EA5465; Fri, 13 Nov 2015 18:32:30 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NXQ002KAYHMWY40@mmp1.samsung.com>; Fri, 13 Nov 2015 18:32:30 +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 v5 2/9] ARM: EXYNOS: Fix potential NULL pointer access in exynos_sys_powerdown_conf Date: Fri, 13 Nov 2015 14:59:36 +0530 Message-id: <1447406983-27835-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.4.5 In-reply-to: <1447406983-27835-1-git-send-email-pankaj.dubey@samsung.com> References: <1447406983-27835-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRmVeSWpSXmKPExsWyRsSkWldvnWuYwblX0hYfV79ks/g76Ri7 xesXhha9C66yWXw9vILRYtPja6wWl3fNYbP43HuE0WLG+X1MFqeuf2azWLT1C7tFxzJGBx6P 378mMXrsnHWX3ePOtT1sHpuX1HtcOdHE6tG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZjdu6 WQpWc1Q86/7H1MDYyd7FyMkhIWAicWLOORYIW0ziwr31bF2MXBxCAisYJT63n2SEKTo58Rob iC0ksJRRYtEpJoiiViaJW69vsoIk2AR0JZ68n8sMkhARaGWUWLb/P1gVs8ABRokd616BjRIW SJX4u+0OUAcHB4uAqkT/OjcQk1fAQ2LW9QQQU0JATmJpcy1IMaeAp8TzqQuZIfZ6SBxfeJYR ZKKEwDl2ibfT+8AOYhEQkPg2+RALRK+sxKYDzBA3S0oc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SxMLEzNLJXFefU+jMCGB9MSS1OzU1ILUIpg+Jg5OqQbGnp3XuZKs/BIE Nj+bfnly4lemcmZ+9ubri+eu+O0osknE8dDRxgRHYSM5ffbFxbXLkoMvWFnxFEfuCzp7lzdm q5Pt3mWVnzXXxKtM3y6iUd/BOi9R3FFv4q2qa7evTTq3wSPk16z89V8EP2WnxUrpvspfcNXb fN0RZYVLNivt9NYuvKfm/MRBiaU4I9FQi7moOBEAqfysFdoCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 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);