aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch
new file mode 100644
index 00000000..e862d490
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3351-drm-amdgpu-add-check-to-avoid-array-bound-issue.patch
@@ -0,0 +1,33 @@
+From b4b46de5417802601c423c7ba7e22ae60e432c88 Mon Sep 17 00:00:00 2001
+From: Guchun Chen <guchun.chen@amd.com>
+Date: Thu, 8 Aug 2019 14:54:41 +0800
+Subject: [PATCH 3351/4256] drm/amdgpu: add check to avoid array bound issue
+
+Sub_block_index can be passed from user level, so
+add one check before accessing the array first to
+prevent array index out of bound problem.
+
+Change-Id: I556fc560b44215848ba3a95f757febdf3d0af422
+Signed-off-by: Guchun Chen <guchun.chen@amd.com>
+Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+index 56faabc8fb13..c25002329728 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+@@ -5984,6 +5984,9 @@ static int gfx_v9_0_ras_error_inject(struct amdgpu_device *adev,
+ if (adev->asic_type != CHIP_VEGA20)
+ return -EINVAL;
+
++ if (info->head.sub_block_index >= ARRAY_SIZE(ras_gfx_subblocks))
++ return -EINVAL;
++
+ if (!ras_gfx_subblocks[info->head.sub_block_index].name)
+ return -EPERM;
+
+--
+2.17.1
+