drm/amdgpu/vkms: fix a possible null pointer dereference
authorMa Ke <make_ruc2021@163.com>
Fri, 13 Oct 2023 01:53:43 +0000 (09:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:06:58 +0000 (17:06 +0000)
commit33fb1a555354bd593f785935ddcb5d9dd4d3847f
tree819c97ef957fd16f802f1b782bd0d72da8c67a9a
parent16fa59e273f8eb20ececeb570ab41c9d3d791429
drm/amdgpu/vkms: fix a possible null pointer dereference

[ Upstream commit cd90511557fdfb394bb4ac4c3b539b007383914c ]

In amdgpu_vkms_conn_get_modes(), the return value of drm_cvt_mode()
is assigned to mode, which will lead to a NULL pointer dereference
on failure of drm_cvt_mode(). Add a check to avoid null pointer
dereference.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c