Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[muen/linux.git] / mm / mmap.c
index 5a0ba9788cdda01fa759a85e1461f2f2aeeb642f..7f8cfe9d9b4d06000632f1779051daa0361cd4b4 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3186,8 +3186,12 @@ static int special_mapping_mremap(struct vm_area_struct *new_vma)
 {
        struct vm_special_mapping *sm = new_vma->vm_private_data;
 
+       if (WARN_ON_ONCE(current->mm != new_vma->vm_mm))
+               return -EFAULT;
+
        if (sm->mremap)
                return sm->mremap(sm, new_vma);
+
        return 0;
 }