hugetlb: handle write-protection faults in follow_hugetlb_page

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Tuesday, December 11, 2007 - 1:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=72fad7...
Commit:     72fad7139b6829f71d7f41f39eb30da5760d90a8
Parent:     8805f2387086a7e6a9647d0713fc075694130d6c
Author:     Adam Litke <agl@us.ibm.com>
AuthorDate: Mon Dec 10 15:49:28 2007 -0800
Committer:  Linus Torvalds <torvalds@woody.linux-foundation.org>
CommitDate: Mon Dec 10 19:43:55 2007 -0800

    hugetlb: handle write-protection faults in follow_hugetlb_page
    
    The follow_hugetlb_page() fix I posted (merged as git commit
    5b23dbe8173c212d6a326e35347b038705603d39) missed one case.  If the pte is
    present, but not writable and write access is requested by the caller to
    get_user_pages(), the code will do the wrong thing.  Rather than calling
    hugetlb_fault to make the pte writable, it notes the presence of the pte
    and continues.
    
    This simple one-liner makes sure we also fault on the pte for this case.
    Please apply.
    
    Signed-off-by: Adam Litke <agl@us.ibm.com>
    Acked-by: Dave Kleikamp <shaggy@us.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 mm/hugetlb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6121b57..6f97821 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -907,7 +907,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
 		 */
 		pte = huge_pte_offset(mm, vaddr & HPAGE_MASK);
 
-		if (!pte || pte_none(*pte)) {
+		if (!pte || pte_none(*pte) || (write && !pte_write(*pte))) {
 			int ret;
 
 			spin_unlock(&mm->page_table_lock);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
hugetlb: handle write-protection faults in follow_hugetlb_page, Linux Kernel Mailing List..., (Tue Dec 11, 1:59 am)