@@ -6099,79 +6099,6 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
6099
6099
}
6100
6100
#endif /* __PAGETABLE_PMD_FOLDED */
6101
6101
6102
- /**
6103
- * follow_pte - look up PTE at a user virtual address
6104
- * @vma: the memory mapping
6105
- * @address: user virtual address
6106
- * @ptepp: location to store found PTE
6107
- * @ptlp: location to store the lock for the PTE
6108
- *
6109
- * On a successful return, the pointer to the PTE is stored in @ptepp;
6110
- * the corresponding lock is taken and its location is stored in @ptlp.
6111
- *
6112
- * The contents of the PTE are only stable until @ptlp is released using
6113
- * pte_unmap_unlock(). This function will fail if the PTE is non-present.
6114
- * Present PTEs may include PTEs that map refcounted pages, such as
6115
- * anonymous folios in COW mappings.
6116
- *
6117
- * Callers must be careful when relying on PTE content after
6118
- * pte_unmap_unlock(). Especially if the PTE maps a refcounted page,
6119
- * callers must protect against invalidation with MMU notifiers; otherwise
6120
- * access to the PFN at a later point in time can trigger use-after-free.
6121
- *
6122
- * Only IO mappings and raw PFN mappings are allowed. The mmap semaphore
6123
- * should be taken for read.
6124
- *
6125
- * This function must not be used to modify PTE content.
6126
- *
6127
- * Return: zero on success, -ve otherwise.
6128
- */
6129
- int follow_pte (struct vm_area_struct * vma , unsigned long address ,
6130
- pte_t * * ptepp , spinlock_t * * ptlp )
6131
- {
6132
- struct mm_struct * mm = vma -> vm_mm ;
6133
- pgd_t * pgd ;
6134
- p4d_t * p4d ;
6135
- pud_t * pud ;
6136
- pmd_t * pmd ;
6137
- pte_t * ptep ;
6138
-
6139
- mmap_assert_locked (mm );
6140
- if (unlikely (address < vma -> vm_start || address >= vma -> vm_end ))
6141
- goto out ;
6142
-
6143
- if (!(vma -> vm_flags & (VM_IO | VM_PFNMAP )))
6144
- goto out ;
6145
-
6146
- pgd = pgd_offset (mm , address );
6147
- if (pgd_none (* pgd ) || unlikely (pgd_bad (* pgd )))
6148
- goto out ;
6149
-
6150
- p4d = p4d_offset (pgd , address );
6151
- if (p4d_none (* p4d ) || unlikely (p4d_bad (* p4d )))
6152
- goto out ;
6153
-
6154
- pud = pud_offset (p4d , address );
6155
- if (pud_none (* pud ) || unlikely (pud_bad (* pud )))
6156
- goto out ;
6157
-
6158
- pmd = pmd_offset (pud , address );
6159
- VM_BUG_ON (pmd_trans_huge (* pmd ));
6160
-
6161
- ptep = pte_offset_map_lock (mm , pmd , address , ptlp );
6162
- if (!ptep )
6163
- goto out ;
6164
- if (!pte_present (ptep_get (ptep )))
6165
- goto unlock ;
6166
- * ptepp = ptep ;
6167
- return 0 ;
6168
- unlock :
6169
- pte_unmap_unlock (ptep , * ptlp );
6170
- out :
6171
- return - EINVAL ;
6172
- }
6173
- EXPORT_SYMBOL_GPL (follow_pte );
6174
-
6175
6102
static inline void pfnmap_args_setup (struct follow_pfnmap_args * args ,
6176
6103
spinlock_t * lock , pte_t * ptep ,
6177
6104
pgprot_t pgprot , unsigned long pfn_base ,
0 commit comments