From 4f01d6a9b9a54cf6042db157de0d40965077f6a2 Mon Sep 17 00:00:00 2001 From: Preetham Chandru R Date: Mon, 10 Sep 2018 23:13:29 +0530 Subject: gpu: nvgpu: deny any request less than engine timeout Bug 2343124 JIRA NVGPU-1065 Change-Id: I43a436673117af8ac2490d075cea07532f01af0b Signed-off-by: Preetham Chandru R Reviewed-on: https://git-master.nvidia.com/r/1818164 Reviewed-by: svc-misra-checker Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/ioctl_channel.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/gpu/nvgpu/os') diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_channel.c b/drivers/gpu/nvgpu/os/linux/ioctl_channel.c index e9a24923..b48cfa99 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_channel.c @@ -1227,6 +1227,11 @@ long gk20a_channel_ioctl(struct file *filp, (u32)((struct nvgpu_set_timeout_args *)buf)->timeout; nvgpu_log(g, gpu_dbg_gpu_dbg, "setting timeout (%d ms) for chid %d", timeout, ch->chid); + if (timeout < g->fifo_eng_timeout_us / 1000) { + dump_stack(); + err = -EINVAL; + break; + } ch->timeout_ms_max = timeout; gk20a_channel_trace_sched_param( trace_gk20a_channel_set_timeout, ch); @@ -1241,6 +1246,11 @@ long gk20a_channel_ioctl(struct file *filp, (1 << NVGPU_TIMEOUT_FLAG_DISABLE_DUMP)); nvgpu_log(g, gpu_dbg_gpu_dbg, "setting timeout (%d ms) for chid %d", timeout, ch->chid); + if (timeout < g->fifo_eng_timeout_us / 1000) { + dump_stack(); + err = -EINVAL; + break; + } ch->timeout_ms_max = timeout; ch->timeout_debug_dump = timeout_debug_dump; gk20a_channel_trace_sched_param( -- cgit v1.2.2