* [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds
@ 2024-04-23 9:15 Bob Zhou
2024-04-23 11:36 ` Christian König
2024-04-24 7:58 ` Ma, Le
0 siblings, 2 replies; 3+ messages in thread
From: Bob Zhou @ 2024-04-23 9:15 UTC (permalink / raw)
To: amd-gfx, le.ma; +Cc: Alexander.Deucher, Christian.Koenig, Bob Zhou
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: Bob Zhou <bob.zhou@amd.com>
---
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index e2e3856938ed..101038395c3b 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -2021,6 +2021,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);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds
2024-04-23 9:15 [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds Bob Zhou
@ 2024-04-23 11:36 ` Christian König
2024-04-24 7:58 ` Ma, Le
1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2024-04-23 11:36 UTC (permalink / raw)
To: Bob Zhou, amd-gfx, le.ma; +Cc: Alexander.Deucher
Am 23.04.24 um 11:15 schrieb Bob Zhou:
> 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: Bob Zhou <bob.zhou@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index e2e3856938ed..101038395c3b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -2021,6 +2021,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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds
2024-04-23 9:15 [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds Bob Zhou
2024-04-23 11:36 ` Christian König
@ 2024-04-24 7:58 ` Ma, Le
1 sibling, 0 replies; 3+ messages in thread
From: Ma, Le @ 2024-04-24 7:58 UTC (permalink / raw)
To: Zhou, Bob, amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander, Koenig, Christian, Zhou, Bob
[AMD Official Use Only - General]
Reviewed-by: Le Ma <le.ma@amd.com>
Thanks for catching. Please populate the fix to sdma_v4_4_2 as well if necessary.
> -----Original Message-----
> From: Bob Zhou <bob.zhou@amd.com>
> Sent: Tuesday, April 23, 2024 5:15 PM
> To: amd-gfx@lists.freedesktop.org; Ma, Le <Le.Ma@amd.com>
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Zhou, Bob <Bob.Zhou@amd.com>
> Subject: [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds
>
> 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: Bob Zhou <bob.zhou@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index e2e3856938ed..101038395c3b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -2021,6 +2021,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);
> --
> 2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-24 7:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23 9:15 [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds Bob Zhou
2024-04-23 11:36 ` Christian König
2024-04-24 7:58 ` Ma, Le
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.