From patchwork Tue Nov 10 11:42:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 7589531 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 AA4789F392 for ; Tue, 10 Nov 2015 11:48:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E58462070D for ; Tue, 10 Nov 2015 11:48:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1A8A205FF for ; Tue, 10 Nov 2015 11:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbbKJLsT (ORCPT ); Tue, 10 Nov 2015 06:48:19 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:44845 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbbKJLsS (ORCPT ); Tue, 10 Nov 2015 06:48:18 -0500 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXL00BT6KSGVPC0@mailout4.samsung.com>; Tue, 10 Nov 2015 20:48:16 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.124]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id D5.61.05274.089D1465; Tue, 10 Nov 2015 20:48:16 +0900 (KST) X-AuditID: cbfee68d-f79ae6d00000149a-1a-5641d98083f5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 1F.8B.18629.089D1465; Tue, 10 Nov 2015 20:48:16 +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 <0NXL0077JKNPME50@mmp1.samsung.com>; Tue, 10 Nov 2015 20:48:16 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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 v4 2/9] ARM: EXYNOS: Fix potential NULL pointer access in exynos_sys_powerdown_conf Date: Tue, 10 Nov 2015 17:12:57 +0530 Message-id: <1447155784-12667-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.4.5 In-reply-to: <1447155784-12667-1-git-send-email-pankaj.dubey@samsung.com> References: <1447155784-12667-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOLMWRmVeSWpSXmKPExsWyRsSkRrfhpmOYQftMNYuPq1+yWfyddIzd 4vULQ4veBVfZLL4eXsFosenxNVaLy7vmsFnMOL+PyeLU9c9sFou2fmG36FjG6MDt8fvXJEaP nbPusnvcubaHzWPzknqPKyeaWD36tqxi9Pi8SS6APYrLJiU1J7MstUjfLoEr48HVhYwF79gr Lj8+wtrAeImti5GTQ0LARGLf6amsELaYxIV764HiXBxCAisYJVbuQCj62tHFCJFYyijxq+sv C4TTyiTx/3YXWDubgK7Ek/dzmUFsEYFsiSuN95lBipgFDjBK7Fj3ihEkISyQKjH17BIWEJtF QFXi//vrYM28Ah4SN1dcBGrgAFonJ7G0uRYkzCngKdGz9CYTiC0EVPL++T1WkJkSAsfYJa7N 2soEMUdA4tvkQywQvbISmw4wQ1wtKXFwxQ2WCYzCCxgZVjGKphYkFxQnpRcZ6hUn5haX5qXr Jef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sCDf4a/Ojq 0F53c80U6y6D1pXzZ+0Iu3pWU95y7e4PpaxzeVmV+7Y5r1Z6XljBpMIef+M918HuBOlbT7Ss tTZ2zj1/rogxVDCQLfnHjVP3CpYHXXnb1OMhLGN/UtohZc+Gltdzfc7IXm94PM9gn+gxn5ya Q7HFrw5H2kxqn3LSTomlOCPRUIu5qDgRAC+e3vXXAgAA 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..14ec1ff 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);