lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d206b28-a8fc-4a3e-a75b-c91106b1f232@ti.com>
Date:   Mon, 1 Apr 2019 08:27:44 -0500
From:   "Andrew F. Davis" <afd@...com>
To:     Sumit Semwal <sumit.semwal@...aro.org>,
        <linux-kernel@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH] dma-buf: Make mmap callback actually optional

On 4/1/19 2:13 AM, Daniel Vetter wrote:
> On Fri, Mar 29, 2019 at 11:52:01AM -0500, Andrew F. Davis wrote:
>> The docs state the callback is optional but it is not, make it optional.
>>
>> Signed-off-by: Andrew F. Davis <afd@...com>
> 
> There's a bunch of dummy mmap implementations we could remove with this,
> would be nice to follow up.
> 

Was cleaning up some dummy kmap implementations when I found that many
had dummy mmap also, so plan was if this goes in I'll be able to zap
them both in one go. That or actually add valid kmap where appropriate.
Either way will be following up.

Andrew

> Reviewed-by: Daniel Vetter <daniel.vetter@...ll.ch>
> 
>> ---
>>  drivers/dma-buf/dma-buf.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
>> index 7c858020d14b..4d4ae9fe9ac8 100644
>> --- a/drivers/dma-buf/dma-buf.c
>> +++ b/drivers/dma-buf/dma-buf.c
>> @@ -90,6 +90,10 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
>>  
>>  	dmabuf = file->private_data;
>>  
>> +	/* check if buffer supports mmap */
>> +	if (!dmabuf->ops->mmap)
>> +		return -EINVAL;
>> +
>>  	/* check for overflowing the buffer's size */
>>  	if (vma->vm_pgoff + vma_pages(vma) >
>>  	    dmabuf->size >> PAGE_SHIFT)
>> @@ -404,8 +408,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
>>  			  || !exp_info->ops
>>  			  || !exp_info->ops->map_dma_buf
>>  			  || !exp_info->ops->unmap_dma_buf
>> -			  || !exp_info->ops->release
>> -			  || !exp_info->ops->mmap)) {
>> +			  || !exp_info->ops->release)) {
>>  		return ERR_PTR(-EINVAL);
>>  	}
>>  
>> @@ -906,6 +909,10 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
>>  	if (WARN_ON(!dmabuf || !vma))
>>  		return -EINVAL;
>>  
>> +	/* check if buffer supports mmap */
>> +	if (!dmabuf->ops->mmap)
>> +		return -EINVAL;
>> +
>>  	/* check for offset overflow */
>>  	if (pgoff + vma_pages(vma) < pgoff)
>>  		return -EOVERFLOW;
>> -- 
>> 2.21.0
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@...ts.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