* [PATCH v2] drm/amdgpu: prevent BO_HANDLES error from being overwritten
@ 2024-10-09 12:28 Mohammed Anees
2024-10-09 12:31 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Mohammed Anees @ 2024-10-09 12:28 UTC (permalink / raw)
To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, simona,
srinivasan.shanmugam, David.Wu3, felix.kuehling, YuanShang.Mao,
pierre-eric.pelloux-prayer
Cc: amd-gfx, dri-devel, linux-kernel, Mohammed Anees, stable
Before this patch, if multiple BO_HANDLES chunks were submitted,
the error -EINVAL would be correctly set but could be overwritten
by the return value from amdgpu_cs_p1_bo_handles(). This patch
ensures that if there are multiple BO_HANDLES, we stop.
Cc: stable@vger.kernel.org
Fixes: fec5f8e8c6bc ("drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit")
Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
---
v2:
- Switched to goto free_partial_kdata for error handling, following the existing pattern.
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 1e475eb01417..d891ab779ca7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -265,7 +265,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
/* Only a single BO list is allowed to simplify handling. */
if (p->bo_list)
- ret = -EINVAL;
+ goto free_partial_kdata;
ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
if (ret)
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/amdgpu: prevent BO_HANDLES error from being overwritten
2024-10-09 12:28 [PATCH v2] drm/amdgpu: prevent BO_HANDLES error from being overwritten Mohammed Anees
@ 2024-10-09 12:31 ` Christian König
2024-10-09 13:52 ` Pierre-Eric Pelloux-Prayer
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2024-10-09 12:31 UTC (permalink / raw)
To: Mohammed Anees, alexander.deucher, Xinhui.Pan, airlied, simona,
srinivasan.shanmugam, David.Wu3, felix.kuehling, YuanShang.Mao,
pierre-eric.pelloux-prayer
Cc: amd-gfx, dri-devel, linux-kernel, stable
Am 09.10.24 um 14:28 schrieb Mohammed Anees:
> Before this patch, if multiple BO_HANDLES chunks were submitted,
> the error -EINVAL would be correctly set but could be overwritten
> by the return value from amdgpu_cs_p1_bo_handles(). This patch
> ensures that if there are multiple BO_HANDLES, we stop.
>
> Cc: stable@vger.kernel.org
> Fixes: fec5f8e8c6bc ("drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit")
> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
@Pierre-Eric can you pick that one up and push to amd-staging-drm-next?
Alex is currently on XDC and I'm a bit busy as well.
Thanks,
Christian.
> ---
> v2:
> - Switched to goto free_partial_kdata for error handling, following the existing pattern.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 1e475eb01417..d891ab779ca7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -265,7 +265,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
>
> /* Only a single BO list is allowed to simplify handling. */
> if (p->bo_list)
> - ret = -EINVAL;
> + goto free_partial_kdata;
>
> ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
> if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/amdgpu: prevent BO_HANDLES error from being overwritten
2024-10-09 12:31 ` Christian König
@ 2024-10-09 13:52 ` Pierre-Eric Pelloux-Prayer
0 siblings, 0 replies; 3+ messages in thread
From: Pierre-Eric Pelloux-Prayer @ 2024-10-09 13:52 UTC (permalink / raw)
To: Christian König, Mohammed Anees, alexander.deucher,
Xinhui.Pan, airlied, simona, srinivasan.shanmugam, David.Wu3,
felix.kuehling, YuanShang.Mao, pierre-eric.pelloux-prayer
Cc: amd-gfx, dri-devel, linux-kernel, stable
Thanks for the updated patch, looks good to me.
Le 09/10/2024 à 14:31, Christian König a écrit :
> Am 09.10.24 um 14:28 schrieb Mohammed Anees:
>> Before this patch, if multiple BO_HANDLES chunks were submitted,
>> the error -EINVAL would be correctly set but could be overwritten
>> by the return value from amdgpu_cs_p1_bo_handles(). This patch
>> ensures that if there are multiple BO_HANDLES, we stop.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: fec5f8e8c6bc ("drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit")
>> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
>
> @Pierre-Eric can you pick that one up and push to amd-staging-drm-next?
>
> Alex is currently on XDC and I'm a bit busy as well.
Sure, will do.
Pierre-Eric
>
> Thanks,
> Christian.
>
>> ---
>> v2:
>> - Switched to goto free_partial_kdata for error handling, following the existing pattern.
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 1e475eb01417..d891ab779ca7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -265,7 +265,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
>> /* Only a single BO list is allowed to simplify handling. */
>> if (p->bo_list)
>> - ret = -EINVAL;
>> + goto free_partial_kdata;
>> ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
>> if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-09 13:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 12:28 [PATCH v2] drm/amdgpu: prevent BO_HANDLES error from being overwritten Mohammed Anees
2024-10-09 12:31 ` Christian König
2024-10-09 13:52 ` Pierre-Eric Pelloux-Prayer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox