diff options
| author | Pierre-Eric Pelloux-Prayer <[email protected]> | 2024-07-02 09:54:30 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2024-07-23 21:33:57 +0000 |
| commit | fec5f8e8c6bcf83ed7a392801d7b44c5ecfc1e82 (patch) | |
| tree | 19a00b28fd14614c4269a4c00e52ba5a4f3bbcc5 | |
| parent | drm/amdgpu: Add sdma_v4_0 ip dump for devcoredump (diff) | |
| download | kernel-fec5f8e8c6bcf83ed7a392801d7b44c5ecfc1e82.tar.gz kernel-fec5f8e8c6bcf83ed7a392801d7b44c5ecfc1e82.zip | |
drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit
Before this commit, only submits with both a BO_HANDLES chunk and a
'bo_list_handle' would be rejected (by amdgpu_cs_parser_bos).
But if UMD sent multiple BO_HANDLES, what would happen is:
* only the last one would be really used
* all the others would leak memory as amdgpu_cs_p1_bo_handles would
overwrite the previous p->bo_list value
This commit rejects submissions with multiple BO_HANDLES chunks to
match the implementation of the parser.
Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 916b6b8cf7d9..cde2f4548a62 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -263,6 +263,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p, if (size < sizeof(struct drm_amdgpu_bo_list_in)) goto free_partial_kdata; + /* Only a single BO list is allowed to simplify handling. */ + if (p->bo_list) + ret = -EINVAL; + ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata); if (ret) goto free_partial_kdata; |
