[RFC 3/6] udmabuf: enforce access flags

Gerd Hoffmann kraxel at redhat.com
Thu Aug 1 06:52:07 UTC 2019


>  static int mmap_udmabuf(struct dma_buf *buf, struct vm_area_struct *vma)
>  {
>  	struct udmabuf *ubuf = buf->priv;
> +	pgprot_t pgprot = vm_get_page_prot(vma->vm_flags);
>  
>  	if ((vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) == 0)
>  		return -EINVAL;
>  
> +	if (ubuf->flags & UDMABUF_FLAGS_PROT_NONE)
> +		return -EINVAL;
> +
> +	if ((ubuf->flags & UDMABUF_FLAGS_PROT_READ) == 0)

"if ((vma->vm_flags & VM_READ) == 0)" ?

cheers,
  Gerd



More information about the dri-devel mailing list