[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241004235904.8605-1-pvmohammedanees2003@gmail.com>
Date: Sat, 5 Oct 2024 05:29:04 +0530
From: Mohammed Anees <pvmohammedanees2003@...il.com>
To: amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
Xinhui Pan <Xinhui.Pan@....com>,
David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
Srinivasan Shanmugam <srinivasan.shanmugam@....com>,
David Wu <David.Wu3@....com>,
Felix Kuehling <felix.kuehling@....com>,
Mohammed Anees <pvmohammedanees2003@...il.com>
Subject: [PATCH] drm/amdgpu: prevent BO_HANDLES error from being overwritten
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 once an error condition is detected, the function
returns immediately, avoiding the overwriting of the error code.
Signed-off-by: Mohammed Anees <pvmohammedanees2003@...il.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 1e475eb01417..543db0df9a31 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -266,8 +266,9 @@ 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;
+ else
+ ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
- ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
if (ret)
goto free_partial_kdata;
break;
--
2.46.0
Powered by blists - more mailing lists