* [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers
@ 2026-11-23 16:47 Lee Jones
2026-11-23 16:47 ` [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
To: lee, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
linux-riscv
Cc: linux-kernel, Uwe Kleine-König, Zhao, Linaro, Abel Vesa,
Alim Akhtar, Amit Daniel Kachhap, Anirudh Srinivasan,
Brian Masney, Chander Kashyap, Chanwoo Choi, Dong Aisheng,
Drew Fustini, Fabio Estevam, Francesco Dolcini, Frank Li,
Heiko Stuebner, imx, Jerome Brunet, Joel Stanley, Jonathan Hunter,
Jyri Sarha, Krzysztof Kozlowski, Lad Prabhakar, Liam Beguin,
Linaro Ltd, linux-arm-kernel, linux-clk, linux-samsung-soc,
linux-tegra, Lubomir Rintel, Lukasz Luba, Marian Mihailescu,
Maxime Coquelin, Mike Looijmans, Peng Fan, Pengpeng Hou,
Pengutronix Kernel Team, Peter Griffin, Prashant Gaikwad,
Rosen Penev, Sascha Hauer, Sergej Sawazki, Shawn Guo,
Stephen Boyd, Sylwester Nawrocki, Thierry Reding, Thomas Abraham,
Tomasz Figa
These issues were reported by Sashiko.
None of these changes have been tested on physical hardware.
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Zhao, Linaro" <richard.zhao@linaro.org>
Cc: Abel Vesa <abelvesa@kernel.org>
Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Cc: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
Cc: Brian Masney <bmasney+clk@redhat.com>
Cc: Chander Kashyap <k.chander@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Drew Fustini <fustini@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>
Cc: Frank Li <Frank.Li@nxp.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: imx@lists.linux.dev
Cc: Jerome Brunet <jbrunet+clk@baylibre.com>
Cc: Joel Stanley <jms@oss.tenstorrent.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Liam Beguin <lvb@xiphos.com>
Cc: Linaro Ltd <mturquette@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-clk@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: Lubomir Rintel <lkundrak@v3.sk>
Cc: Lukasz Luba <lukasz.luba@arm.com>
Cc: Marian Mihailescu <mihailescu2m@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
Cc: Rosen Penev <rosenp@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sergej Sawazki <ce3a@gmx.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Thierry Reding <thierry.reding@kernel.org>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Lee Jones (10):
clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks
clk: lmk04832: Validate child reg index in lmk04832_probe()
clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS
clk: composite: Initialise sub-hw pointers in determine_rate()
clk: divider: Avoid division by zero in _div_round_closest()
clk: gpio: Reject gate clocks with multiple parents
clk: samsung: exynos5420: Terminate PLL rate tables with sentinels
clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable()
clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind
clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF
drivers/clk/clk-cdce925.c | 4 ++--
drivers/clk/clk-composite.c | 2 ++
drivers/clk/clk-divider.c | 3 +++
drivers/clk/clk-gpio.c | 3 +++
drivers/clk/clk-lmk04832.c | 10 ++++++++--
drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++++
drivers/clk/mmp/clk-audio.c | 4 ++--
drivers/clk/samsung/clk-exynos5420.c | 4 ++++
drivers/clk/tegra/clk-bpmp.c | 14 +++++++-------
drivers/clk/tenstorrent/atlantis-prcm.c | 9 +++++----
10 files changed, 40 insertions(+), 17 deletions(-)
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS
2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
To: lee, Prashant Gaikwad, Stephen Boyd, Brian Masney, Jerome Brunet,
Thierry Reding, Jonathan Hunter, Rosen Penev, linux-clk,
linux-tegra, linux-kernel
Cc: stable
Both cmd_clk_get_all_info_response and tegra_bpmp_clk_info size their
parents arrays to MRQ_CLK_MAX_PARENTS (16), whereas response.num_parents
is an 8-bit unsigned integer received from BPMP firmware.
tegra_bpmp_clk_get_info() copies response.num_parents entries from the
stack response into the heap info structure without checking against
MRQ_CLK_MAX_PARENTS, and the caller only checks against U8_MAX after the
copy has already overflowed both arrays.
Validate that response.num_parents does not exceed MRQ_CLK_MAX_PARENTS
before copying parent IDs, and drop the redundant U8_MAX check.
Fixes: ca6f2796eef7 ("clk: tegra: Add BPMP clock driver")
Closes: https://sashiko.dev/#/bug/linux-785615f3-ab51-451a-b58c-fe29c7f09bfe
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/clk/tegra/clk-bpmp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
index 0bb28f96274f..3649324e2e1f 100644
--- a/drivers/clk/tegra/clk-bpmp.c
+++ b/drivers/clk/tegra/clk-bpmp.c
@@ -376,6 +376,13 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,
return -E2BIG;
}
+ if (response.num_parents > MRQ_CLK_MAX_PARENTS) {
+ dev_err(bpmp->dev,
+ "clock %u has too many parents (%u, max: %u)\n",
+ id, response.num_parents, MRQ_CLK_MAX_PARENTS);
+ return -EINVAL;
+ }
+
info->num_parents = response.num_parents;
for (i = 0; i < info->num_parents; i++)
@@ -453,13 +460,6 @@ static int tegra_bpmp_probe_clocks(struct tegra_bpmp *bpmp,
if (err < 0)
continue;
- if (info->num_parents >= U8_MAX) {
- dev_err(bpmp->dev,
- "clock %u has too many parents (%u, max: %u)\n",
- id, info->num_parents, U8_MAX);
- continue;
- }
-
/* clock not exposed by BPMP */
if (info->name[0] == '\0') {
holes++;
--
2.56.1.750.gf70dc682cf-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 16:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
2026-11-23 16:47 ` [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox