Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3624979imu; Mon, 28 Jan 2019 08:03:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN73JCwFMswbf8LHR5MbyMDpVYCUrkoDSi2udTCOyiCFLKB27nsf31HYmNZ29mQKbWJRez0P X-Received: by 2002:a17:902:780c:: with SMTP id p12mr21838575pll.197.1548691388952; Mon, 28 Jan 2019 08:03:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691388; cv=none; d=google.com; s=arc-20160816; b=u4REodTI+GsWWt8+UYqnL2BPoHy1OI0kF3h7qpU/Yl2gh0iUpFib3Y3ako+4bhoTVd NHulCdJ8sjtVudGIVqWNDkTyrIvRD8Uq1rWeFWZkFshqNASat/jlx2c6SNSSvOTNTLTz uuDM/RqKgdtjT6KoE+m6CMCCEueug468puOlInj+A0Q3bcr5/6S+cGgHQis/WCgBjbiy 0SIGXjh4r75B5F/JzAV/ZSPwwhvGN+KKivtIESSa7mZbS6QdnyORV3ElevnpajRB62h1 s8LajhVT62C57lxlvpvSMpyUx0XHptPFzOFQinkgQ3MQ20dwNCSpS0ZJ4aFxl078G7Hd rpbg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JXscSLj/hK8d1RjqHvbkWilinlz0NLm7dFV1f9nw7os=; b=F6yXuKKHDh149y63ECp0wHNOPda1snLu9xLkODsOBYkIdhPCODv5MgbHQWTC16F73T e4/uewinT12W8rOV737Mhe8RIHd+Mj9yf/3uCK7L9blQu9ncP9fet+EoQONF34P28adS 01dJE58XB/1kFkPrI56vNVhezPfGK9/Bpcp3EC3tk8X8Kp+y8zfMJ0sEUmwvySIvUTc1 FYGHE8ePRA97Eqa6Iodz156RA5y1igMVoESlrSOuDpGg/0dLnjsmESPTuiGNeBHe5uld RtZnz9q37z4XVnI40Y7iHtox0xrENOYGXfZbPn3nKmmMv8LG21Oz9pnP1x0kj3qAWF6x A/RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uaORL9XL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l129si6318544pfl.284.2019.01.28.08.02.52; Mon, 28 Jan 2019 08:03:08 -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=uaORL9XL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731168AbfA1QCC (ORCPT + 99 others); Mon, 28 Jan 2019 11:02:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:47058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731120AbfA1QBu (ORCPT ); Mon, 28 Jan 2019 11:01:50 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1DAE21852; Mon, 28 Jan 2019 16:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691310; bh=XMCt/Am89DSH2OqT69hpegTGT7rZbwrgd6n7iSi0E8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uaORL9XLaSAgAcCFjMIB7HTxr3AX3qhcTDCPlASmN6M5CYb3a5Jso6jdo3Do8LUsN 9HD6J63usNvUYWq3q+ICuC5UB26Rh8jhmuc5n/x0sQ++0krlQs52ZKqnEW56s3g+Jq LE5lLe1Buas9jLWrp0trU9AX+8DV7UIthGqyAmEc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yangtao Li , Thierry Reding , Sasha Levin , linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 054/258] soc/tegra: Don't leak device tree node reference Date: Mon, 28 Jan 2019 10:56:00 -0500 Message-Id: <20190128155924.51521-54-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li [ 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