Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2724757imj; Mon, 11 Feb 2019 07:33:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IZcPtBh7auox/y96aMp0N+8B/kllp5enFflajvH0sMQh8ahNNa+ggm5ewGtCNBd1la0vaGH X-Received: by 2002:a17:902:112c:: with SMTP id d41mr36892405pla.144.1549899185547; Mon, 11 Feb 2019 07:33:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899185; cv=none; d=google.com; s=arc-20160816; b=PkJA73LG4UoM+bHWnXmuh3TxwSyeJJDL+g6d7TNQdtKZWNMy3VZgwRKYTkVPNzVIiu egbchUrlfjFLi2nlsKRBgFrZ3iiiLkMMmfQ4ayw3/C0VoC9Z+CUhQ15ere8f+MErlvpS Wi463mfgBtmbptt5oZBVsyryaKwcEG2NAaueNxn/3SPIqkIG03eAVT0ZkF/q6JDOn7Ha UWpyTtoYbd3MvPOCVpxt2jBFSk9Zy5HRFT+q/8H/BZzx6VD2PvFvR1ITCPABHIoAQLMo O2OG4C8aMegfsRkJJmrKTSgxFIfGZMWF77tc3+RMSzGtBEsahcGeOyB2qTMRX6Twx0P3 iCJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nc09ZB/QAnY1bWvHEPwhqzZUauriiNbgpo/q7l96jD8=; b=c/q3skjUnvPzq0boI232fiuS8YUqpZYSaDNzepdZH6MaaUybr1vvIWHXMr8YsXcsBY 8gI7So00J9puvE15YTbElFqB7ZA4L7M//Pp/Wl4Dic5W6wIfJ+WTbZPpxQzkYF2I7KDa v1xdsFOpEogIT1lS/e3Fus6d/qHMPv3Q1QexmvYpdgrob1GoKzOa4RnlgPGf1ZFCHD7i miCpC5I8jZcoVgF7RclHyY1OoAuNpMtTbqCLVhOAXw2YYe6F+zXEVoltYkYpbfjd0RQE k3AlCTKgbP8F2ySN7sm6dofy3I+fPcCIeQD4PXGgfw+VCeZyz4k1pgr3nAYhsh6NnHax bA0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=avq9mDIg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u25si9606158pgm.532.2019.02.11.07.32.48; Mon, 11 Feb 2019 07:33:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=avq9mDIg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388956AbfBKOzX (ORCPT + 99 others); Mon, 11 Feb 2019 09:55:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:42370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388950AbfBKOzU (ORCPT ); Mon, 11 Feb 2019 09:55:20 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 3B8F32229E; Mon, 11 Feb 2019 14:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896919; bh=r/h0rOemdFcekdYkkmCDkbFKTUHIU5yXibQSoBTfYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avq9mDIgYZewzBrnXpzThGGc5yQz/dDMbiipc72zXxdsMtvZGgl+3fDnQn1tXod4f gKU848yzKXIJe8shV6z/Nwq8pfVbcEP+ZXj187kCpalwkAuCbD0DgrKGXMeY4hF8Jh ltSmbMnYLL8I+dshvuNW2uS5AkVmpkQ1NUCfbvOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yangtao Li , Jon Hunter , Thierry Reding , Sasha Levin Subject: [PATCH 4.14 032/205] soc/tegra: Dont leak device tree node reference Date: Mon, 11 Feb 2019 15:17:10 +0100 Message-Id: <20190211141829.964660948@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 9eb40fa2cd2d1f6829e7b49bb22692f754b9cfe0 ] of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. soc_is_tegra() doesn't do that, so fix it. Signed-off-by: Yangtao Li Acked-by: Jon Hunter [treding: slightly rewrite to avoid inline comparison] Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/soc/tegra/common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c index cd8f41351add..7bfb154d6fa5 100644 --- a/drivers/soc/tegra/common.c +++ b/drivers/soc/tegra/common.c @@ -22,11 +22,15 @@ static const struct of_device_id tegra_machine_match[] = { bool soc_is_tegra(void) { + const struct of_device_id *match; struct device_node *root; root = of_find_node_by_path("/"); if (!root) return false; - return of_match_node(tegra_machine_match, root) != NULL; + match = of_match_node(tegra_machine_match, root); + of_node_put(root); + + return match != NULL; } -- 2.19.1