Skip to content

Commit

Permalink
drm/msm: return an error pointer in msm_gem_prime_get_sg_table()
Browse files Browse the repository at this point in the history
[ Upstream commit cf575e3 ]

The msm_gem_prime_get_sg_table() needs to return error pointers on
error.  This is called from drm_gem_map_dma_buf() and returning a
NULL will lead to a crash in that function.

Fixes: ac45146 ("drm/msm: fix msm_gem_prime_get_sg_table()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/485023/
Link: https://lore.kernel.org/r/YnOmtS5tfENywR9m@kili
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jun 9, 2022
1 parent 883f1d5 commit d50b262
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/msm/msm_gem_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj)
int npages = obj->size >> PAGE_SHIFT;

if (WARN_ON(!msm_obj->pages)) /* should have already pinned! */
return NULL;
return ERR_PTR(-ENOMEM);

return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages);
}
Expand Down

0 comments on commit d50b262

Please sign in to comment.