+ mm-mmapc-fix-off-by-one-in-mmap-overflow-check.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/mmap.c: fix off-by-one in mmap overflow check 
has been added to the -mm tree.  Its filename is
     mm-mmapc-fix-off-by-one-in-mmap-overflow-check.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-mmapc-fix-off-by-one-in-mmap-overflow-check.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-mmapc-fix-off-by-one-in-mmap-overflow-check.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: "Reese Faucette" <reesefaucette@xxxxxxxxx>
Subject: mm/mmap.c: fix off-by-one in mmap overflow check 

When checking for overflow, the code in mm/mmap.c compares the first byte
*after* the end of mapped region to the start of the region instead of the
last byte of the mapped region.

This prevents mapping a region which abuts the end of physical space, as
mmap() incorrectly rejects the region with -EOVERFLOW, because pgoff +
(len >> PAGE_SHIFT) will be 0, which is < pgoff.  -reese



Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/mmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN mm/mmap.c~mm-mmapc-fix-off-by-one-in-mmap-overflow-check mm/mmap.c
--- a/mm/mmap.c~mm-mmapc-fix-off-by-one-in-mmap-overflow-check
+++ a/mm/mmap.c
@@ -1280,7 +1280,7 @@ unsigned long do_mmap_pgoff(struct file
 		return -ENOMEM;
 
 	/* offset overflow? */
-	if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
+	if ((pgoff + (len >> PAGE_SHIFT) - 1) < pgoff)
 		return -EOVERFLOW;
 
 	/* Too many mappings? */
_

Patches currently in -mm which might be from reesefaucette@xxxxxxxxx are

mm-mmapc-fix-off-by-one-in-mmap-overflow-check.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux