Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752497AbbKJLsU (ORCPT ); Tue, 10 Nov 2015 06:48:20 -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 X-AuditID: cbfee68d-f79ae6d00000149a-1a-5641d98083f5 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++T1WkJkSAs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TWSWEk3OB6aHvJJ4 Q2MTc1NjU0sTCxMzSyVxXn1PozAhgfTEktTs1NSC1CKYPiYOTqkGxqzHQXGJNWsCDf4a/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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1220 Lines: 36 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 --- 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); -- 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/