From: Al Viro <viro@ftp.linux.org.uk>
To: linux-arch@vger.kernel.org
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH 5/18] fix the arch checks in MREMAP_FIXED case
Date: Sat, 05 Dec 2009 19:08:50 +0000 [thread overview]
Message-ID: <E1NGzzu-0008RR-UD@ZenIV.linux.org.uk> (raw)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
mm/mremap.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/mm/mremap.c b/mm/mremap.c
index 9d07539..84efffb 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -325,6 +325,7 @@ static unsigned long mremap_to(unsigned long addr,
struct vm_area_struct *vma;
unsigned long ret = -EINVAL;
unsigned long charged = 0;
+ unsigned long map_flags;
if (new_addr & ~PAGE_MASK)
goto out;
@@ -362,9 +363,23 @@ static unsigned long mremap_to(unsigned long addr,
goto out;
}
- ret = move_vma(vma, addr, old_len, new_len, new_addr);
+ map_flags = MAP_FIXED;
+ if (vma->vm_flags & VM_MAYSHARE)
+ map_flags |= MAP_SHARED;
+ ret = arch_mmap_check(new_addr, new_len, map_flags);
+ if (ret)
+ goto out1;
+ ret = get_unmapped_area(vma->vm_file, new_addr, new_len, vma->vm_pgoff +
+ ((addr - vma->vm_start) >> PAGE_SHIFT),
+ map_flags);
if (ret & ~PAGE_MASK)
- vm_unacct_memory(charged);
+ goto out1;
+
+ ret = move_vma(vma, addr, old_len, new_len, new_addr);
+ if (!(ret & ~PAGE_MASK))
+ goto out;
+out1:
+ vm_unacct_memory(charged);
out:
return ret;
--
1.5.6.5
reply other threads:[~2009-12-05 20:17 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=E1NGzzu-0008RR-UD@ZenIV.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).