Commit e9de427e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: fix "direct_io" private mmap
  fuse: fix argument type in fuse_get_user_pages()
parents 9fc0178c 3121bfe7
...@@ -938,9 +938,9 @@ static void fuse_release_user_pages(struct fuse_req *req, int write) ...@@ -938,9 +938,9 @@ static void fuse_release_user_pages(struct fuse_req *req, int write)
} }
static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf, static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
unsigned *nbytesp, int write) size_t *nbytesp, int write)
{ {
unsigned nbytes = *nbytesp; size_t nbytes = *nbytesp;
unsigned long user_addr = (unsigned long) buf; unsigned long user_addr = (unsigned long) buf;
unsigned offset = user_addr & ~PAGE_MASK; unsigned offset = user_addr & ~PAGE_MASK;
int npages; int npages;
...@@ -955,7 +955,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf, ...@@ -955,7 +955,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,
return 0; return 0;
} }
nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT); nbytes = min_t(size_t, nbytes, FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ); npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ);
down_read(&current->mm->mmap_sem); down_read(&current->mm->mmap_sem);
...@@ -1298,6 +1298,8 @@ static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1298,6 +1298,8 @@ static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma)
if (vma->vm_flags & VM_MAYSHARE) if (vma->vm_flags & VM_MAYSHARE)
return -ENODEV; return -ENODEV;
invalidate_inode_pages2(file->f_mapping);
return generic_file_mmap(file, vma); return generic_file_mmap(file, vma);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment