From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] mbind: fix verify_pages pte_page
Date: Mon, 6 Jun 2005 20:48:27 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.61.0506062046590.5000@goblin.wat.veritas.com> (raw)
Strict mbind's check that pages already mapped are on right node has been
using pte_page without checking if pfn_valid, and without page_table_lock
to prevent spurious failures when try_to_unmap_one intervenes between the
pte_present and the pte_page.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
mm/mempolicy.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
--- 2.6.12-rc6/mm/mempolicy.c 2005-05-25 18:09:21.000000000 +0100
+++ linux/mm/mempolicy.c 2005-06-04 20:41:55.000000000 +0100
@@ -242,6 +242,9 @@ static int
verify_pages(struct mm_struct *mm,
unsigned long addr, unsigned long end, unsigned long *nodes)
{
+ int err = 0;
+
+ spin_lock(&mm->page_table_lock);
while (addr < end) {
struct page *p;
pte_t *pte;
@@ -268,17 +271,23 @@ verify_pages(struct mm_struct *mm,
}
p = NULL;
pte = pte_offset_map(pmd, addr);
- if (pte_present(*pte))
- p = pte_page(*pte);
+ if (pte_present(*pte)) {
+ unsigned long pfn = pte_pfn(*pte);
+ if (pfn_valid(pfn))
+ p = pfn_to_page(pfn);
+ }
pte_unmap(pte);
if (p) {
unsigned nid = page_to_nid(p);
- if (!test_bit(nid, nodes))
- return -EIO;
+ if (!test_bit(nid, nodes)) {
+ err = -EIO;
+ break;
+ }
}
addr += PAGE_SIZE;
}
- return 0;
+ spin_unlock(&mm->page_table_lock);
+ return err;
}
/* Step 1: check the range */
next reply other threads:[~2005-06-06 19:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-06 19:48 Hugh Dickins [this message]
2005-06-06 19:49 ` [PATCH 2/2] mbind: check_range use standard ptwalk Hugh Dickins
2005-06-07 14:39 ` Andi Kleen
2005-06-07 14:38 ` [PATCH 1/2] mbind: fix verify_pages pte_page Andi Kleen
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=Pine.LNX.4.61.0506062046590.5000@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®