Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Akari Tsuyukusa" <akkun11.open@gmail.com>
Cc: "open list:MEDIATEK CLOCK DRIVERS" <linux-clk@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH linux-next 08/33] clk: mediatek: mt8516: Keep clock descriptors alive
Date: Sun, 29 Nov 2026 01:54:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-239249@kernel.org> (raw)
In-Reply-To: <20261129014745.3375923-9-akkun11.open@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] clk: mediatek: mt8516: section mismatch and UAF from
  __initconst parent arrays
--

commit beff2d41b331bb091c0366a72f390d0125ae8c68
Author: Akari Tsuyukusa <akkun11.open@gmail.com>

clk: mediatek: mt8516: Keep clock descriptors alive

This commit drops __initconst and __initdata from the MT8516 clock
descriptor arrays so they remain available when mtk_clk_simple_remove()
unregisters the clocks.

> diff --git a/drivers/clk/mediatek/clk-mt8516.c b/drivers/clk/mediatek/clk-mt8516.c
> index b646745598780..7933a0ad5140a 100644
> --- a/drivers/clk/mediatek/clk-mt8516.c
> +++ b/drivers/clk/mediatek/clk-mt8516.c
[ ... ]
> @@ -360,7 +360,7 @@ static const char * const nfiecc_parents[] __initconst = {
>  	"csw_nfiecc_sel"
>  };
>  
> -static struct mtk_composite top_muxes[] __initdata = {
> +static struct mtk_composite top_muxes[] = {
>  	/* CLK_MUX_SEL0 */
>  	MUX(CLK_TOP_UART0_SEL, "uart0_sel", uart0_parents,
>  		0x000, 0, 1),
> @@ -453,7 +453,7 @@ static const char * const ifr_i2c0_parents[] __initconst = {
>  	"rg_i2c"
>  };
>  
> -static const struct mtk_composite ifr_muxes[] __initconst = {
> +static const struct mtk_composite ifr_muxes[] = {
>  	MUX(CLK_IFR_MUX1_SEL, "ifr_mux1_sel", ifr_mux1_parents, 0x000,
>  		2, 2),
>  	MUX(CLK_IFR_ETH_25M_SEL, "ifr_eth_25m_sel", ifr_eth_25m_parents, 0x080,

[Severity: High]
Should __initconst also be dropped from the parent clock name arrays
referenced by top_muxes[] and ifr_muxes[] (and top_muxes[] marked const)?

Moving non-const top_muxes[] out of .init.data into .data while its MUX()
entries still point to __initconst parent arrays (uart0_parents[] through
nfiecc_parents[]) triggers modpost section mismatch warnings.  Also, both
top_muxes[] and ifr_muxes[] (pointing to ifr_mux1_parents[],
ifr_eth_25m_parents[], and ifr_i2c0_parents[]) will hold dangling
.parent_names pointers after init memory is freed, causing a
use-after-free in mtk_clk_register_composite() ->
clk_hw_register_composite() if the driver probes late or is rebound.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261129014745.3375923-1-akkun11.open@gmail.com?part=8

  reply	other threads:[~2026-11-29  1:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  1:47 [PATCH linux-next 00/33] clk: mediatek: Fix regressions and pre-existing bugs Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 01/33] clk: mediatek: Skip common MMIO mapping for PLL-only controllers Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 02/33] clk: mediatek: Fix NULL pointer dereference in pdev remove Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 03/33] clk: mediatek: Drop unused shared_io flag Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 04/33] clk: mediatek: Pass node to of_platform_populate() in common probe Akari Tsuyukusa
2026-11-29  1:58   ` sashiko-bot
2026-11-29  1:47 ` [PATCH linux-next 05/33] clk: mediatek: Fix MFG mux notifier use-after-free Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 06/33] clk: mediatek: mt2701: Keep CPU mux descriptors alive Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 07/33] clk: mediatek: mt8167: Keep muxes " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 08/33] clk: mediatek: mt8516: Keep clock " Akari Tsuyukusa
2026-11-29  1:54   ` sashiko-bot [this message]
2026-11-29  1:47 ` [PATCH linux-next 09/33] clk: mediatek: Reserve missing MT2701 audsys clock IDs Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 10/33] clk: mediatek: Fix MT2701 onecell IDs after common probe migration Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 11/33] clk: mediatek: Fix MT6779 " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 12/33] clk: mediatek: Fix MT6797 " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 13/33] clk: mediatek: Fix MT8135 " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 14/33] clk: mediatek: Fix MT8173 " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 15/33] dt-bindings: clock: mt2701: Drop unused _NR macros Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 16/33] dt-bindings: clock: mt2712: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 17/33] dt-bindings: clock: mt6765: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 18/33] dt-bindings: clock: mt6779: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 19/33] dt-bindings: clock: mt6795: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 20/33] dt-bindings: clock: mt6797: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 21/33] dt-bindings: clock: mt7622: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 22/33] dt-bindings: clock: mt7629: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 23/33] dt-bindings: clock: mt7988: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 24/33] dt-bindings: clock: mt8135: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 25/33] dt-bindings: clock: mt8167: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 26/33] dt-bindings: clock: mt8173: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 27/33] dt-bindings: clock: mt8183: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 28/33] dt-bindings: clock: mt8186: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 29/33] dt-bindings: clock: mt8188: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 30/33] dt-bindings: clock: mt8192: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 31/33] dt-bindings: clock: mt8195: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 32/33] dt-bindings: clock: mt8365: " Akari Tsuyukusa
2026-11-29  1:47 ` [PATCH linux-next 33/33] dt-bindings: clock: mt8516: " Akari Tsuyukusa

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=sashiko-outbox-239249@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akkun11.open@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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