diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 5b744b30a195..dd8de96f5547 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1900,12 +1900,26 @@ int vm_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr, | |||
1900 | } | 1900 | } |
1901 | EXPORT_SYMBOL(vm_insert_pfn_prot); | 1901 | EXPORT_SYMBOL(vm_insert_pfn_prot); |
1902 | 1902 | ||
1903 | static bool vm_mixed_ok(struct vm_area_struct *vma, pfn_t pfn) | ||
1904 | { | ||
1905 | /* these checks mirror the abort conditions in vm_normal_page */ | ||
1906 | if (vma->vm_flags & VM_MIXEDMAP) | ||
1907 | return true; | ||
1908 | if (pfn_t_devmap(pfn)) | ||
1909 | return true; | ||
1910 | if (pfn_t_special(pfn)) | ||
1911 | return true; | ||
1912 | if (is_zero_pfn(pfn_t_to_pfn(pfn))) | ||
1913 | return true; | ||
1914 | return false; | ||
1915 | } | ||
1916 | |||
1903 | static int __vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | 1917 | static int __vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
1904 | pfn_t pfn, bool mkwrite) | 1918 | pfn_t pfn, bool mkwrite) |
1905 | { | 1919 | { |
1906 | pgprot_t pgprot = vma->vm_page_prot; | 1920 | pgprot_t pgprot = vma->vm_page_prot; |
1907 | 1921 | ||
1908 | BUG_ON(!(vma->vm_flags & VM_MIXEDMAP)); | 1922 | BUG_ON(!vm_mixed_ok(vma, pfn)); |
1909 | 1923 | ||
1910 | if (addr < vma->vm_start || addr >= vma->vm_end) | 1924 | if (addr < vma->vm_start || addr >= vma->vm_end) |
1911 | return -EFAULT; | 1925 | return -EFAULT; |