From a6185ebfcb3463c77b1832a73e75de0617044375 Mon Sep 17 00:00:00 2001 From: Kamal Agrawal Date: Wed, 13 Jan 2021 09:14:19 +0530 Subject: [PATCH] msm: kgsl: Remove debugfs directory inside lock In kgsl_process_private_close, debugfs directory is removed after mutex is unlocked. Considering this, a race can be created between kgsl_process_private_close and kgsl_process_init_debugfs. Fix it by moving debugfs directory removal inside lock. Change-Id: Ida65ab8a3825d8c695c56556860495cce853117c Signed-off-by: Kamal Agrawal --- drivers/gpu/msm/kgsl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index 74da3a44b7fd..805cba0fb345 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -989,16 +989,15 @@ static void kgsl_process_private_close(struct kgsl_device_private *dev_priv, list_del(&private->list); write_unlock(&kgsl_driver.proclist_lock); + debugfs_remove_recursive(private->debug_root); + /* - * Unlock the mutex before releasing the memory and the debugfs - * nodes - this prevents deadlocks with the IOMMU and debugfs - * locks. + * Unlock the mutex before releasing the memory - this prevents a + * deadlock with the IOMMU mutex if a page fault occurs. */ mutex_unlock(&kgsl_driver.process_mutex); process_release_memory(private); - debugfs_remove_recursive(private->debug_root); - kgsl_process_private_put(private); }