Skip to content

Commit 26dd44a

Browse files
Pengjie Zhangchanwoochoi
authored andcommitted
PM / devfreq: hisi: Fix potential UAF in OPP handling
Ensure all required data is acquired before calling dev_pm_opp_put(opp) to maintain correct resource acquisition and release order. Fixes: 7da2fda ("PM / devfreq: Add HiSilicon uncore frequency scaling driver") Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com> Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://patchwork.kernel.org/project/linux-pm/patch/20250915062135.748653-1-zhangpengjie2@huawei.com/
1 parent 447c4e8 commit 26dd44a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/devfreq/hisi_uncore_freq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,11 @@ static int hisi_uncore_target(struct device *dev, unsigned long *freq,
264264
dev_err(dev, "Failed to get opp for freq %lu hz\n", *freq);
265265
return PTR_ERR(opp);
266266
}
267-
dev_pm_opp_put(opp);
268267

269268
data = (u32)(dev_pm_opp_get_freq(opp) / HZ_PER_MHZ);
270269

270+
dev_pm_opp_put(opp);
271+
271272
return hisi_uncore_cmd_send(uncore, HUCF_PCC_CMD_SET_FREQ, &data);
272273
}
273274

0 commit comments

Comments
 (0)