Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <Jesse.Zhang@amd.com>
Suggested-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jesse Zhang and committed by
Alex Deucher
030ffd4d 29c03ede

+1 -1
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
··· 334 334 335 335 set_ta_context_funcs(psp, ta_type, &context); 336 336 337 - if (!context->initialized) { 337 + if (!context || !context->initialized) { 338 338 dev_err(adev->dev, "TA is not initialized\n"); 339 339 ret = -EINVAL; 340 340 goto err_free_shared_buf;