From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 219DB46D0A9; Tue, 21 Jul 2026 17:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784656074; cv=none; b=U++5v/seJSkqFFb0UjeXmGr+E4LdlA2NBl75PUZx20RQ+8mN9M5pdRzNqQSh1Li1PUAZxDcSQ95hzYAn6APgccVA91Rk/GBJVD8JpLkxGpVkpiVlB7qL9xdgqR7oLeki8DgX9rUaA0niZVZV+27BOXVwpAxUxaNSXiPe5g10SWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784656074; c=relaxed/simple; bh=T+GkngDELFnK8QiTZehlpidjW+2iVYcwIwhWncVt87s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fVHvkx6IQs3TvyTXM0j6so/B48yEpK/qHV9H04cm+ES3YVW4/FgEQR3mAUpR+QwHTtQnekftivGtUlea2pAGUNW8c086DpHoVXAcpfwOKMcPCvrGGAzfr/Moon65c96FcJvMONKpy2wUtQ+E99mrQOHI9UZyVmP1ZTQBJS5t75M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S8vz9KR+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="S8vz9KR+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3A0B1F00A3A; Tue, 21 Jul 2026 17:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784656070; bh=EBkBKfewD2i1gLBwLAlSbYOAydl6AyWNx45j0X1PAuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=S8vz9KR+f/FY0gi6VZqESBmHi72fJ1FL3hZbQ3s8LwlMGacmavi4hIUfqgT9J4oYm nsp4jwvL9mKoMKIzVdbDHiheDrqfjcpEYHpaDhzZNF66IVkCCFAhnS7vKPdg6evpnf CAHZ0LZUdVJuGRmSN6eLg+BqXxvGdQhG1+nDyJQ0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Gu , Mikko Perttunen , Thierry Reding , Sasha Levin Subject: [PATCH 6.18 0249/1611] drm/tegra: dc: Fix device node reference leak in tegra_dc_has_output() Date: Tue, 21 Jul 2026 17:06:05 +0200 Message-ID: <20260721152520.632589207@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Gu [ Upstream commit 63a3998d792ab5c45304bf879e385a31fa923b61 ] The of_for_each_phandle() macro increments the reference count of the device node it iterates over. If the loop exits early, the reference must be released manually. In tegra_dc_has_output(), the function returns true immediately when a match is found, failing to release the current node's reference. Fix this by adding a call to of_node_put() before returning from the loop. Fixes: c57997bce423 ("drm/tegra: sor: Add Tegra186 support") Signed-off-by: Felix Gu Acked-by: Mikko Perttunen Signed-off-by: Thierry Reding Link: https://patch.msgid.link/20260128-dc-v1-1-a88205826301@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/dc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 6c84bd69b11ff4..dc69c88736934a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -100,8 +100,10 @@ bool tegra_dc_has_output(struct tegra_dc *dc, struct device *dev) int err; of_for_each_phandle(&it, err, np, "nvidia,outputs", NULL, 0) - if (it.node == dev->of_node) + if (it.node == dev->of_node) { + of_node_put(it.node); return true; + } return false; } -- 2.53.0