From patchwork Wed May 13 03:17:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 6393371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 11D52BEEE1 for ; Wed, 13 May 2015 03:18:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FAD72041F for ; Wed, 13 May 2015 03:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73FB42041A for ; Wed, 13 May 2015 03:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934325AbbEMDSS (ORCPT ); Tue, 12 May 2015 23:18:18 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:37951 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934004AbbEMDSQ (ORCPT ); Tue, 12 May 2015 23:18:16 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NO900408QIDU630@mailout4.w1.samsung.com>; Wed, 13 May 2015 04:18:13 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-8b-5552c275103a Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id BA.EC.04846.572C2555; Wed, 13 May 2015 04:18:13 +0100 (BST) Received: from localhost.localdomain ([10.252.80.64]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NO900AHEQI7GE10@eusync4.samsung.com>; Wed, 13 May 2015 04:18:13 +0100 (BST) From: Krzysztof Kozlowski To: Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from_provider Date: Wed, 13 May 2015 12:17:52 +0900 Message-id: <1431487072-17567-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrIJMWRmVeSWpSXmKPExsVy+t/xa7qlh4JCDf50yVu8fmFo0f/4NbPF psfXWC0u75rDZjHj/D4miwUbHzE6sHlsWtXJ5rF5Sb1H35ZVjB6fN8kFsERx2aSk5mSWpRbp 2yVwZXS/+MNccIe74t+jvywNjPc5uxg5OSQETCRe3VjFCmGLSVy4t56ti5GLQ0hgKaPE262r mSCc/4wSj44+ZwGpYhMwlti8fAlYlYhAF6PErC2/2UASzAKeEu/+PmQHsYUFEiUe/b/FDGKz CKhKrH3ykRHE5hVwl5j/voUJYp2cxMljk1knMHIvYGRYxSiaWppcUJyUnmuoV5yYW1yal66X nJ+7iRESEF92MC4+ZnWIUYCDUYmHd8bbwFAh1sSy4srcQ4wSHMxKIrw5E4JChXhTEiurUovy 44tKc1KLDzFKc7AoifPO3fU+REggPbEkNTs1tSC1CCbLxMEp1cAoZhhbVj5RxF3wnqxogJre Vc9eGQmX4v5rHJd8rrr+2XXvyx7v7SsYL3+uDjn4Y1ts6Ueb2X7+NhcbSia5iFSonLhz7XJF nWC636xH2+5FXjiV1sOx5GnuBcYX4VNu59yaZjZvh9Inc+bzOu23JebutqhVeJHRlvNe6POW WyE/zxy3n79t0s5eJZbijERDLeai4kQA8/6qQwQCAAA= 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 ERR_PTR was dereferenced during sub domain parsing, if parent domain could not be obtained (because of invalid phandle or deferred registration of parent domain). The Exynos power domain code checked whether of_genpd_get_from_provider() returned NULL and in that case it skipped that power domain node. However this function returns ERR_PTR or valid pointer, not NULL. Signed-off-by: Krzysztof Kozlowski Cc: Fixes: 0f7807518fe1 ("ARM: EXYNOS: add support for sub-power domains") --- The patchset is rebased on top of my fixes for pm_domains.c to avoid the conflicts: https://lkml.org/lkml/2015/3/27/321 --- arch/arm/mach-exynos/pm_domains.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 1a90c5da2fd7..440324c94d28 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -209,7 +209,7 @@ no_clk: args.np = np; args.args_count = 0; child_domain = of_genpd_get_from_provider(&args); - if (!child_domain) + if (IS_ERR(child_domain)) goto next_pd; if (of_parse_phandle_with_args(np, "power-domains", @@ -217,7 +217,7 @@ no_clk: goto next_pd; parent_domain = of_genpd_get_from_provider(&args); - if (!parent_domain) + if (IS_ERR(parent_domain)) goto next_pd; if (pm_genpd_add_subdomain(parent_domain, child_domain))