Skip to contentSkip to conversation

add vma->ops check before do_nonlinear_fault()

PATCH In review Boll Liu 2 participants 2 messages Sep 9, 2009

Subsystems (2)
lore
Share & tools
lore

Boll Liu

author
#0 lore raw

PATCH 1/1 add vma->ops check before do_nonlinear_fault()

Function do_nonlinear_fault() will also call vma->vm_ops->fault(). So add vma->ops and vma->vm_ops->fault check the same as before calling do_nonlinear_fault().

---
 mm/memory.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
mm/memory.c +7 -3
index aede2ce..86ebdd6 100644
@@ -2921,9 +2921,13 @@ static inline int handle_pte_fault(struct mm_struct *mm,
 			return do_anonymous_page(mm, vma, address,
 						 pte, pmd, flags);
 		}
-		if (pte_file(entry))
-			return do_nonlinear_fault(mm, vma, address,
-					pte, pmd, flags, entry);
+		if (pte_file(entry)) {
+			if (vma->vm_ops) {
+				if (likely(vma->vm_ops->fault))
+					return do_nonlinear_fault(mm, vma, address,
+						pte, pmd, flags, entry);
+			}
+		}
 		return do_swap_page(mm, vma, address,
 					pte, pmd, flags, entry);
 	}
Signature · 7 lines
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 3 lines · Boll Liu

Function do_nonlinear_fault() will also call vma->vm_ops->fault(). So add vma->ops and vma->vm_ops->fault check the same as before calling do_nonlinear_fault().

I don't think we'd ever install a pte_file entry there for a filesystem that cannot handle it (ie. does not have a ->fault). So I don't think this is needed.

Quoted 29 lines
---
 mm/memory.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
mm/memory.c +7 -3
index aede2ce..86ebdd6 100644
@@ -2921,9 +2921,13 @@ static inline int handle_pte_fault(struct mm_struct *mm,
 			return do_anonymous_page(mm, vma, address,
 						 pte, pmd, flags);
 		}
-		if (pte_file(entry))
-			return do_nonlinear_fault(mm, vma, address,
-					pte, pmd, flags, entry);
+		if (pte_file(entry)) {
+			if (vma->vm_ops) {
+				if (likely(vma->vm_ops->fault))
+					return do_nonlinear_fault(mm, vma, address,
+						pte, pmd, flags, entry);
+			}
+		}
 		return do_swap_page(mm, vma, address,
 					pte, pmd, flags, entry);
 	}
Signature · 1 line
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>