[PATCH] drm/msm: Error pointer dereference in error handling

Jordan Crouse jcrouse at codeaurora.org
Mon Aug 14 14:50:24 UTC 2017


On Fri, Aug 11, 2017 at 11:15:35PM +0300, Dan Carpenter wrote:
> "gpu->aspace" can be either an error pointer or NULL so we need to check
> for both.
> 
> Fixes: 0dbd7327f4d5 ("drm/msm: Move memptrs to msm_gpu")
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> 
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index 66af5ac334ba..156ad7d5c68a 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -775,7 +775,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
>  		drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
>  	}
>  
> -	if (gpu->aspace) {
> +	if (!IS_ERR_OR_NULL(gpu->aspace)) {
>  		gpu->aspace->mmu->funcs->detach(gpu->aspace->mmu,
>  			NULL, 0);
>  		msm_gem_address_space_put(gpu->aspace);

Yep, thats clearly a paddlin'.  Thanks.

Acked-by: Jordan Crouse <jcrouse at codeauorora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


More information about the dri-devel mailing list