From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Peter Griffin <peter.griffin@linaro.org>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>,
Sebastian Reichel <sre@kernel.org>,
Praveen Talari <praveen.talari@oss.qualcomm.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
andre.draszik@linaro.org, alim.akhtar@samsung.com,
krzk@kernel.org, kernel-team@android.com, jyescas@google.com
Subject: Re: [PATCH] opp: fix use after free in _update_opp_table_clk()
Date: Tue, 8 Sep 2026 16:41:25 +0300 [thread overview]
Message-ID: <dd704898-c51d-46e4-bef2-28d863cdee22@linaro.org> (raw)
In-Reply-To: <20260908-opp-core-uaf-update-opp-table-v1-1-93d3fc928c5c@linaro.org>
On 9/8/26 3:37 PM, Peter Griffin wrote:
> dev_pm_opp_put_opp_table() frees the opp_table which is subsquently used
> by dev_err_probe(). This causes an Oops during boot on gs101-oriole.
>
> cpu cpu0: error 000000006b6b6b6b: Couldn't find clock
> Unable to handle kernel paging request at virtual address 006b6b6b6b6b6cd3
> ...
> Hardware name: Oriole (DT)
> pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : _of_add_table_indexed+0x80/0xbb0
> lr : _of_add_table_indexed+0x6c/0xbb0
> ...
> Call trace:
> _of_add_table_indexed+0x80/0xbb0 (P)
> dev_pm_opp_of_cpumask_add_table+0x70/0x120
> dt_cpufreq_probe+0x23c/0x480
> platform_probe+0x64/0xb8
>
> Fixes: 84f05af0975c9 ("opp: Use clk_get_optional() to avoid leaving opp_table->clk as an error pointer")
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> This UAF regression was introduced in v7.3-rc1, and causes an Oops on
> boot for gs101-oriole (in part due to our default upstream kernel dev
> config having memory poisoning enabled, hence the 0x6b6b6b6b
> pattern). It is intended that this patch should get picked for the
> next -rc.
>
> Peter
> ---
> ---
> drivers/opp/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 2fafd983de8f5..c8b941cb81b44 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1581,6 +1581,7 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
> struct opp_table *opp_table,
> bool getclk)
> {
> + int ret;
> /*
> * Return early if we don't need to get clk or we have already done it
> * earlier.
> @@ -1607,9 +1608,10 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
> opp_table->clk = clk_get_optional(dev, NULL);
>
> if (IS_ERR(opp_table->clk)) {
> - dev_pm_opp_put_opp_table(opp_table);
> dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n");
you can do ret = dev_err_probe(dev, PTR_ERR(opp_table->clk), "Couldn't find clock\n");
> - return ERR_CAST(opp_table->clk);
> + ret = PTR_ERR(opp_table->clk);
and you won't need this duplicated line.
with this addressed:
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> + dev_pm_opp_put_opp_table(opp_table);
> + return ERR_PTR(ret);
> }
>
> if (opp_table->clk)
>
> ---
> base-commit: df2908090cda368b01ff43709f51890076c56157
> change-id: 20260908-opp-core-uaf-update-opp-table-0d9ea3741231
>
> Best regards,
next prev parent reply other threads:[~2026-09-08 13:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:37 Peter Griffin
2026-09-08 13:41 ` Tudor Ambarus [this message]
2026-09-09 5:15 ` Viresh Kumar
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=dd704898-c51d-46e4-bef2-28d863cdee22@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=jyescas@google.com \
--cc=kernel-team@android.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=peter.griffin@linaro.org \
--cc=praveen.talari@oss.qualcomm.com \
--cc=sboyd@kernel.org \
--cc=sre@kernel.org \
--cc=vireshk@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®