]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.15.5/drm-ttm-fix-buf-pointer-update-in-ttm_bo_vm_access_kmap-v2.patch
Linux 4.19.45
[thirdparty/kernel/stable-queue.git] / releases / 4.15.5 / drm-ttm-fix-buf-pointer-update-in-ttm_bo_vm_access_kmap-v2.patch
1 From 95244db2d3f743f37e69446a2807dd1a42750542 Mon Sep 17 00:00:00 2001
2 From: Tom St Denis <tom.stdenis@amd.com>
3 Date: Fri, 26 Jan 2018 09:32:29 -0500
4 Subject: drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2)
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 From: Tom St Denis <tom.stdenis@amd.com>
10
11 commit 95244db2d3f743f37e69446a2807dd1a42750542 upstream.
12
13 The buf pointer was not being incremented inside the loop
14 meaning the same block of data would be read or written
15 repeatedly.
16 (v2) Change 'buf' pointer to uint8_t* type
17
18 Cc: stable@vger.kernel.org
19 Fixes: 09ac4fcb3f25 ("drm/ttm: Implement vm_operations_struct.access v2")
20
21 Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
22 Reviewed-by: Christian König <christian.koenig@amd.com>
23 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/gpu/drm/ttm/ttm_bo_vm.c | 3 ++-
28 1 file changed, 2 insertions(+), 1 deletion(-)
29
30 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
31 +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
32 @@ -299,7 +299,7 @@ static void ttm_bo_vm_close(struct vm_ar
33
34 static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
35 unsigned long offset,
36 - void *buf, int len, int write)
37 + uint8_t *buf, int len, int write)
38 {
39 unsigned long page = offset >> PAGE_SHIFT;
40 unsigned long bytes_left = len;
41 @@ -328,6 +328,7 @@ static int ttm_bo_vm_access_kmap(struct
42 ttm_bo_kunmap(&map);
43
44 page++;
45 + buf += bytes;
46 bytes_left -= bytes;
47 offset = 0;
48 } while (bytes_left);