summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2017-10-24 07:52:55 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-25 07:24:08 -0400
commit41496b359d858e1c28840eaee2e2e6bba485c642 (patch)
treeee08d566273e7f4f4435289ddae8b86906e0c0da
parentc61e21c868246faf7a9ffc812590941fc362af17 (diff)
gpu: nvgpu: check gpfifo before submit work
User can call submit IOCTL before alloc_gpfifo IOCTL and can easily cause a kernel panic. The fix checks for a valid gpfifo.mem before proceeding with the submitted work. Bug 1968309 Change-Id: I5c1fc6f52b25426cd45e58e8b2e0e5bc6aa0c32f Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1584519 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 590506d6..0d011b06 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -2547,6 +2547,9 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
2547 if (c->has_timedout) 2547 if (c->has_timedout)
2548 return -ETIMEDOUT; 2548 return -ETIMEDOUT;
2549 2549
2550 if (!nvgpu_mem_is_valid(&c->gpfifo.mem))
2551 return -ENOMEM;
2552
2550 /* fifo not large enough for request. Return error immediately. 2553 /* fifo not large enough for request. Return error immediately.
2551 * Kernel can insert gpfifo entries before and after user gpfifos. 2554 * Kernel can insert gpfifo entries before and after user gpfifos.
2552 * So, add extra_entries in user request. Also, HW with fifo size N 2555 * So, add extra_entries in user request. Also, HW with fifo size N