aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch
new file mode 100644
index 00000000..7160056a
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3804-drm-amdgpu-Check-for-valid-number-of-registers-to-re.patch
@@ -0,0 +1,36 @@
+From 7a7cd1730ad34efcf3b041fa12b8f1c4e96b06cc Mon Sep 17 00:00:00 2001
+From: Trek <trek00@inbox.ru>
+Date: Sat, 31 Aug 2019 21:25:36 +0200
+Subject: [PATCH 3804/4256] drm/amdgpu: Check for valid number of registers to
+ read
+
+Do not try to allocate any amount of memory requested by the user.
+Instead limit it to 128 registers. Actually the longest series of
+consecutive allowed registers are 48, mmGB_TILE_MODE0-31 and
+mmGB_MACROTILE_MODE0-15 (0x2644-0x2673).
+
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=111273
+Signed-off-by: Trek <trek00@inbox.ru>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+index 9d4e71ee8791..9be4c182242f 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+@@ -694,6 +694,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
+ if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)
+ sh_num = 0xffffffff;
+
++ if (info->read_mmr_reg.count > 128)
++ return -EINVAL;
++
+ regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), GFP_KERNEL);
+ if (!regs)
+ return -ENOMEM;
+--
+2.17.1
+