aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1221-drm-amdkfd-Fix-potential-fence-leak.patch
blob: 0e4dd5201a92e513d7c93d01ac4787f9c4efa375 (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
42
43
From cca417f1ffbacdb9f741aa9f32d2012e907ccccb Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Thu, 22 Dec 2016 19:59:36 -0500
Subject: [PATCH 1221/4131] drm/amdkfd: Fix potential fence leak

Change-Id: Ic38cb450cb2a752335a6a6d7c86a1252ab65a75f
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 2fb12bc..4ed7420 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -860,7 +860,8 @@ int kgd2kfd_schedule_evict_and_restore_process(struct mm_struct *mm,
 			goto out;
 		else {
 			WARN(1, "Starting new evict with previous evict is not completed\n");
-			cancel_work_sync(&p->eviction_work.work);
+			if (cancel_work_sync(&p->eviction_work.work))
+				fence_put(p->eviction_work.eviction_fence);
 		}
 	}
 
@@ -899,11 +900,11 @@ void kfd_evict_bo_worker(struct work_struct *work)
 	ret = quiesce_process_mm(p);
 	if (!ret) {
 		fence_signal(eviction_work->eviction_fence);
-		fence_put(eviction_work->eviction_fence);
 		kfd_schedule_restore_bos_and_queues(p);
-	} else {
+	} else
 		pr_err("Failed to quiesce user queues. Cannot evict BOs\n");
-	}
+
+	fence_put(eviction_work->eviction_fence);
 
 }
 
-- 
2.7.4