drm/radeon: fix a possible null pointer dereference
authorGong Yuanjun <ruc_gongyuanjun@163.com>
Tue, 17 May 2022 09:57:00 +0000 (17:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:23 +0000 (18:36 +0200)
commit7b7fba107b2c4ec7673d0f45bdbb9d1af697d9b9
treec97591838e6ca17e9bb1cda823e7fd8952856632
parent10ef82d6e0af5536ec64770c07f6bbabfdd6977c
drm/radeon: fix a possible null pointer dereference

[ Upstream commit a2b28708b645c5632dc93669ab06e97874c8244f ]

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

The failure status of drm_cvt_mode() on the other path is checked too.

Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/radeon/radeon_connectors.c