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: 7589601 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 7EB809F392 for ; Tue, 10 Nov 2015 11:50:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6D7C205FF for ; Tue, 10 Nov 2015 11:50:09 +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 D09E0205F7 for ; Tue, 10 Nov 2015 11:50:07 +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 1Zw7Pm-00062l-LJ; Tue, 10 Nov 2015 11:48:42 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zw7Pj-0005ru-Ba for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2015 11:48:40 +0000 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> for linux-arm-kernel@lists.infradead.org; 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 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 2soEMUdA4tvkQywQvbISmw4wQ1wtKXFwxQ2WCYzCCxgZVjGKphYkFxQn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PiYOTqkGxqzHQXGJNWsCDf4a/Ojq 0F53c80U6y6D1pXzZ+0Iu3pWU95y7e4PpaxzeVmV+7Y5r1Z6XljBpMIef+M918HuBOlbT7Ss tTZ2zj1/rogxVDCQLfnHjVP3CpYHXXnb1OMhLGN/UtohZc+Gltdzfc7IXm94PM9gn+gxn5ya Q7HFrw5H2kxqn3LSTomlOCPRUIu5qDgRAC+e3vXXAgAA 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-20151110_034839_540648_C7B5A76A X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -7.2 (-------) 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.5 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..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);