Skip to content

Commit 36aa8c6

Browse files
nfrapradoChun-Kuang Hu
authored andcommitted
drm/mediatek: Clean dangling pointer on bind error path
mtk_drm_bind() can fail, in which case drm_dev_put() is called, destroying the drm_device object. However a pointer to it was still being held in the private object, and that pointer would be passed along to DRM in mtk_drm_sys_prepare() if a suspend were triggered at that point, resulting in a panic. Clean the pointer when destroying the object in the error path to prevent this from happening. Fixes: 119f517 ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20221122143949.3493104-1-nfraprado@collabora.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent 5bf1e3b commit 36aa8c6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ static int mtk_drm_bind(struct device *dev)
520520
err_deinit:
521521
mtk_drm_kms_deinit(drm);
522522
err_free:
523+
private->drm = NULL;
523524
drm_dev_put(drm);
524525
return ret;
525526
}

0 commit comments

Comments
 (0)