aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch
new file mode 100644
index 00000000..7b05c75f
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4704-drm-amdgpu-fix-UBSAN-Undefined-behaviour-for-amdgpu_.patch
@@ -0,0 +1,52 @@
+From f0c2ebbe64394bf2a0f409c3f1b7c2dd3563e4d0 Mon Sep 17 00:00:00 2001
+From: Leo Liu <leo.liu@amd.com>
+Date: Mon, 25 Jun 2018 14:56:06 -0400
+Subject: [PATCH 4704/5725] drm/amdgpu: fix UBSAN: Undefined behaviour for
+ amdgpu_fence.c
+
+Here is the UBSAN dump:
+
+[ 3.866656] index 2 is out of range for type 'amdgpu_uvd_inst [2]'
+[ 3.866693] Workqueue: events work_for_cpu_fn
+[ 3.866702] Call Trace:
+[ 3.866710] dump_stack+0x85/0xc5
+[ 3.866719] ubsan_epilogue+0x9/0x40
+[ 3.866727] __ubsan_handle_out_of_bounds+0x89/0x90
+[ 3.866737] ? rcu_read_lock_sched_held+0x58/0x60
+[ 3.866746] ? __kmalloc+0x26c/0x2d0
+[ 3.866846] amdgpu_fence_driver_start_ring+0x259/0x280 [amdgpu]
+[ 3.866896] amdgpu_ring_init+0x12c/0x710 [amdgpu]
+[ 3.866906] ? sprintf+0x42/0x50
+[ 3.866956] amdgpu_gfx_kiq_init_ring+0x1bc/0x3a0 [amdgpu]
+[ 3.867009] gfx_v8_0_sw_init+0x1ad3/0x2360 [amdgpu]
+[ 3.867062] ? smu7_init+0xec/0x160 [amdgpu]
+[ 3.867109] amdgpu_device_init+0x112c/0x1dc0 [amdgpu]
+
+'ring->me' might be set as 2 with 'amdgpu_gfx_kiq_init_ring', that would
+cause out of range for 'amdgpu_uvd_inst[2]'.
+
+v2: simplified with ring type
+
+Signed-off-by: Leo Liu <leo.liu@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+index bed6d77..1ec9590 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+@@ -376,7 +376,7 @@ int amdgpu_fence_driver_start_ring(struct amdgpu_ring *ring,
+ struct amdgpu_device *adev = ring->adev;
+ uint64_t index;
+
+- if (ring != &adev->uvd.inst[ring->me].ring) {
++ if (ring->funcs->type != AMDGPU_RING_TYPE_UVD) {
+ ring->fence_drv.cpu_addr = &adev->wb.wb[ring->fence_offs];
+ ring->fence_drv.gpu_addr = adev->wb.gpu_addr + (ring->fence_offs * 4);
+ } else {
+--
+2.7.4
+