Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cb7c1f0 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: return error if both BOs and bo_list handle is given



Return -EINVAL when both the BOs as well as a list handle is provided in
the IOCTL.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 275105ce
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -572,14 +572,17 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
	INIT_LIST_HEAD(&p->validated);
	INIT_LIST_HEAD(&p->validated);


	/* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */
	/* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */
	if (p->bo_list) {
	if (cs->in.bo_list_handle) {
		mutex_lock(&p->bo_list->lock);
		if (p->bo_list)
			return -EINVAL;


	} else if (cs->in.bo_list_handle) {
		r = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle,
		r = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle,
				       &p->bo_list);
				       &p->bo_list);
		if (r)
		if (r)
			return r;
			return r;

	} else if (p->bo_list) {
		mutex_lock(&p->bo_list->lock);
	}
	}


	if (p->bo_list) {
	if (p->bo_list) {