Linux clock framework development
 help / color / mirror / Atom feed
* [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 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ 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] 14+ messages in thread

* [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks
  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
  2026-11-23 17:25   ` Frank Li
  2026-11-23 16:47 ` [PATCH 02/10] clk: lmk04832: Validate child reg index in lmk04832_probe() Lee Jones
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney,
	Jerome Brunet, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Pengpeng Hou, Dong Aisheng, Shawn Guo, linux-clk,
	imx, linux-arm-kernel, linux-kernel
  Cc: stable

imx_lpcg_parse_clks_from_dt() allocates output_names, parent_names, and
bit_offset on the stack with IMX_LPCG_MAX_CLKS (8) entries each to match
the hardware limit of eight clock outputs per LPCG block.  However, it
only checks whether of_property_count_u32_elems() returns a negative
error code and enforces no upper bound on count.

If a Device Tree node specifies more than IMX_LPCG_MAX_CLKS entries in
clock-indices, subsequent calls to of_property_read_u32_array(),
of_clk_parent_fill(), and of_property_read_string_array() write past the
end of these stack buffers.  Reject counts exceeding IMX_LPCG_MAX_CLKS.

Fixes: d5f1e6a2bb61 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree")
Closes: https://sashiko.dev/#/bug/linux-22dfac78-f44b-42f8-985a-995308723fc4
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index 9ad016106b1e..5eb4bdbaf7d8 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -199,6 +199,10 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,
 		dev_err(&pdev->dev, "failed to count clocks\n");
 		return -EINVAL;
 	}
