mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
drm/amdgpu: disallow multiple BO_HANDLES chunks in one submit
[ Upstream commit fec5f8e8c6
]
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 <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0a1741d10d
commit
44e4aeaef9
|
@ -263,6 +263,10 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
|
||||||
if (size < sizeof(struct drm_amdgpu_bo_list_in))
|
if (size < sizeof(struct drm_amdgpu_bo_list_in))
|
||||||
goto free_partial_kdata;
|
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);
|
ret = amdgpu_cs_p1_bo_handles(p, p->chunks[i].kdata);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto free_partial_kdata;
|
goto free_partial_kdata;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user