diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-10-07 20:00:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-07 21:46:28 -0400 |
commit | 87744ab3832b83ba71b931f86f9cfdb000d07da5 (patch) | |
tree | 0cf8f43080e8203df182106686e6f8f6403c0de0 /mm | |
parent | d66ba15bde22703b3c0cec6782519cb0765a6777 (diff) |
mm: fix cache mode tracking in vm_insert_mixed()
vm_insert_mixed() unlike vm_insert_pfn_prot() and vmf_insert_pfn_pmd(),
fails to check the pgprot_t it uses for the mapping against the one
recorded in the memtype tracking tree. Add the missing call to
track_pfn_insert() to preclude cases where incompatible aliased mappings
are established for a given physical address range.
Link: http://lkml.kernel.org/r/147328717909.35069.14256589123570653697.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index 4bfc3a9c3b18..fc1987dfd8cc 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1649,10 +1649,14 @@ EXPORT_SYMBOL(vm_insert_pfn_prot); | |||
1649 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | 1649 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
1650 | pfn_t pfn) | 1650 | pfn_t pfn) |
1651 | { | 1651 | { |
1652 | pgprot_t pgprot = vma->vm_page_prot; | ||
1653 | |||
1652 | BUG_ON(!(vma->vm_flags & VM_MIXEDMAP)); | 1654 | BUG_ON(!(vma->vm_flags & VM_MIXEDMAP)); |
1653 | 1655 | ||
1654 | if (addr < vma->vm_start || addr >= vma->vm_end) | 1656 | if (addr < vma->vm_start || addr >= vma->vm_end) |
1655 | return -EFAULT; | 1657 | return -EFAULT; |
1658 | if (track_pfn_insert(vma, &pgprot, pfn)) | ||
1659 | return -EINVAL; | ||
1656 | 1660 | ||
1657 | /* | 1661 | /* |
1658 | * If we don't have pte special, then we have to use the pfn_valid() | 1662 | * If we don't have pte special, then we have to use the pfn_valid() |
@@ -1670,9 +1674,9 @@ int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | |||
1670 | * result in pfn_t_has_page() == false. | 1674 | * result in pfn_t_has_page() == false. |
1671 | */ | 1675 | */ |
1672 | page = pfn_to_page(pfn_t_to_pfn(pfn)); | 1676 | page = pfn_to_page(pfn_t_to_pfn(pfn)); |
1673 | return insert_page(vma, addr, page, vma->vm_page_prot); | 1677 | return insert_page(vma, addr, page, pgprot); |
1674 | } | 1678 | } |
1675 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); | 1679 | return insert_pfn(vma, addr, pfn, pgprot); |
1676 | } | 1680 | } |
1677 | EXPORT_SYMBOL(vm_insert_mixed); | 1681 | EXPORT_SYMBOL(vm_insert_mixed); |
1678 | 1682 | ||