+	if (count > IMX_LPCG_MAX_CLKS) {
+		dev_err(&pdev->dev, "too many clocks: %d\n", count);
+		return -EINVAL;
+	}
 
 	/*
 	 * A trick here is that we set the num of clks to the MAX instead
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 02/10] clk: lmk04832: Validate child reg index in lmk04832_probe()
  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 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
@ 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
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, Liam Beguin,
	linux-clk, linux-kernel
  Cc: stable

lmk04832_probe() allocates lmk->clkout with info->num_channels (14)
elements, then iterates over child Device Tree nodes and reads each
child's "reg" property into a signed integer without bounds validation.
It immediately indexes lmk->clkout[reg] to populate .format and .sysref,
causing a heap out-of-bounds write if "reg" is greater than or equal to
info->num_channels (or negative when interpreted as a signed int).

Read "reg" as u32 and reject values greater than or equal to
info->num_channels before indexing lmk->clkout.

Fixes: 3bc61cfd6f4a ("clk: add support for the lmk04832")
Closes: https://sashiko.dev/#/bug/linux-75db6ed8-b83a-4866-b3f7-d486d223d97f
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-lmk04832.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
index e6e771e8eb14..757b0eba739f 100644
--- a/drivers/clk/clk-lmk04832.c
+++ b/drivers/clk/clk-lmk04832.c
@@ -1453,7 +1453,7 @@ static int lmk04832_probe(struct spi_device *spi)
 				 &lmk->sysref_pulse_cnt);
 
 	for_each_child_of_node_scoped(lmk->dev->of_node, child) {
-		int reg;
+		u32 reg;
 
 		ret = of_property_read_u32(child, "reg", &reg);
 		if (ret) {
@@ -1462,12 +1462,18 @@ static int lmk04832_probe(struct spi_device *spi)
 			return ret;
 		}
 
+		if (reg >= info->num_channels) {
+			dev_err(lmk->dev, "invalid reg %u in child: %s\n",
+				reg, child->full_name);
+			return -EINVAL;
+		}
+
 		of_property_read_u32(child, "ti,clkout-fmt",
 				     &lmk->clkout[reg].format);
 
 		if (lmk->clkout[reg].format >= 0x0a && reg % 2 == 0
 		    && reg != 8 && reg != 10)
-			dev_err(lmk->dev, "invalid format for clkout%02d\n",
+			dev_err(lmk->dev, "invalid format for clkout%02u\n",
 				reg);
 
 		lmk->clkout[reg].sysref =
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ 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 ` [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
  2026-11-23 16:47 ` [PATCH 02/10] clk: lmk04832: Validate child reg index in lmk04832_probe() Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 16:47 ` [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate() Lee Jones
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ 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] 14+ messages in thread

* [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate()
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (2 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() Lee Jones
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, linux-clk,
	linux-kernel
  Cc: stable

__clk_hw_register_composite() leaves mux_hw->core and rate_hw->core
unset at registration time, relying on the composite callbacks to bind
them via __clk_hw_set_clk().  While the fallback branches of
clk_composite_determine_rate() and clk_composite_set_rate_and_parent()
call __clk_hw_set_clk(), the primary rate + mux branch omits it.

When a composite clock with both rate and mux operations has only a
single parent, __clk_init_parent() skips .get_parent(), leaving
mux_hw->core NULL.  Subsequent calls to clk_hw_get_parent(mux_hw) or
clk_hw_get_num_parents(mux_hw) in clk_composite_determine_rate() then
dereference NULL.

Call __clk_hw_set_clk() for both rate_hw and mux_hw in the primary
branch of clk_composite_determine_rate().

Fixes: 2f508a955a67 ("clk: Convert basic types to clk_hw based provider APIs")
Closes: https://sashiko.dev/#/bug/linux-55b1d094-a5a2-44a2-b323-dddc52661f32
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-composite.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 11842bce5918..c7c1ff590e14 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -69,6 +69,8 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
 
 	if (rate_hw && rate_ops && rate_ops->determine_rate &&
 	    mux_hw && mux_ops && mux_ops->set_parent) {
+		__clk_hw_set_clk(rate_hw, hw);
+		__clk_hw_set_clk(mux_hw, hw);
 		req->best_parent_hw = NULL;
 
 		if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest()
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (3 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate() Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 17:13   ` sashiko-bot
  2026-11-23 16:47 ` [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents Lee Jones
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, Lad Prabhakar,
	Sascha Hauer, Zhao, Linaro, Linaro Ltd, Maxime Coquelin,
	Uwe Kleine-König, linux-clk, linux-kernel
  Cc: stable

When CLK_SET_RATE_PARENT is not set on a CLK_DIVIDER_ROUND_CLOSEST
divider, clk_divider_bestdiv() invokes _div_round_closest() before
clamping the resulting divisor to at least 1.  If the requested rate
exceeds parent_rate (for instance via clk_round_rate(clk, ULONG_MAX))
or parent_rate is zero, parent_rate / rate evaluates to 0.

Passing down == 0 into __rounddown_pow_of_two() triggers an undefined
shift and truncates back to 0, after which DIV_ROUND_UP_ULL() divides by
zero.

Since a divider cannot increase its parent rate, return the minimum
valid divisor directly whenever rate is greater than or equal to
parent_rate.

Fixes: 9315514252a9 ("clk: divider: fix calculation of initial best divider when rounding to closest")
Closes: https://sashiko.dev/#/bug/linux-cc7c0851-a317-4348-ab29-9d748aa20cfc
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-divider.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index f68216c65d3d..d05dc595ec4c 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -244,6 +244,9 @@ static int _div_round_closest(const struct clk_div_table *table,
 	int up, down;
 	unsigned long up_rate, down_rate;
 
+	if (rate >= parent_rate)
+		return table ? _round_up_table(table, 1) : 1;
+
 	up = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
 	down = parent_rate / rate;
 
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (4 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 16:47 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, Francesco Dolcini,
	Heiko Stuebner, Jyri Sarha, Sergej Sawazki, linux-clk,
	linux-kernel
  Cc: stable

gpio_clk_driver_probe() verifies that a gpio-mux-clock has exactly two
parents, but passes an unvalidated parent count for a gpio-gate-clock
into clk_register_gpio().  clk_register_gpio() points init.parent_data
at a two-element stack array, so a gate clock node specifying more than
two parents causes clk_core_populate_parent_map() to read past the end
of the stack buffer during registration.

A GPIO gate clock has no parent selection ops and its binding permits at
most one parent clock.  Reject gate clocks with more than one parent in
gpio_clk_driver_probe().

Fixes: 9a9b5a4af066 ("clk: gpio: Use DT way of specifying parents")
Closes: https://sashiko.dev/#/bug/linux-99ca4204-ff53-407a-8c2c-157738e7babb
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-gpio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
index df0856a39c8d..2337e8a093f0 100644
--- a/drivers/clk/clk-gpio.c
+++ b/drivers/clk/clk-gpio.c
@@ -208,6 +208,9 @@ static int gpio_clk_driver_probe(struct platform_device *pdev)
 	if (is_mux && num_parents != 2) {
 		dev_err(dev, "mux-clock must have 2 parents\n");
 		return -EINVAL;
+	} else if (!is_mux && num_parents > 1) {
+		return dev_err_probe(dev, -EINVAL,
+				     "gate-clock must have at most 1 parent\n");
 	}
 
 	gpio_name = is_mux ? "select" : "enable";
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (5 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 17:26   ` Krzysztof Kozlowski
  2026-11-23 16:47 ` [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable() Lee Jones
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
	Peter Griffin, Alim Akhtar, Stephen Boyd, Brian Masney,
	Jerome Brunet, Thomas Abraham, Chander Kashyap,
	Amit Daniel Kachhap, Tomasz Figa, Lukasz Luba, Marian Mihailescu,
	linux-samsung-soc, linux-clk, linux-arm-kernel, linux-kernel
  Cc: stable

_samsung_clk_register_pll() sizes each PLL rate table by scanning until
it encounters an entry with .rate == 0, then copies the counted entries
into pll->rate_table.  However, exynos5420_pll2550x_24mhz_tbl,
exynos5422_bpll_rate_table, exynos5420_epll_24mhz_tbl, and
exynos5420_vpll_24mhz_tbl all omit a terminating zero sentinel, causing
out-of-bounds reads into adjacent read-only data and populating
pll->rate_table with bogus entries.

Append a sentinel entry to each of the four PLL rate tables.

Fixes: ca5b40293822 ("clk: samsung: register exynos5420 apll/kpll configuration data")
Fixes: 9842452acd3d ("clk: samsung: exynos542x: Add EPLL rate table")
Fixes: 8b4a7acf7b30 ("clk: samsung: add BPLL rate table for Exynos 5422 SoC")
Fixes: b92981de92cb ("clk: samsung: exynos5420: Add VPLL rate table")
Closes: https://sashiko.dev/#/bug/linux-553831f9-0a7b-4e94-be60-222de60ca8c3
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/samsung/clk-exynos5420.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 400a5c59815c..35baeabf3ccb 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -1419,6 +1419,7 @@ static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] __ini
 	PLL_35XX_RATE(24 * MHZ, 400000000,  200, 3, 2),
 	PLL_35XX_RATE(24 * MHZ, 300000000,  200, 2, 3),
 	PLL_35XX_RATE(24 * MHZ, 200000000,  200, 3, 3),
+	{ /* sentinel */ }
 };
 
 static const struct samsung_pll_rate_table exynos5422_bpll_rate_table[] = {
@@ -1430,6 +1431,7 @@ static const struct samsung_pll_rate_table exynos5422_bpll_rate_table[] = {
 	PLL_35XX_RATE(24 * MHZ, 275000000, 275, 3, 3),
 	PLL_35XX_RATE(24 * MHZ, 206000000, 206, 3, 3),
 	PLL_35XX_RATE(24 * MHZ, 165000000, 110, 2, 3),
+	{ /* sentinel */ }
 };
 
 static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = {
@@ -1448,6 +1450,7 @@ static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = {
 	PLL_36XX_RATE(24 * MHZ,  49152000U, 197, 3, 5, -25690),
 	PLL_36XX_RATE(24 * MHZ,  45158401U, 90, 3, 4, 20762),
 	PLL_36XX_RATE(24 * MHZ,  32768001U, 131, 3, 5, 4719),
+	{ /* sentinel */ }
 };
 
 static const struct samsung_pll_rate_table exynos5420_vpll_24mhz_tbl[] = {
@@ -1459,6 +1462,7 @@ static const struct samsung_pll_rate_table exynos5420_vpll_24mhz_tbl[] = {
 	PLL_35XX_RATE(24 * MHZ, 266000000U,  266, 3, 3),
 	PLL_35XX_RATE(24 * MHZ, 177000000U,  118, 2, 3),
 	PLL_35XX_RATE(24 * MHZ, 100000000U,  200, 3, 4),
+	{ /* sentinel */ }
 };
 
 static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable()
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (6 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 16:47 ` [PATCH 09/10] clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind Lee Jones
  2026-11-23 16:47 ` [PATCH 10/10] clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF Lee Jones
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Drew Fustini, Joel Stanley, Anirudh Srinivasan, Stephen Boyd,
	Brian Masney, Jerome Brunet, linux-riscv, linux-clk, linux-kernel
  Cc: stable

The Common Clock Framework invokes .enable callbacks in atomic context
with interrupts disabled and enable_lock held.  In atlantis_clk_pll_ops,
atlantis_clk_pll_enable() is registered as the .enable callback yet
waits for PLL lock using regmap_read_poll_timeout() with a 500 us sleep
interval, triggering a sleep-in-atomic bug via usleep_range().

Since the PRCM regmap is backed by MMIO, use
regmap_read_poll_timeout_atomic() instead.

Fixes: 23c8ebc95284 ("clk: tenstorrent: Add Atlantis clock controller driver")
Closes: https://sashiko.dev/#/bug/linux-980395a6-f282-478a-bf18-b5695a725735
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/tenstorrent/atlantis-prcm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/tenstorrent/atlantis-prcm.c b/drivers/clk/tenstorrent/atlantis-prcm.c
index eccc8015da23..d9155f133713 100644
--- a/drivers/clk/tenstorrent/atlantis-prcm.c
+++ b/drivers/clk/tenstorrent/atlantis-prcm.c
@@ -313,10 +313,11 @@ static int atlantis_clk_pll_enable(struct clk_hw *hw)
 			   PLL_CFG_EN_BIT, PLL_CFG_EN_BIT);
 
 	/* Step 3: Wait for PLL lock */
-	ret = regmap_read_poll_timeout(pll->common.regmap,
-				       pll->config.reg_offset, val,
-				       val & PLL_CFG_LOCK_BIT,
-				       PLL_BYPASS_WAIT_US, PLL_LOCK_TIMEOUT_US);
+	ret = regmap_read_poll_timeout_atomic(pll->common.regmap,
+					      pll->config.reg_offset, val,
+					      val & PLL_CFG_LOCK_BIT,
+					      PLL_BYPASS_WAIT_US,
+					      PLL_LOCK_TIMEOUT_US);
 	if (ret) {
 		pr_err("PLL failed to lock within timeout\n");
 		return ret;
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 09/10] clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (7 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable() Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  2026-11-23 16:47 ` [PATCH 10/10] clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF Lee Jones
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, Mike Looijmans,
	Michael Turquette, linux-clk, linux-kernel
  Cc: stable

cdce925_probe() allocates its clk_cdce925_chip state and registers its
clocks using devres, but registers its OF clock provider with the
unmanaged of_clk_add_hw_provider() and provides no remove callback.
When the I2C device is unbound or the module is unloaded, data is freed
while the provider remains on the global OF clock provider list, causing
of_clk_cdce925_get() to dereference freed memory on subsequent lookups.

Register the provider with devm_of_clk_add_hw_provider() so it is
automatically removed before the clocks and driver state are released.

Fixes: 19fbbbbcd3a3 ("Add TI CDCE925 I2C controlled clock synthesizer driver")
Closes: https://sashiko.dev/#/bug/linux-30a4148f-b048-49b1-a21a-4665f03e4cf8
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-cdce925.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c
index 52d350f91496..6dfba3158d8e 100644
--- a/drivers/clk/clk-cdce925.c
+++ b/drivers/clk/clk-cdce925.c
@@ -795,8 +795,8 @@ static int cdce925_probe(struct i2c_client *client)
 	}
 
 	/* Register the output clocks */
-	err = of_clk_add_hw_provider(client->dev.of_node, of_clk_cdce925_get,
-				  data);
+	err = devm_of_clk_add_hw_provider(&client->dev, of_clk_cdce925_get,
+					  data);
 	if (err)
 		dev_err(&client->dev, "unable to add OF clock provider\n");
 
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 10/10] clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF
  2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
                   ` (8 preceding siblings ...)
  2026-11-23 16:47 ` [PATCH 09/10] clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind Lee Jones
@ 2026-11-23 16:47 ` Lee Jones
  9 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2026-11-23 16:47 UTC (permalink / raw)
  To: lee, Stephen Boyd, Brian Masney, Jerome Brunet, Lubomir Rintel,
	linux-clk, linux-kernel
  Cc: stable

mmp2_audio_clk_probe() allocates priv via devres and registers all
clocks with devm_clk_hw_register(), but register_clocks() registers the
OF clock provider using the unmanaged of_clk_add_hw_provider() while
mmp2_audio_clk_remove() never deletes the provider.  Unbinding the
driver frees priv while leaving a dangling clk_data pointer on the
global OF clock provider list.

Use devm_of_clk_add_hw_provider() so the provider is automatically
removed on teardown before the clocks and private data are freed.

Fixes: 725262d29139 ("clk: mmp2: Add audio clock controller driver")
Closes: https://sashiko.dev/#/bug/linux-c4f4539f-43f7-43ff-938f-01a855925960
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/mmp/clk-audio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mmp/clk-audio.c b/drivers/clk/mmp/clk-audio.c
index 19233684fbf9..9ef5cca1e1f3 100644
--- a/drivers/clk/mmp/clk-audio.c
+++ b/drivers/clk/mmp/clk-audio.c
@@ -342,8 +342,8 @@ static int register_clocks(struct mmp2_audio_clk *priv, struct device *dev)
 	priv->clk_data.hws[MMP2_CLK_AUDIO_SSPA1] = &priv->sspa1_gate.hw;
 	priv->clk_data.num = CLK_AUDIO_NR_CLKS;
 
-	return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
-				      &priv->clk_data);
+	return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
+					   &priv->clk_data);
 }
 
 static int mmp2_audio_clk_probe(struct platform_device *pdev)
-- 
2.56.1.750.gf70dc682cf-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest()
  2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() Lee Jones
@ 2026-11-23 17:13   ` sashiko-bot
  0 siblings, 0 replies; 14+ messages in thread
From: sashiko-bot @ 2026-11-23 17:13 UTC (permalink / raw)
  To: Lee Jones, linux-clk

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] clk: divider: 64-bit addition overflow in _div_round() and
  divider_get_val() [1]
--

commit 794cea87b2763d8416c120885c5c264136bf9dfd
Author: Lee Jones <lee@kernel.org>

clk: divider: Avoid division by zero in _div_round_closest()

This commit returns the minimum valid divisor from _div_round_closest()
when the requested rate is greater than or equal to parent_rate, avoiding
a zero divisor and subsequent division by zero.

> diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> index f68216c65d3df..d05dc595ec4c7 100644
> --- a/drivers/clk/clk-divider.c
> +++ b/drivers/clk/clk-divider.c
> @@ -244,6 +244,9 @@ static int _div_round_closest(const struct clk_div_table *table,
>  	int up, down;
>  	unsigned long up_rate, down_rate;
>  
> +	if (rate >= parent_rate)
> +		return table ? _round_up_table(table, 1) : 1;
> +
>  	up = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
>  	down = parent_rate / rate;

[Severity: High]
This problem wasn't introduced by this patch, but can DIV_ROUND_UP_ULL()
still overflow 64-bit addition in _div_round_up() and divider_get_val()
[1]?

drivers/clk/clk-divider.c:_div_round_up() {
	int div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);

	if (flags & CLK_DIVIDER_POWER_OF_TWO)
		div = __roundup_pow_of_two(div);
	...
}

On 64-bit platforms, when rate > U64_MAX - parent_rate + 1 (for example,
via clk_round_rate(clk, ULONG_MAX) or when clk_divider_bestdiv() clamps an
overflowing target_parent_rate to ULONG_MAX), (u64)parent_rate + rate - 1
wraps around and DIV_ROUND_UP_ULL() evaluates to 0 instead of 1.  That
passes 0 to __roundup_pow_of_two() when CLK_DIVIDER_POWER_OF_TWO is set
(triggering an undefined shift) or underflows div - 1 in _get_val() when
called from divider_get_val().

[1] https://sashiko.dev/#/bug/linux-4e20dfb7-a4d5-4b44-bb0d-e7b8ced3408c

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123164834.3330320-1-lee@kernel.org?part=5

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks
  2026-11-23 16:47 ` [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
@ 2026-11-23 17:25   ` Frank Li
  0 siblings, 0 replies; 14+ messages in thread
From: Frank Li @ 2026-11-23 17:25 UTC (permalink / raw)
  To: Lee Jones
  Cc: Abel Vesa, Peng Fan, Stephen Boyd, Brian Masney, Jerome Brunet,
	Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Pengpeng Hou, Dong Aisheng, Shawn Guo, linux-clk, imx,
	linux-arm-kernel, linux-kernel, stable

On Mon, Nov 23, 2026 at 04:47:34PM +0000, Lee Jones wrote:
> imx_lpcg_parse_clks_from_dt() allocates output_names, parent_names, and
> bit_offset on the stack with IMX_LPCG_MAX_CLKS (8) entries each to match
> the hardware limit of eight clock outputs per LPCG block.  However, it
> only checks whether of_property_count_u32_elems() returns a negative
> error code and enforces no upper bound on count.
>
> If a Device Tree node specifies more than IMX_LPCG_MAX_CLKS entries in
> clock-indices, subsequent calls to of_property_read_u32_array(),
> of_clk_parent_fill(), and of_property_read_string_array() write past the
> end of these stack buffers.  Reject counts exceeding IMX_LPCG_MAX_CLKS.
>
> Fixes: d5f1e6a2bb61 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree")
> Closes: https://sashiko.dev/#/bug/linux-22dfac78-f44b-42f8-985a-995308723fc4
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> index 9ad016106b1e..5eb4bdbaf7d8 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -199,6 +199,10 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,
>  		dev_err(&pdev->dev, "failed to count clocks\n");
>  		return -EINVAL;
>  	}
> +	if (count > IMX_LPCG_MAX_CLKS) {
> +		dev_err(&pdev->dev, "too many clocks: %d\n", count);
> +		return -EINVAL;
> +	}
>
>  	/*
>  	 * A trick here is that we set the num of clks to the MAX instead
> --
> 2.56.1.750.gf70dc682cf-goog
>
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels
  2026-11-23 16:47 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
@ 2026-11-23 17:26   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-23 17:26 UTC (permalink / raw)
  To: Lee Jones, Sylwester Nawrocki, Chanwoo Choi, Peter Griffin,
	Alim Akhtar, Stephen Boyd, Brian Masney, Jerome Brunet,
	Thomas Abraham, Chander Kashyap, Amit Daniel Kachhap, Tomasz Figa,
	Lukasz Luba, Marian Mihailescu, linux-samsung-soc, linux-clk,
	linux-arm-kernel, linux-kernel
  Cc: stable

On 23/11/2026 17:47, Lee Jones wrote:
> _samsung_clk_register_pll() sizes each PLL rate table by scanning until
> it encounters an entry with .rate == 0, then copies the counted entries
> into pll->rate_table.  However, exynos5420_pll2550x_24mhz_tbl,
> exynos5422_bpll_rate_table, exynos5420_epll_24mhz_tbl, and
> exynos5420_vpll_24mhz_tbl all omit a terminating zero sentinel, causing
> out-of-bounds reads into adjacent read-only data and populating
> pll->rate_table with bogus entries.
> 
> Append a sentinel entry to each of the four PLL rate tables.
> 
> Fixes: ca5b40293822 ("clk: samsung: register exynos5420 apll/kpll configuration data")
> Fixes: 9842452acd3d ("clk: samsung: exynos542x: Add EPLL rate table")
> Fixes: 8b4a7acf7b30 ("clk: samsung: add BPLL rate table for Exynos 5422 SoC")
> Fixes: b92981de92cb ("clk: samsung: exynos5420: Add VPLL rate table")
> Closes: https://sashiko.dev/#/bug/linux-553831f9-0a7b-4e94-be60-222de60ca8c3

Also drivers/clk/samsung/clk-artpec8.c, artpec9, exynos5410,
clk-exynos7885.c and probably others?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-23 17:26 UTC | newest]

Thread overview: 14+ 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 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
2026-11-23 17:25   ` Frank Li
2026-11-23 16:47 ` [PATCH 02/10] clk: lmk04832: Validate child reg index in lmk04832_probe() Lee Jones
2026-11-23 16:47 ` [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS Lee Jones
2026-11-23 16:47 ` [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate() Lee Jones
2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() Lee Jones
2026-11-23 17:13   ` sashiko-bot
2026-11-23 16:47 ` [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents Lee Jones
2026-11-23 16:47 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
2026-11-23 17:26   ` Krzysztof Kozlowski
2026-11-23 16:47 ` [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable() Lee Jones
2026-11-23 16:47 ` [PATCH 09/10] clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind Lee Jones
2026-11-23 16:47 ` [PATCH 10/10] clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox