From: Jie Zhan <zhanjie9@hisilicon.com>
To: Pengjie Zhang <zhangpengjie2@huawei.com>,
<myungjoo.ham@samsung.com>, <kyungmin.park@samsung.com>,
<cw00.choi@samsung.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<zhenglifeng1@huawei.com>, <lihuisong@huawei.com>,
<yubowen8@huawei.com>, <linhongye@h-partners.com>,
<linuxarm@huawei.com>, <jonathan.cameron@huawei.com>
Subject: Re: [PATCH] PM / devfreq: hisi: Fix potential UAF in OPP handling
Date: Tue, 16 Sep 2025 09:10:22 +0800 [thread overview]
Message-ID: <bdc702db-a898-4b92-bc5f-db802fe235b5@hisilicon.com> (raw)
In-Reply-To: <20250915062135.748653-1-zhangpengjie2@huawei.com>
On 9/15/2025 2:21 PM, Pengjie Zhang wrote:
> Ensure all required data is acquired before calling dev_pm_opp_put(opp)
> to maintain correct resource acquisition and release order.
>
> Fixes: 7da2fdaaa1e6 ("PM / devfreq: Add HiSilicon uncore frequency scaling driver")
> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
> ---
> drivers/devfreq/hisi_uncore_freq.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Hi Pengjie,
Yeah dev_pm_opp_put() should be after dev_pm_opp_get_freq().
Thanks for spotting this.
Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
>
> diff --git a/drivers/devfreq/hisi_uncore_freq.c b/drivers/devfreq/hisi_uncore_freq.c
> index 96d1815059e3..c1ed70fa0a40 100644
> --- a/drivers/devfreq/hisi_uncore_freq.c
> +++ b/drivers/devfreq/hisi_uncore_freq.c
> @@ -265,10 +265,11 @@ static int hisi_uncore_target(struct device *dev, unsigned long *freq,
> dev_err(dev, "Failed to get opp for freq %lu hz\n", *freq);
> return PTR_ERR(opp);
> }
> - dev_pm_opp_put(opp);
>
> data = (u32)(dev_pm_opp_get_freq(opp) / HZ_PER_MHZ);
>
> + dev_pm_opp_put(opp);
> +
> return hisi_uncore_cmd_send(uncore, HUCF_PCC_CMD_SET_FREQ, &data);
> }
>
next prev parent reply other threads:[~2025-09-16 1:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 6:21 [PATCH] PM / devfreq: hisi: Fix potential UAF in OPP handling Pengjie Zhang
2025-09-16 1:10 ` Jie Zhan [this message]
2025-10-27 2:28 ` zhangpengjie (A)
2025-10-28 13:47 ` MyungJoo Ham
2025-11-20 1:30 ` zhangpengjie (A)
2025-11-20 5:43 ` Chanwoo Choi
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=bdc702db-a898-4b92-bc5f-db802fe235b5@hisilicon.com \
--to=zhanjie9@hisilicon.com \
--cc=cw00.choi@samsung.com \
--cc=jonathan.cameron@huawei.com \
--cc=kyungmin.park@samsung.com \
--cc=lihuisong@huawei.com \
--cc=linhongye@h-partners.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=myungjoo.ham@samsung.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@huawei.com \
--cc=zhenglifeng1@huawei.com \
/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