From cca417f1ffbacdb9f741aa9f32d2012e907ccccb Mon Sep 17 00:00:00 2001 From: Yong Zhao 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 --- 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