Commit ac2ccb2f authored by Stanley.Yang's avatar Stanley.Yang Committed by Liu Shixin
Browse files

drm/amdgpu: Fix potential null pointer derefernce

stable inclusion
from stable-v5.10.202
commit b93a25de28af153312f0fc979b0663fc4bd3442b
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9RE5O
CVE: CVE-2023-52814

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b93a25de28af153312f0fc979b0663fc4bd3442b



--------------------------------

[ Upstream commit 80285ae1ec8717b597b20de38866c29d84d321a1 ]

The amdgpu_ras_get_context may return NULL if device
not support ras feature, so add check before using.

Signed-off-by: default avatarStanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent ff7390bf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4523,7 +4523,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
	 * Flush RAM to disk so that after reboot
	 * the user can read log and see why the system rebooted.
	 */
	if (need_emergency_restart && amdgpu_ras_get_context(adev)->reboot) {
	if (need_emergency_restart && amdgpu_ras_get_context(adev) &&
		amdgpu_ras_get_context(adev)->reboot) {
		DRM_WARN("Emergency reboot.");

		ksys_sync_helper();