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 E96082ECE86; Sat, 12 Sep 2026 16:05:34 +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=1789229136; cv=none; b=aPr2xvy2JyL7NAgYTLFxpYrDFgdqxAMMV8ELiUF6ZjfxfacqjNZ2bWFp8ek5BrVLNSfdFxYeyhKsHylruapXGAQORuqZSsmmTf7VFUQg9EAWOR6q8AT7WMMPdu5lORzQEyWp8CeOSAl8TAMviKicFa8h4+eC6l4XXfSra8gYUmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789229136; c=relaxed/simple; bh=Mx2WKte0JrpoPWcemQYfr9HMm51DEoLtMAYiJcTaJWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jwIAe0YeRyuWdEUFpxFUhwMkq3mcT2/3EaWBN8Y8z516HAna+Za8yCXspjYuPsJVhaHz7aUaRBxaAUHaptDnjwMDy/UN9ItmHrHwQcJYzQejMj9wGVU1aV/SRFNDSQhLR/qHKrTbWhpAf7osD8qnPUEZi+DrVSOzZs3d0x9+D28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lLEM9B1V; 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="lLEM9B1V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A30371F000FF; Sat, 12 Sep 2026 16:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789229134; bh=Bf6KdXp3+SYOI5J8OUQRuIGDkBWAa7u5S+JQX/qXMzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lLEM9B1V4841GcKFZDy9SglbzwuRagARaoG/gZVcyym0vmcwmMmeTdjNvIxwv83Q5 uSwirTVz5ZP5bvf++xMxnUEABZN7tGF3FNk6yoJYapcYVsZAd5/fJgf+U9IBg7lw+7 jxOlV3v4ljFz5iwNFXihzjEOCUQgvBpq406E1vqc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuho Choi , Andreas Kemnade , "Kevin Hilman (TI)" , Sasha Levin Subject: [PATCH 6.1 0528/1191] bus: ti-sysc: Fix /chosen node reference leak Date: Sat, 12 Sep 2026 08:54:16 +0200 Message-ID: <20260912065600.107918194@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuho Choi [ Upstream commit 6342de0aed216b6df460b492ddb532b3e0ed16f1 ] sysc_init_stdout_path() gets the /chosen node with of_find_node_by_path() to read stdout-path. The function then overwrites the local node pointer with the stdout-path lookup result, or exits on error, without dropping the /chosen reference. Keep the /chosen node in a separate variable and put it after the stdout-path value has been used for the lookup. The successful stdout node lookup remains referenced by the cached stdout_path pointer. Fixes: 3bb37c8e6e6a ("bus: ti-sysc: Handle stdout-path for debug console") Signed-off-by: Yuho Choi Reviewed-by: Andreas Kemnade Link: https://patch.msgid.link/20260615200540.770205-1-dbgh9129@gmail.com Signed-off-by: Kevin Hilman (TI) Signed-off-by: Sasha Levin --- drivers/bus/ti-sysc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c index 42037b15594a8..f2b6cc154aeac 100644 --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -694,6 +694,7 @@ static struct device_node *stdout_path; static void sysc_init_stdout_path(struct sysc *ddata) { + struct device_node *chosen; struct device_node *np = NULL; const char *uart; @@ -703,15 +704,18 @@ static void sysc_init_stdout_path(struct sysc *ddata) if (stdout_path) return; - np = of_find_node_by_path("/chosen"); - if (!np) + chosen = of_find_node_by_path("/chosen"); + if (!chosen) goto err; - uart = of_get_property(np, "stdout-path", NULL); - if (!uart) + uart = of_get_property(chosen, "stdout-path", NULL); + if (!uart) { + of_node_put(chosen); goto err; + } np = of_find_node_by_path(uart); + of_node_put(chosen); if (!np) goto err; -- 2.53.0