]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
drm/mediatek: Clean dangling pointer on bind error path
authorNícolas F. R. A. Prado <nfraprado@collabora.com>
Tue, 22 Nov 2022 14:39:49 +0000 (09:39 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:43 +0000 (16:46 +0100)
commit5eb5c9b9bb4ab78dc70fc31b69ccc7e87d13179d
treecbfca437bcaa0feae3f9524a19ae9d27b5ca3039
parent5c9cb71d5a1f427f1669c1183570b7cccf0dfe2c
drm/mediatek: Clean dangling pointer on bind error path

BugLink: https://bugs.launchpad.net/bugs/2011425
[ Upstream commit 36aa8c61af55675ed967900fbe5deb32d776f051 ]

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: 119f5173628a ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/gpu/drm/mediatek/mtk_drm_drv.c