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 D0501C04E87 for ; Mon, 20 May 2019 12:53:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A766521479 for ; Mon, 20 May 2019 12:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558356835; bh=oSL33nRfEDexHbU6H9ttwFQneATHUrvFkictUQE1daU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nTLQ/CFIFMYIIzwFhIDOGpeG7jagBiNM2ysmLv8jGPVtvTiJ984Ey3F9uVj92NaRD VWXWO/bPGdoITmTXzsgqURG0XS7fLy81N+l24CrWPIqo6w0ZZofd5BJOgO+hPyrPNW PA7vNii1B3XQXf3JiCNN+iE0VUANpYD84ckq+JMU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730479AbfETMxy (ORCPT ); Mon, 20 May 2019 08:53:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:57780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732115AbfETMQ5 (ORCPT ); Mon, 20 May 2019 08:16:57 -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 6AC60208C3; Mon, 20 May 2019 12:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354616; bh=oSL33nRfEDexHbU6H9ttwFQneATHUrvFkictUQE1daU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9nBlIsINf3z8e6zr8dK7wUH/N7U1eWVQ9u/Pz/7vB/OQvmMQR2X7uiO+VPaCi4v4 jaass0g7zEPBnFs4wjOCy7+Ave6YU7QnpCTatH7Zl2HI7fKngmZX41/pyKNLLYNQ/S c6UTUYJHiCIC683WElXAEmzNJ/mu7UlyJR78d05g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , Krzysztof Kozlowski Subject: [PATCH 4.9 07/44] ARM: exynos: Fix a leaked reference by adding missing of_node_put Date: Mon, 20 May 2019 14:13:56 +0200 Message-Id: <20190520115231.853415633@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115230.720347034@linuxfoundation.org> References: <20190520115230.720347034@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 @@ -205,6 +205,7 @@ void __init exynos_firmware_init(void) return; addr = of_get_address(nd, 0, NULL, NULL); + of_node_put(nd); if (!addr) { pr_err("%s: No address specified.\n", __func__); return; --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -715,8 +715,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;