diff options
Diffstat (limited to 'common/recipes-kernel/linux/files/0298-drm-amdgpu-validate-the-context-id-in-the-dependenci.patch')
-rw-r--r-- | common/recipes-kernel/linux/files/0298-drm-amdgpu-validate-the-context-id-in-the-dependenci.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0298-drm-amdgpu-validate-the-context-id-in-the-dependenci.patch b/common/recipes-kernel/linux/files/0298-drm-amdgpu-validate-the-context-id-in-the-dependenci.patch new file mode 100644 index 00000000..16795fbc --- /dev/null +++ b/common/recipes-kernel/linux/files/0298-drm-amdgpu-validate-the-context-id-in-the-dependenci.patch @@ -0,0 +1,64 @@ +From 76a1ea618f01b2bf5a325832d1c273c039c4ea81 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> +Date: Mon, 6 Jul 2015 19:42:10 +0200 +Subject: [PATCH 0298/1050] drm/amdgpu: validate the context id in the + dependencies +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Just to make sure userspace don't send nonsense to the kernel. + +Signed-off-by: Christian König <christian.koenig@amd.com> +Reviewed-by: Alex Deucher <alexander.deucher@amd.com> +Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +index d63135b..469b6f2 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +@@ -669,6 +669,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, + static int amdgpu_cs_dependencies(struct amdgpu_device *adev, + struct amdgpu_cs_parser *p) + { ++ struct amdgpu_fpriv *fpriv = p->filp->driver_priv; + struct amdgpu_ib *ib; + int i, j, r; + +@@ -694,6 +695,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, + for (j = 0; j < num_deps; ++j) { + struct amdgpu_fence *fence; + struct amdgpu_ring *ring; ++ struct amdgpu_ctx *ctx; + + r = amdgpu_cs_get_ring(adev, deps[j].ip_type, + deps[j].ip_instance, +@@ -701,14 +703,21 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev, + if (r) + return r; + ++ ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id); ++ if (ctx == NULL) ++ return -EINVAL; ++ + r = amdgpu_fence_recreate(ring, p->filp, + deps[j].handle, + &fence); +- if (r) ++ if (r) { ++ amdgpu_ctx_put(ctx); + return r; ++ } + + amdgpu_sync_fence(&ib->sync, fence); + amdgpu_fence_unref(&fence); ++ amdgpu_ctx_put(ctx); + } + } + +-- +1.9.1 + |