arm64_wp_huge_pte should acquire a lock before return
to keep the lock semantics of the caller.
To guarantee this, add a new lock acquisition and a
new lock release statements in proper positions.
Change-Id: I81fb8afc37f54bce83f353ca6b6894e70ef86934
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
pte_t *hpte_p;
if (vma_is_anonymous(vmf->vma)) {
+ int ret;
+
spin_unlock(vmf->ptl);
- return arm64_do_huge_pte_wp_page(vmf, orig_pte);
+ ret = arm64_do_huge_pte_wp_page(vmf, orig_pte);
+ spin_lock(vmf->ptl);
+ return ret;
}
VM_BUG_ON_VMA(vmf->vma->vm_flags & VM_SHARED, vmf->vma);
if (!pte_write(entry)) {
int ret = arch_do_wp_page(vmf, entry);
- if (!(ret & VM_FAULT_FALLBACK))
+ if (!(ret & VM_FAULT_FALLBACK)) {
+ /*
+ * arch_do_wp_page returns
+ * VM_FAULT value with spin lock acquisition.
+ */
+ spin_unlock(vmf->ptl);
return ret;
+ }
return do_wp_page(vmf);
}
if (arch_huge_pte_set_accessed(vmf, entry))