aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
diff options
context:
space:
mode:
authorJesse Zhang <[email protected]>2024-05-09 02:57:04 +0000
committerAlex Deucher <[email protected]>2024-05-23 19:09:15 +0000
commit030ffd4d43b433bc6671d9ec34fc12c59220b95d (patch)
tree1162f527ff7551379419d8ab6b7b7c84fb8da18d /drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
parentdrm/amd/pm: fix unsigned value asic_type compared against (diff)
downloadkernel-030ffd4d43b433bc6671d9ec34fc12c59220b95d.tar.gz
kernel-030ffd4d43b433bc6671d9ec34fc12c59220b95d.zip
drm/admgpu: fix dereferencing null pointer context
When user space sets an invalid ta type, the pointer context will be empty. So it need to check the pointer context before using it Signed-off-by: Jesse Zhang <[email protected]> Suggested-by: Tim Huang <[email protected]> Reviewed-by: Tim Huang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
index ca5c86e5f7cd..8e8afbd237bc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
@@ -334,7 +334,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size
set_ta_context_funcs(psp, ta_type, &context);
- if (!context->initialized) {
+ if (!context || !context->initialized) {
dev_err(adev->dev, "TA is not initialized\n");
ret = -EINVAL;
goto err_free_shared_buf;