aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1223-drm-amdkfd-Handle-failure-instaed-of-BUG_ON.patch
blob: fd0e672218eb50b84acf1b8a603a31c7cbec359b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 965ae2d105b91f81b111310486f028400dab36ff Mon Sep 17 00:00:00 2001
From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Date: Wed, 1 Feb 2017 11:32:01 -0500
Subject: [PATCH 1223/4131] drm/amdkfd: Handle failure instaed of BUG_ON

If the range spans more than one BO, then return NULL. This way kernel
will not hang because of a user-mode bug.

Change-Id: Ib497d37572cc1dd9b17351db3e78b92e9dc16c2d
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 10bddc9..1aa7ee3 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -877,13 +877,16 @@ void *kfd_process_find_bo_from_interval(struct kfd_process *p,
 	it_node = interval_tree_iter_first(&p->bo_interval_tree,
 			start_addr, last_addr);
 	if (!it_node) {
-		pr_err("%llu - %llu does not relate to an existing buffer\n",
+		pr_err("0x%llx-0x%llx does not relate to an existing buffer\n",
 				start_addr, last_addr);
 		return NULL;
 	}
 
-	BUG_ON(NULL != interval_tree_iter_next(it_node,
-			start_addr, last_addr));
+	if (interval_tree_iter_next(it_node, start_addr, last_addr) != NULL) {
+		pr_err("0x%llx-0x%llx spans more than a single BO\n",
+				start_addr, last_addr);
+		return NULL;
+	}
 
 	buf_obj = container_of(it_node, struct kfd_bo, it);
 
-- 
2.7.4