aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorXixin Liu <liuxixin@kylinos.cn>2026-07-28 08:50:00 +0800
committerSudeep Holla <sudeep.holla@kernel.org>2026-09-01 11:44:59 +0100
commit32471d84a487c7fd74532bc96be56f8028cf4a3f (patch)
tree4d3fd9cf3da839d247968d86abc39e0a93c3b6c6
parentfirmware: arm_scpi: fix device_node leak in scpi_dev_domain_id (diff)
firmware: arm_scpi: reject DVFS OPP count above MAX_DVFS_OPPS
scpi_dvfs_get_info() already rejected a zero opp_count, but still trusted any larger value from the SCP firmware. The shared-memory reply only holds MAX_DVFS_OPPS entries in buf.opps[]; a bigger count over-reads that array and then sizes the allocated OPP table incorrectly (garbage OPPs / OOB). The missing upper bound dates back to the original SCPI DVFS support. Reject zero and out-of-range counts in one check and return -EINVAL. Fixes: 8cb7cf56c9fe ("firmware: add support for ARM System Control and Power Interface(SCPI) protocol") Signed-off-by: Xixin Liu <liuxixin@kylinos.cn> Link: https://patch.msgid.link/022802f0b38f.v2.1785200642.git.liuxixin@kylinos.cn Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
-rw-r--r--drivers/firmware/arm_scpi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index 43d6d9bbc7a9..68a730d22037 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -631,8 +631,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain)
if (ret)
return ERR_PTR(ret);
- if (!buf.opp_count)
- return ERR_PTR(-ENOENT);
+ if (!buf.opp_count || buf.opp_count > MAX_DVFS_OPPS)
+ return ERR_PTR(-EINVAL);
info = kmalloc_obj(*info);
if (!info)