From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1799AC04AAF for ; Mon, 20 May 2019 12:25:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D718C21479 for ; Mon, 20 May 2019 12:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355154; bh=GGte2Vf7wiE+9+k9pkk8adb1T/XIjxDDA2GrzUEYLyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TJRASWJKdXUwxDNADNpv89jK8ODIj1/imz+0fzZYdETquZ1VVm3SJVJS+77RKImeE u15nL3OAvMVFjQu19fkvtsrbUuB39VKahnE18zGQJrFOy5J00ei08qmVlKCwVeQ4xP FZF6BSTexrtL6wWOOvWPl/jJpab2DAACP8r71hhU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389188AbfETMZx (ORCPT ); Mon, 20 May 2019 08:25:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:41162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389179AbfETMZw (ORCPT ); Mon, 20 May 2019 08:25:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB358214AE; Mon, 20 May 2019 12:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355151; bh=GGte2Vf7wiE+9+k9pkk8adb1T/XIjxDDA2GrzUEYLyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dq3dT3+EhXecu9vfsVG2XeAAu5NLLss8m74Zxr9llKz3jakPvwXR8J0KpxnxOGlR+ QAQj54WIZqFtEAF49VgTdbbs+3Yi1j6zXJbdnP912HDyLGCASg2+EVRaMykyDwoox8 peiV1FlESwCGQ0f8d39EwtR8TmNaw1KValqceDIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , Krzysztof Kozlowski Subject: [PATCH 5.0 011/123] ARM: exynos: Fix a leaked reference by adding missing of_node_put Date: Mon, 20 May 2019 14:13:11 +0200 Message-Id: <20190520115245.901703334@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115245.439864225@linuxfoundation.org> References: <20190520115245.439864225@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wen Yang commit 629266bf7229cd6a550075f5961f95607b823b59 upstream. The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with warnings like: arch/arm/mach-exynos/firmware.c:201:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 193, but without a corresponding object release within this function. Cc: stable@vger.kernel.org Signed-off-by: Wen Yang Signed-off-by: Krzysztof Kozlowski Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-exynos/firmware.c | 1 + arch/arm/mach-exynos/suspend.c | 2 ++ 2 files changed, 3 insertions(+) --- a/arch/arm/mach-exynos/firmware.c +++ b/arch/arm/mach-exynos/firmware.c @@ -196,6 +196,7 @@ bool __init exynos_secure_firmware_avail return false; addr = of_get_address(nd, 0, NULL, NULL); + of_node_put(nd); if (!addr) { pr_err("%s: No address specified.\n", __func__); return false; --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -639,8 +639,10 @@ void __init exynos_pm_init(void) if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); + of_node_put(np); return; } + of_node_put(np); pm_data = (const struct exynos_pm_data *) match->data;