linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* PATCH do_wp_page: fix regression with execute in place
@ 2009-01-28  9:20 Carsten Otte
  0 siblings, 0 replies; only message in thread
From: Carsten Otte @ 2009-01-28  9:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Nick Piggin, Heiko Carstens

This patch fixes do_wp_page for VM_MIXEDMAP mappings. In case
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 old_page.
This patch checks, whether old_page is valid before it is
dereferenced.
The regression was introduced with git commit b291f000

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
---
diff --git a/mm/memory.c b/mm/memory.c
index 22bfa7a..baa999e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1999,7 +1999,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);

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-28  9:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28  9:20 PATCH do_wp_page: fix regression with execute in place Carsten Otte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox