From: Jerome Brunet <jbrunet@baylibre.com>
To: Joshua Covington <joshuacov@gmail.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <masneyb@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Andrea della Porta <andrea.porta@suse.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 1/3] clk: allow a clk_hw to be registered again after unregistering it
Date: Thu, 03 Dec 2026 17:36:41 +0100 [thread overview]
Message-ID: <179631580115.3767986.8710364303949635390.b4-reply@b4> (raw)
In-Reply-To: <20261203151954.139565-1-joshuacov@gmail.com>
On 2026-12-03 15:19 +0000, Joshua Covington wrote:
> Hi Jerome,
>
> Thanks for the review.
>
> On Thu, Dec 03, 2026 at 11:26:39AM +0100, Jerome Brunet wrote:
> > IMO, the short term solution to the problem explained in this series is to
> > stop poisoning the init data in clk_hw. The framework did not allocate the
> > data, arguably it should not be wrecking it on purpose or otherwise touch it.
> > Just leave it be.
> >
> > We should however put clear comment/warning that provider driver should NOT
> > be using that or count on it being valid.
>
> That works for me, and it will remove the new clk_core member and the
> object_is_on_stack() check. So far I have tried it on top of v3, with
> __clk_register() no longer clearing hw->init. The tests for registering
> again after unregistration and after a failed registration pass. In v4
> I will also add to the clk_hw kernel-doc that providers must not use
> @init after registration, as it may point to init data that is gone.
>
> The other half of the patch still needs to stay, though. clk_unregister()
> leaves hw->core and hw->clk pointing to the clk_core and clk it
> releases. Without clearing them, a clk_parent_data.hw reference to an
> unregistered clk_hw resolves to the freed clk_core, and KASAN reports a
> slab-use-after-free in __clk_register() in the parent test. That part
> costs no memory, so I would keep it.
I'm not too the sure the WARN() condition is needed though.
It is very late for such a consistency check and what it is checking should
be guaranteed by the registration code, no ? Can't we just skip the check ?
--
Jerome
next prev parent reply other threads:[~2026-12-03 16:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 23:17 [PATCH v3 0/3] " Joshua Covington
2026-11-24 23:17 ` [PATCH v3 1/3] " Joshua Covington
2026-12-03 10:26 ` Jerome Brunet
2026-12-03 15:19 ` Joshua Covington
2026-12-03 16:36 ` Jerome Brunet [this message]
2026-12-03 17:42 ` Joshua Covington
2026-12-04 0:48 ` Brian Masney
2026-11-24 23:17 ` [PATCH v3 2/3] clk: tests: add tests for registering a clk_hw again Joshua Covington
2026-11-24 23:17 ` [PATCH v3 3/3] clk: rp1: reset cached rates on probe Joshua Covington
2026-11-25 10:41 ` Andrea della Porta
2026-12-01 2:56 ` [PATCH v3 0/3] clk: allow a clk_hw to be registered again after unregistering it Brian Masney
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=179631580115.3767986.8710364303949635390.b4-reply@b4 \
--to=jbrunet@baylibre.com \
--cc=andrea.porta@suse.com \
--cc=bmasney+clk@redhat.com \
--cc=florian.fainelli@broadcom.com \
--cc=jbrunet+clk@baylibre.com \
--cc=joshuacov@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=masneyb@kernel.org \
--cc=s.nawrocki@samsung.com \
--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
all inboxes | Powered by JetHome®