summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_softjobs.c
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2022-01-19 09:20:00 -0800
committerAnkit Goyal <layog@google.com>2022-01-19 09:21:39 -0800
commit5f4f61f8a249880c9ab5a1475daf342353c1f91a (patch)
treeea75ea381815ad945e86c3b5f8f510e76245009a /mali_kbase/mali_kbase_softjobs.c
parent5381ff7b4106b277ff207396e293ede2bf959f0c (diff)
parent0207d6c3b7a2002f15c60d08617e956faf5ba90c (diff)
downloadgpu-5f4f61f8a249880c9ab5a1475daf342353c1f91a.tar.gz
Merge remote-tracking branch 'partner/upstream' into r35-merge
Bug: 213455888 Signed-off-by: Ankit Goyal <layog@google.com> Change-Id: Id9ef73da49680e2935a827c40d54169545f7162e
Diffstat (limited to 'mali_kbase/mali_kbase_softjobs.c')
-rw-r--r--mali_kbase/mali_kbase_softjobs.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/mali_kbase/mali_kbase_softjobs.c b/mali_kbase/mali_kbase_softjobs.c
index 77532ac..5f74247 100644
--- a/mali_kbase/mali_kbase_softjobs.c
+++ b/mali_kbase/mali_kbase_softjobs.c
@@ -97,7 +97,8 @@ static int kbasep_read_soft_event_status(
unsigned char *mapped_evt;
struct kbase_vmap_struct map;
- mapped_evt = kbase_vmap(kctx, evt, sizeof(*mapped_evt), &map);
+ mapped_evt = kbase_vmap_prot(kctx, evt, sizeof(*mapped_evt),
+ KBASE_REG_CPU_RD, &map);
if (!mapped_evt)
return -EFAULT;
@@ -118,7 +119,8 @@ static int kbasep_write_soft_event_status(
(new_status != BASE_JD_SOFT_EVENT_RESET))
return -EINVAL;
- mapped_evt = kbase_vmap(kctx, evt, sizeof(*mapped_evt), &map);
+ mapped_evt = kbase_vmap_prot(kctx, evt, sizeof(*mapped_evt),
+ KBASE_REG_CPU_WR, &map);
if (!mapped_evt)
return -EFAULT;
@@ -1205,8 +1207,8 @@ static int kbase_jit_allocate_process(struct kbase_jd_atom *katom)
* Write the address of the JIT allocation to the user provided
* GPU allocation.
*/
- ptr = kbase_vmap(kctx, info->gpu_alloc_addr, sizeof(*ptr),
- &mapping);
+ ptr = kbase_vmap_prot(kctx, info->gpu_alloc_addr, sizeof(*ptr),
+ KBASE_REG_CPU_WR, &mapping);
if (!ptr) {
/*
* Leave the allocations "live" as the JIT free atom
@@ -1659,8 +1661,12 @@ int kbase_prepare_soft_job(struct kbase_jd_atom *katom)
if (copy_to_user((__user void *)(uintptr_t)katom->jc,
&fence, sizeof(fence)) != 0) {
kbase_sync_fence_out_remove(katom);
- put_unused_fd(fd);
- fput(sync_file->file);
+ /* fd should have been closed here, but there's
+ * no good way of doing that. Since
+ * copy_to_user() very rarely fails, and the fd
+ * will get closed on process termination this
+ * won't be a problem.
+ */
fence.basep.fd = -EINVAL;
return -EINVAL;
}