[PATCH 2/9] drm/amdgpu: return error if both BOs and bo_list handle is given

Huang Rui ray.huang at amd.com
Tue Jul 31 02:44:18 UTC 2018


On Mon, Jul 30, 2018 at 04:51:52PM +0200, Christian König wrote:
> Return -EINVAL when both the BOs as well as a list handle is provided in
> the IOCTL.
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>

Reviewed-by: Huang Rui <ray.huang at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 8a49c3b97bd4..d41cea78e4aa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -572,14 +572,17 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
>  	INIT_LIST_HEAD(&p->validated);
>  
>  	/* p->bo_list could already be assigned if AMDGPU_CHUNK_ID_BO_HANDLES is present */
> -	if (p->bo_list) {
> -		mutex_lock(&p->bo_list->lock);
> +	if (cs->in.bo_list_handle) {
> +		if (p->bo_list)
> +			return -EINVAL;
>  
> -	} else if (cs->in.bo_list_handle) {
>  		r = amdgpu_bo_list_get(fpriv, cs->in.bo_list_handle,
>  				       &p->bo_list);
>  		if (r)
>  			return r;
> +
> +	} else if (p->bo_list) {
> +		mutex_lock(&p->bo_list->lock);
>  	}
>  
>  	if (p->bo_list) {
> -- 
> 2.14.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list