Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2771635imj; Mon, 11 Feb 2019 08:13:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IZf5rx9Ur0SPyYLiCny9lU6U4OOZzh0mwDce0RuACgQ/uwvFHev7bwP7ctHgzlJ1sYaZfyS X-Received: by 2002:a65:609a:: with SMTP id t26mr33526314pgu.411.1549901615702; Mon, 11 Feb 2019 08:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901615; cv=none; d=google.com; s=arc-20160816; b=Imd54DAYdzUUI1e/DKsXYkYE5IAAMQytKQRt0LDNEVrcPeTg/AZyPQaWOXN2g9hEX9 BapE2OExaym7lvj8t8yFkJLfQy5gzwBk/qO1bbHb8Se8rLootrL+eZqTQMNTNTJq2BW5 UlT77CCWrtYIp2UwAEEBl9lRHUM3CUfOY+9isJK6JjLQIsMnMfGKo/s2domO2NlJMYDd RpoLFD5JpJ+6HnbqZ/SzSyxWnx+d737mnAAEWfu7Gq1bnAftBHNVL9nheG7hF6TYuD+h fE5mxTEuv6hwuiGrlEcxOEDJZCVOIvMEiOKJ9GnOYTb5IcQq1rY/v6f3649ZvcrcDrvD 7aCg== 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=PU20q2G4Atqu0/5CZ4z9aKzMiCtbSODlcautoOOeJaM=; b=J5rDHMJKZV843fZpk37/4gORWgEaJ0GcTqtrecOxwW2uX9mL2/JlTF3Ft/eCwj4o8F AhZl4McOrhO+i/+UTJncD4q8G1jl5EdfqHuDWL3tvOiTM4s6+QTKQgcozOjhdYpUGmEA /TurAmWwO2NNciSY3Acp1ZH2XND8z0RhDB0PolSRCe+ECTVHJkVN7JaKFtSOlA8TjT1Q MLueIkIgL3m3qsLldqxEJ3Aienw/qHuDWEqGlF3FNln1pjlFHAtsgOqA2X5ecPXWQipK +i2FNPcNHKW3ApKGBq5/docyL6Ewd6p10X2ThlTTmGtP9zNnnHtEIBuk7xJaljDwI7Hw ohXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WCsTyJNP; 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 j14si2563209pfe.152.2019.02.11.08.13.14; Mon, 11 Feb 2019 08:13:35 -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=WCsTyJNP; 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 S1728956AbfBKOXR (ORCPT + 99 others); Mon, 11 Feb 2019 09:23:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:56234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727914AbfBKOXN (ORCPT ); Mon, 11 Feb 2019 09:23:13 -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 AB8CC222A1; Mon, 11 Feb 2019 14:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894993; bh=DFw1/K3/fU/OVN4nkskxkQQ0xAFswGWWhMMlcDMBXvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCsTyJNPk0hp0qQTu6iNhaUle/zngCkpmYA8kYVIwIAbHiRQZ1x4nug6Kg3Ws4MlK YU5CxI6xtBv3TILIk7iDo1qyuzIazy2uTphh8e2kWEGWVbKmbxhICsGjM30pbjLHqO PFcv+jJYwxvJTeV8eNGcu32t/txoeEN0C2OHDxVw= 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.20 056/352] soc/tegra: Dont leak device tree node reference Date: Mon, 11 Feb 2019 15:14:43 +0100 Message-Id: <20190211141849.742009715@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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