mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
accel: ethosu: Ensure SRAM region size matches job
It is possible for userspace to set the job SRAM size to 0, but then still
have SRAM accesses in the command stream. When the job SRAM size is 0,
setting the region base register is skipped and a stale base address from
a prior job is used.
Check the region size against the job's SRAM size instead of just the size
of the SRAM. The job's SRAM size was already checked against the total SRAM
size.
Fixes: 9cff907748 ("accel: ethosu: Validate SRAM size on submit")
Cc: stable@vger.kernel.org
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260827-ethosu-fixes-v1-5-346f9ea8791c@kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
parent
f5376d7e0f
commit
2b39d680c9
|
|
@ -447,13 +447,13 @@ static int ethosu_ioctl_submit_job(struct drm_device *dev, struct drm_file *file
|
|||
if (!cmd_info->region_size[i])
|
||||
continue;
|
||||
if (i == ETHOSU_SRAM_REGION) {
|
||||
if (cmd_info->region_size[i] <= edev->npu_info.sram_size)
|
||||
if (cmd_info->region_size[i] <= ejob->sram_size)
|
||||
continue;
|
||||
|
||||
dev_err(dev->dev,
|
||||
"cmd stream region %d size greater than SRAM size (%llu > %u)\n",
|
||||
"cmd stream region %d size greater than job SRAM size (%llu > %u)\n",
|
||||
i, cmd_info->region_size[i],
|
||||
edev->npu_info.sram_size);
|
||||
ejob->sram_size);
|
||||
ret = -EINVAL;
|
||||
goto out_cleanup_job;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user