diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/5155-drm-amdgpu-fix-integer-overflow-test-in-amdgpu_bo_li.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.14.71/5155-drm-amdgpu-fix-integer-overflow-test-in-amdgpu_bo_li.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/5155-drm-amdgpu-fix-integer-overflow-test-in-amdgpu_bo_li.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/5155-drm-amdgpu-fix-integer-overflow-test-in-amdgpu_bo_li.patch new file mode 100644 index 00000000..1228b712 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/5155-drm-amdgpu-fix-integer-overflow-test-in-amdgpu_bo_li.patch @@ -0,0 +1,38 @@ +From ad340cfac93205d30681cf83c9ebf7128767efb1 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter <dan.carpenter@oracle.com> +Date: Fri, 10 Aug 2018 18:50:32 +0800 +Subject: [PATCH 5155/5725] drm/amdgpu: fix integer overflow test in + amdgpu_bo_list_create() + +We accidentally left out the size of the amdgpu_bo_list struct. It +could lead to memory corruption on 32 bit systems. You'd have to +pick the absolute maximum and set "num_entries == 59652323" then size +would wrap to 16 bytes. + +Fixes: 920990cb080a ("drm/amdgpu: allocate the bo_list array after the list") +Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> +Reviewed-by: Huang Rui <ray.huang@amd.com> +Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org> +Signed-off-by: Huang Rui <ray.huang@amd.com> +Signed-off-by: Alex Deucher <alexander.deucher@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +index b603249..06fa232 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +@@ -67,7 +67,8 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, + unsigned i; + int r; + +- if (num_entries > SIZE_MAX / sizeof(struct amdgpu_bo_list_entry)) ++ if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list)) ++ / sizeof(struct amdgpu_bo_list_entry)) + return -EINVAL; + + size = sizeof(struct amdgpu_bo_list); +-- +2.7.4 + |