From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>,
Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH] Fix bound checking in do_mmap_pgoff()
Date: Sun, 19 Sep 2004 18:07:15 +1000 [thread overview]
Message-ID: <1095581234.26670.6.camel@gaston> (raw)
Hi !
A small issue has been forever in do_mmap_pgoff() in the boundary checking
in the sense that it won't let you mmap with offset+len enclosing the last
page of the "address space". For example, an mmap of /dev/mem won't let you
map the last page of the physical address space (which I need for a ROM dump
tool on pmac). This fixes it:
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
===== mm/mmap.c 1.144 vs edited =====
--- 1.144/mm/mmap.c 2004-09-03 19:08:17 +10:00
+++ edited/mm/mmap.c 2004-09-19 18:04:34 +10:00
@@ -801,7 +801,7 @@
return -EINVAL;
/* offset overflow? */
- if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
+ if ((pgoff + (len >> PAGE_SHIFT) - 1) < pgoff)
return -EINVAL;
/* Too many mappings? */
next reply other threads:[~2004-09-19 8:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-19 8:07 Benjamin Herrenschmidt [this message]
2004-09-19 12:59 ` [PATCH] Fix bound checking in do_mmap_pgoff() Hugh Dickins
2004-09-19 13:09 ` Benjamin Herrenschmidt
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=1095581234.26670.6.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=segher@kernel.crashing.org \
--cc=torvalds@osdl.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