Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359751
b: refs/heads/master
c: 495c10c
h: refs/heads/master
i:
  359749: d61eb69
  359747: 5024aed
  359743: feda942
v: v3
  • Loading branch information
John Sheu authored and Sumit Semwal committed Feb 27, 2013
1 parent a0af394 commit 03cc371
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f00b4dad9d9eb001a04cf72e8351a2a1b9e99322
refs/heads/master: 495c10cc1c0c359871d5bef32dd173252fc17995
23 changes: 17 additions & 6 deletions trunk/drivers/base/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ EXPORT_SYMBOL_GPL(dma_buf_kunmap);
int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
unsigned long pgoff)
{
struct file *oldfile;
int ret;

if (WARN_ON(!dmabuf || !vma))
return -EINVAL;

Expand All @@ -460,14 +463,22 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
return -EINVAL;

/* readjust the vma */
if (vma->vm_file)
fput(vma->vm_file);

vma->vm_file = get_file(dmabuf->file);

get_file(dmabuf->file);
oldfile = vma->vm_file;
vma->vm_file = dmabuf->file;
vma->vm_pgoff = pgoff;

return dmabuf->ops->mmap(dmabuf, vma);
ret = dmabuf->ops->mmap(dmabuf, vma);
if (ret) {
/* restore old parameters on failure */
vma->vm_file = oldfile;
fput(dmabuf->file);
} else {
if (oldfile)
fput(oldfile);
}
return ret;

}
EXPORT_SYMBOL_GPL(dma_buf_mmap);

Expand Down

0 comments on commit 03cc371

Please sign in to comment.