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,URIBL_BLOCKED,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 768FAC04AAC for ; Mon, 20 May 2019 12:31:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A7ED216FD for ; Mon, 20 May 2019 12:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355487; bh=GGte2Vf7wiE+9+k9pkk8adb1T/XIjxDDA2GrzUEYLyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=meMwhm7MURV0hS4SSOdib3pVwOYUerbwPIzYhyyPHm+G29Gs/S+8tVO3wByh9A5cs F8uuOyrqG64WrjVDvUyjpTcpuhaDQanmDEqg+kmSH6qpUuhwqs2IyfntIYRFcvSrmK 15q9zNs05Giex1/SeUUyEo5dfLZ1loWFZQDMaKKY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390324AbfETMbZ (ORCPT ); Mon, 20 May 2019 08:31:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:47954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390284AbfETMbX (ORCPT ); Mon, 20 May 2019 08:31:23 -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 C7484214DA; Mon, 20 May 2019 12:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355482; bh=GGte2Vf7wiE+9+k9pkk8adb1T/XIjxDDA2GrzUEYLyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ra6uIIqejLOqdkWvu09NgYwuxAmEzTjamK4bPrefXxVgyKNjBEGhFbYokWQs3imo9 lqYYlw8pLbPBLkAnz3Lvgxkm6G2KC+EB7Wx2adItvGvABlE87dzziH/O4E9jG8YStJ x0+ivXYBWGewJMKDJcNbZMyEQ9VrX83xDAZ7giMw= 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.1 012/128] ARM: exynos: Fix a leaked reference by adding missing of_node_put Date: Mon, 20 May 2019 14:13:19 +0200 Message-Id: <20190520115250.283892975@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115249.449077487@linuxfoundation.org> References: <20190520115249.449077487@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;