Commit ed027d38 authored by Bob Zhou's avatar Bob Zhou Committed by Wenyu Huang
Browse files

drm/amdgpu: add error handle to avoid out-of-bounds

stable inclusion
from stable-v5.10.220
commit 8112fa72b7f139052843ff484130d6f97e9f052f
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IA8AED
CVE: CVE-2024-39471

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=8112fa72b7f139052843ff484130d6f97e9f052f



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

commit 8b2faf1a4f3b6c748c0da36cda865a226534d520 upstream.

if the sdma_v4_0_irq_id_to_seq return -EINVAL, the process should
be stop to avoid out-of-bounds read, so directly return -EINVAL.

Signed-off-by: default avatarBob Zhou <bob.zhou@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarLe Ma <le.ma@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWenyu Huang <huangwenyu5@huawei.com>
parent 1e94b0d2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2073,6 +2073,9 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,

	DRM_DEBUG("IH: SDMA trap\n");
	instance = sdma_v4_0_irq_id_to_seq(entry->client_id);
	if (instance < 0)
		return instance;

	switch (entry->ring_id) {
	case 0:
		amdgpu_fence_process(&adev->sdma.instance[instance].ring);