[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150507165356.6efa045e5e1179ef4f46fdb9@linux-foundation.org>
Date: Thu, 7 May 2015 16:53:56 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: "Reese Faucette" <reesefaucette@...il.com>
Cc: <linux-kernel@...r.kernel.org>, <alan@...rguk.ukuu.org.uk>
Subject: Re: [PATCH] overflow check calculation in mm/mmap.c is incorrect
linux-3.12.38
On Wed, 29 Apr 2015 22:14:19 -0700 "Reese Faucette" <reesefaucette@...il.com> wrote:
> 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
>
> Reese Faucette
> Cisco Systems, Inc.
>
> ====================================================
> --- mm/mmap.c
> +++ mm/mmap.c
> @@ -1241,7 +1241,7 @@
> return -ENOMEM;
>
> /* offset overflow? */
> - if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
> + if ((pgoff + (len >> PAGE_SHIFT) - 1) < pgoff)
> return -EOVERFLOW;
>
> /* Too many mappings? */
Looks right.
Please send a Signed-off-by: for this patch, as per
Documentation/SubmittingPatches, section 11. Please also let me know
whether the authorship should be you@...il.com or some Cisco address,
as people often prefer.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists