summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_softjobs.c
diff options
context:
space:
mode:
authorSuzanne Candanedo <suzanne.candanedo@arm.com>2023-04-12 12:18:55 +0100
committerGuus Sliepen <gsliepen@google.com>2023-04-21 16:23:23 +0000
commitf284834befcee9a9e4031de3604fe7e16759de14 (patch)
tree07e8c16553335e6a9b041e84f0a352b7c7f301b8 /mali_kbase/mali_kbase_softjobs.c
parentb2006a9bbee737e9e6c0277deb670f63f2b90a2a (diff)
downloadgpu-f284834befcee9a9e4031de3604fe7e16759de14.tar.gz
[Official] MIDCET-4458, GPUCORE-36429: Prevent JIT allocations following unmap of tracking page
This commit introduces new checks to ensure that, like allocations of native memory, JIT memory allocations are blocked after the unmap of the tracking page. Bug: 275615867 Provenance: https://code.ipdelivery.arm.com/c/GPU/mali-ddk/+/5168/ Change-Id: I32460df4e8898784e75084193e038a912f67b33e (cherry picked from commit 240d4e9206528a43340c22aa69b124436f9a4e01)
Diffstat (limited to 'mali_kbase/mali_kbase_softjobs.c')
-rw-r--r--mali_kbase/mali_kbase_softjobs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mali_kbase/mali_kbase_softjobs.c b/mali_kbase/mali_kbase_softjobs.c
index f9de37f..ad9147c 100644
--- a/mali_kbase/mali_kbase_softjobs.c
+++ b/mali_kbase/mali_kbase_softjobs.c
@@ -974,6 +974,13 @@ static int kbase_jit_allocate_prepare(struct kbase_jd_atom *katom)
jit_info_copy_size_for_jit_version[kctx->jit_version];
WARN_ON(jit_info_user_copy_size > sizeof(*info));
+ if (!kbase_mem_allow_alloc(kctx)) {
+ dev_dbg(kbdev->dev, "Invalid attempt to allocate JIT memory by %s/%d for ctx %d_%d",
+ current->comm, current->pid, kctx->tgid, kctx->id);
+ ret = -EINVAL;
+ goto fail;
+ }
+
/* For backwards compatibility, and to prevent reading more than 1 jit
* info struct on jit version 1
*/