On Thu, Aug 27, 2026 at 03:33:04PM -0500, Rob Herring (Arm) wrote:
> 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: 9cff90774872 ("accel: ethosu: Validate SRAM size on submit")
> Cc: [email protected]
> Signed-off-by: Rob Herring (Arm) <[email protected]>
> ---Reviewed-by: Frank Li <[email protected]> > drivers/accel/ethosu/ethosu_job.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/accel/ethosu/ethosu_job.c > b/drivers/accel/ethosu/ethosu_job.c > index c33f2877b385..0982722a9195 100644 > --- a/drivers/accel/ethosu/ethosu_job.c > +++ b/drivers/accel/ethosu/ethosu_job.c > @@ -441,13 +441,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; > } > > -- > 2.53.0 >
