From: Carsten Otte <cotte@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm <linux-mm@kvack.org>, Nick Piggin <npiggin@suse.de>,
Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: PATCH do_wp_page: fix regression with execute in place
Date: Wed, 28 Jan 2009 10:20:04 +0100 [thread overview]
Message-ID: <20090128102004.5cd8eb9a@cotte.boeblingen.de.ibm.com> (raw)
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>
reply other threads:[~2009-01-28 9:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090128102004.5cd8eb9a@cotte.boeblingen.de.ibm.com \
--to=cotte@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox