* The caller must hold down_write(current->mm->mmap_sem).
*/
-unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
- unsigned long addr, unsigned long len,
- unsigned long prot, unsigned long flags,
- unsigned long pgoff)
+unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
+ unsigned long len, unsigned long prot,
+ unsigned long flags, unsigned long pgoff)
{
+ struct mm_struct * mm = current->mm;
struct vm_area_struct * vma, * prev;
struct inode *inode;
unsigned int vm_flags;
address &= PAGE_MASK;
grow = (address - vma->vm_end) >> PAGE_SHIFT;
- /* Someone beat us to it */
- if (grow <= 0) {
+ if (address < vma->vm_end) {
anon_vma_unlock(vma);
return 0;
}
address &= PAGE_MASK;
grow = (vma->vm_start - address) >> PAGE_SHIFT;
- /* Someone beat us to it */
- if (grow <= 0) {
+ if (address >= vma->vm_start) {
anon_vma_unlock(vma);
return 0;
}