Commit 030ffd4d authored by Jesse Zhang's avatar Jesse Zhang Committed by Alex Deucher

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: default avatarJesse Zhang <Jesse.Zhang@amd.com>
Suggested-by: default avatarTim Huang <Tim.Huang@amd.com>
Reviewed-by: default avatarTim Huang <Tim.Huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 29c03ede
...@@ -334,7 +334,7 @@ static ssize_t ta_if_invoke_debugfs_write(struct file *fp, const char *buf, size ...@@ -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); set_ta_context_funcs(psp, ta_type, &context);
if (!context->initialized) { if (!context || !context->initialized) {
dev_err(adev->dev, "TA is not initialized\n"); dev_err(adev->dev, "TA is not initialized\n");
ret = -EINVAL; ret = -EINVAL;
goto err_free_shared_buf; goto err_free_shared_buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment