author | Liang Ji <liang.ji@amlogic.com> | 2020-06-02 07:18:04 (GMT) |
---|---|---|
committer | Liang Ji <liang.ji@amlogic.com> | 2020-07-20 01:59:10 (GMT) |
commit | a4fdf4e818731872f417b6b6a61383532e541d5c (patch) | |
tree | 82ab76c74c287c088151cf052b9e29262d137303 | |
parent | d3b664ca45b2308b59c97518996f348ac3ce486c (diff) | |
download | gpu-q-amlogic.zip gpu-q-amlogic.tar.gz gpu-q-amlogic.tar.bz2 |
r21p0: check the null pointer [1/1]
BUG=157842809
problem:
mali crash because of null pointer
when debug_fs = y
solution:
check if pointer = null return directly
Verify:
Sabrina/deadpool
Signed-off-by: Liang Ji <liang.ji@amlogic.com>
Change-Id: Ic712e9bc99d81a65b6c0dbad0ebcfb9378cc2b46
-rw-r--r-- | dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_profile_debugfs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_profile_debugfs.c b/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_profile_debugfs.c index 5d38ed2..5752d4a 100644 --- a/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_profile_debugfs.c +++ b/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_profile_debugfs.c @@ -38,6 +38,9 @@ static int kbasep_mem_profile_seq_show(struct seq_file *sfile, void *data) { struct kbase_context *kctx = sfile->private; + if (IS_ERR_OR_NULL(kctx->kctx_dentry)) /* not initialized */ + return -EINVAL; + mutex_lock(&kctx->mem_profile_lock); seq_write(sfile, kctx->mem_profile_data, kctx->mem_profile_size); @@ -70,6 +73,9 @@ int kbasep_mem_profile_debugfs_insert(struct kbase_context *kctx, char *data, { int err = 0; + if (IS_ERR_OR_NULL(kctx->kctx_dentry)) /* not initialized */ + return -EINVAL; + mutex_lock(&kctx->mem_profile_lock); dev_dbg(kctx->kbdev->dev, "initialised: %d", @@ -106,6 +112,9 @@ int kbasep_mem_profile_debugfs_insert(struct kbase_context *kctx, char *data, void kbasep_mem_profile_debugfs_remove(struct kbase_context *kctx) { + if (IS_ERR_OR_NULL(kctx->kctx_dentry)) /* not initialized */ + return ; + mutex_lock(&kctx->mem_profile_lock); dev_dbg(kctx->kbdev->dev, "initialised: %d", |