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 37E3E3EDACC; Wed, 20 May 2026 17:43:16 +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=1779298997; cv=none; b=U2/Q0Gg1bVx5SjZgslGghoWO4QV98R0tHQ2T1oSY3L9r4fpH3N7pYl2BaCjNRXbMd55fPX/ij2GPzGVMZwGQDqp0w8bfCFSfw9DpFjejykn9m2090j7P/z/LlUjKiKpOuWYmv5keLFcpJ/ZYWMQ7qo8ulc6sYVejypxiU4ZIrT0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298997; c=relaxed/simple; bh=ugQmfA5X7e4uM/8aSenPAiIyh8BMF29/hl7S+MkZ6tk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RKcaxFlXIUk/rh9MKlOZbTtTrySj6WAQNIgfa/MpY2yafcn7qSP0W43hnX7MenxhaFLTNVAH+RewIntQl6w7n9D3lTHCxXRikemswDklvi1oj1Uf9gjFD2uwyW9YwE6C87mXWy1fGZQxkwKFtuh6NavdwDblW/nyQHPF7uaUj18= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hLmLACqQ; 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="hLmLACqQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D2591F000E9; Wed, 20 May 2026 17:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779298996; bh=+XG9P/fHs+4AT86Z15g361xcFatvlotKev5dqqqP0+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hLmLACqQEJvQM9pu4ww2GaNXX80IrnP5/lyJ+rSjEAYw1dARZVJ9ApXvG4+CecbKe 0yaXmjYsUDvI1tb9/SGVLTVPUeYd2wRKa7MizkjhK6Wt63P90CFAx0ydhASMfkhqgc X/ZZjfdiPG0rBEsranL1E6jvVz4k8nta4GO7oFc8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Gu , Frank Li , Peng Fan , Abel Vesa , Sasha Levin Subject: [PATCH 6.18 572/957] clk: imx: imx6q: Fix device node reference leak in of_assigned_ldb_sels() Date: Wed, 20 May 2026 18:17:35 +0200 Message-ID: <20260520162146.935165219@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@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 9faf207208951460f3f7eefbc112246c8d28ff1b ] The function of_assigned_ldb_sels() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak. Fix this by adding proper cleanup calls on all exit paths. Fixes: 5d283b083800 ("clk: imx6: Fix procedure to switch the parent of LDB_DI_CLK") Signed-off-by: Felix Gu Reviewed-by: Frank Li Reviewed-by: Peng Fan Link: https://patch.msgid.link/20260203-clk-imx6q-v3-2-6cd2696bb371@gmail.com Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-imx6q.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c index ba696cf34fe3b..048e2ddba490b 100644 --- a/drivers/clk/imx/clk-imx6q.c +++ b/drivers/clk/imx/clk-imx6q.c @@ -188,9 +188,11 @@ static void of_assigned_ldb_sels(struct device_node *node, } if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) { pr_err("ccm: parent clock %d not in ccm\n", index); + of_node_put(clkspec.np); return; } parent = clkspec.args[0]; + of_node_put(clkspec.np); rc = of_parse_phandle_with_args(node, "assigned-clocks", "#clock-cells", index, &clkspec); @@ -198,9 +200,11 @@ static void of_assigned_ldb_sels(struct device_node *node, return; if (clkspec.np != node || clkspec.args[0] >= IMX6QDL_CLK_END) { pr_err("ccm: child clock %d not in ccm\n", index); + of_node_put(clkspec.np); return; } child = clkspec.args[0]; + of_node_put(clkspec.np); if (child != IMX6QDL_CLK_LDB_DI0_SEL && child != IMX6QDL_CLK_LDB_DI1_SEL) -- 2.53.0