summaryrefslogtreecommitdiff
path: root/mali_kbase/mali_kbase_debug_mem_view.c
diff options
context:
space:
mode:
authorSidath Senanayake <sidaths@google.com>2018-09-27 14:34:14 +0200
committerSidath Senanayake <sidaths@google.com>2018-09-27 14:34:14 +0200
commitf10b3de5283d0c196459f18160161e48cfadae81 (patch)
tree7123dda75768c8b90b15c58523a7509a7c93a35b /mali_kbase/mali_kbase_debug_mem_view.c
parentf32af5a9ba3c2b556d92827a96dbeec3df200968 (diff)
downloadgpu-f10b3de5283d0c196459f18160161e48cfadae81.tar.gz
Mali Bifrost DDK r15p0 KMD
Provenance: c4c373c4f (collaborate/EAC/b_r15p0) BX304L01B-BU-00000-r15p0-01rel0 BX304L06A-BU-00000-r15p0-01rel0 BX304X07X-BU-00000-r15p0-01rel0 Signed-off-by: Sidath Senanayake <sidaths@google.com> Change-Id: I09fe49ca693dfde616dd8d6b8c3e5b178a47e9f8
Diffstat (limited to 'mali_kbase/mali_kbase_debug_mem_view.c')
-rw-r--r--mali_kbase/mali_kbase_debug_mem_view.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/mali_kbase/mali_kbase_debug_mem_view.c b/mali_kbase/mali_kbase_debug_mem_view.c
index ee45529..8f46117 100644
--- a/mali_kbase/mali_kbase_debug_mem_view.c
+++ b/mali_kbase/mali_kbase_debug_mem_view.c
@@ -32,6 +32,10 @@
#ifdef CONFIG_DEBUG_FS
+#if (KERNEL_VERSION(4, 1, 0) > LINUX_VERSION_CODE)
+#define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count)
+#endif
+
struct debug_mem_mapping {
struct list_head node;
@@ -199,9 +203,12 @@ static int debug_mem_open(struct inode *i, struct file *file)
struct debug_mem_data *mem_data;
int ret;
+ if (get_file_rcu(kctx_file) == 0)
+ return -ENOENT;
+
ret = seq_open(file, &ops);
if (ret)
- return ret;
+ goto open_fail;
mem_data = kmalloc(sizeof(*mem_data), GFP_KERNEL);
if (!mem_data) {
@@ -213,8 +220,6 @@ static int debug_mem_open(struct inode *i, struct file *file)
INIT_LIST_HEAD(&mem_data->mapping_list);
- get_file(kctx_file);
-
kbase_gpu_vm_lock(kctx);
ret = debug_mem_zone_open(&kctx->reg_rbtree_same, mem_data);
@@ -246,10 +251,12 @@ out:
list_del(&mapping->node);
kfree(mapping);
}
- fput(kctx_file);
kfree(mem_data);
}
seq_release(i, file);
+open_fail:
+ fput(kctx_file);
+
return ret;
}