recover_worker() grabs a reference to the offending task with
get_pid_task() to bump the per-VM fault counters, but never drops
the reference again, leaking a task struct every time a hang is
recovered for a task that is still alive.

Drop the reference with put_task_struct() once the fault counters
have been updated, mirroring what get_comm_cmdline() already does.

Fixes: 25654a1756a4 ("drm/msm: Update global fault counter when faulty process 
has already ended")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
---
 drivers/gpu/drm/msm/msm_gpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 3f3925b11eea..9a4ebf47b8b8 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -505,6 +505,8 @@ static void recover_worker(struct kthread_work *work)
                 */
                if (!vm->managed)
                        msm_gem_vm_unusable(submit->vm);
+
+               put_task_struct(task);
        }
 
        noreclaim_flag = memalloc_noreclaim_save();
-- 
2.34.1

Reply via email to