diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-01-26 12:48:05 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-01-31 12:07:15 -0500 |
commit | 03fc2da63b9a33dce784a2075c7e068bb97cbf69 (patch) | |
tree | 7d8bbc192f8468a8427f6f4704749ab140dcc10e | |
parent | d1a5f2b4d8a125943dcb6b032fc7eaefc2c78296 (diff) |
mm: fix pfn_t to page conversion in vm_insert_mixed
pfn_t_to_page() honors the flags in the pfn_t value to determine if a
pfn is backed by a page. However, vm_insert_mixed() was originally
written to use pfn_valid() to make this determination. To restore the
old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
and fallback to trusting pfn_valid().
Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Cc: Dave Hansen <dave@sr71.net>
Cc: David Airlie <airlied@linux.ie>
Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | mm/memory.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index 30991f83d0bf..93ce37989471 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | |||
1591 | * than insert_pfn). If a zero_pfn were inserted into a VM_MIXEDMAP | 1591 | * than insert_pfn). If a zero_pfn were inserted into a VM_MIXEDMAP |
1592 | * without pte special, it would there be refcounted as a normal page. | 1592 | * without pte special, it would there be refcounted as a normal page. |
1593 | */ | 1593 | */ |
1594 | if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) { | 1594 | if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) { |
1595 | struct page *page; | 1595 | struct page *page; |
1596 | 1596 | ||
1597 | page = pfn_t_to_page(pfn); | 1597 | /* |
1598 | * At this point we are committed to insert_page() | ||
1599 | * regardless of whether the caller specified flags that | ||
1600 | * result in pfn_t_has_page() == false. | ||
1601 | */ | ||
1602 | page = pfn_to_page(pfn_t_to_pfn(pfn)); | ||
1598 | return insert_page(vma, addr, page, vma->vm_page_prot); | 1603 | return insert_page(vma, addr, page, vma->vm_page_prot); |
1599 | } | 1604 | } |
1600 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); | 1605 | return insert_pfn(vma, addr, pfn, vma->vm_page_prot); |