Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754696AbbKMJcj (ORCPT ); Fri, 13 Nov 2015 04:32:39 -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 X-AuditID: cbfee68e-f791c6d000001498-fb-5645ae2ed843 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/OjcQk1fAQ2LW9QQQU0JATmJpcy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xrLgy9xCjBAezkgjv4mdAId6UxMqq1KL8+KLSnNTiQ4ymQFdNZJYSTc4H Jom8knhDYxNzU2NTSxMLEzNLJXFefU+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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1280 Lines: 37 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); -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/