From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
Heiko Stuebner <heiko@sntech.de>, Jyri Sarha <jsarha@ti.com>,
Sergej Sawazki <ce3a@gmx.de>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents
Date: Mon, 23 Nov 2026 16:47:39 +0000 [thread overview]
Message-ID: <20261123164834.3330320-7-lee@kernel.org> (raw)
In-Reply-To: <20261123164834.3330320-1-lee@kernel.org>
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
next prev parent reply other threads:[~2026-11-23 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` [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 16:47 ` Lee Jones [this message]
2026-11-23 16:47 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123164834.3330320-7-lee@kernel.org \
--to=lee@kernel.org \
--cc=bmasney+clk@redhat.com \
--cc=ce3a@gmx.de \
--cc=francesco.dolcini@toradex.com \
--cc=heiko@sntech.de \
--cc=jbrunet+clk@baylibre.com \
--cc=jsarha@ti.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox