summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorCarsten Otte <cotte@de.ibm.com>2009-02-04 15:12:16 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-12 09:50:22 -0800
commit8c47f86fb53485e298ed154eb5c0ca0a89b85a24 (patch)
tree7f8332f8c11999de0c0eddc982bfebbe03bd4354 /mm
parent3bb90b5b5c86949bc3be417eea1eb85f10263098 (diff)
do_wp_page: fix regression with execute in place
commit ab92661d5d9514647346047f30f67a7f35ffea67 upstream. Fix do_wp_page for VM_MIXEDMAP mappings. In the case where pfn_valid returns 0 for a pfn at the beginning of do_wp_page and the mapping is not shared writable, the code branches to label `gotten:' with old_page == NULL. In case the vma is locked (vma->vm_flags & VM_LOCKED), lock_page, clear_page_mlock, and unlock_page try to access the old_page. This patch checks whether old_page is valid before it is dereferenced. The regression was introduced by "mlock: mlocked pages are unevictable" (commit b291f000393f5a0b679012b39d79fbc85c018233). Signed-off-by: Carsten Otte <cotte@de.ibm.com> Cc: Nick Piggin <npiggin@suse.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 164951c47305..fe2257f9ac80 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1881,7 +1881,7 @@ gotten:
* Don't let another task, with possibly unlocked vma,
* keep the mlocked page.
*/
- if (vma->vm_flags & VM_LOCKED) {
+ if ((vma->vm_flags & VM_LOCKED) && old_page) {
lock_page(old_page); /* for LRU manipulation */
clear_page_mlock(old_page);
unlock_page(old_page);