mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-07 17:19:02 +00:00
drm/mediatek: Fix access violation in mtk_drm_crtc_dma_dev_get
commitb6961d187f
upstream. Add error handling to check NULL input in mtk_drm_crtc_dma_dev_get function. While display path is not configured correctly, none of crtc is established. So the caller of mtk_drm_crtc_dma_dev_get may pass input parameter *crtc as NULL, Which may cause coredump when we try to get the container of NULL pointer. Fixes:cb1d6bcca5
("drm/mediatek: Add dma dev get function") Signed-off-by: Stuart Lee <stuart.lee@mediatek.com> Cc: stable@vger.kernel.org Reviewed-by: AngeloGioacchino DEl Regno <angelogioacchino.delregno@collabora.com> Tested-by: Macpaul Lin <macpaul.lin@mediatek.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20231110012914.14884-2-stuart.lee@mediatek.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3aae4ef4d7
commit
03e63e497a
1 changed files with 8 additions and 1 deletions
|
@ -885,7 +885,14 @@ static int mtk_drm_crtc_init_comp_planes(struct drm_device *drm_dev,
|
|||
|
||||
struct device *mtk_drm_crtc_dma_dev_get(struct drm_crtc *crtc)
|
||||
{
|
||||
struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
|
||||
struct mtk_drm_crtc *mtk_crtc = NULL;
|
||||
|
||||
if (!crtc)
|
||||
return NULL;
|
||||
|
||||
mtk_crtc = to_mtk_crtc(crtc);
|
||||
if (!mtk_crtc)
|
||||
return NULL;
|
||||
|
||||
return mtk_crtc->dma_dev;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue