LWN.net Logo

[PATCH] do_brk() bounds checking

From:  Linux Kernel Mailing List <linux-kernel-AT-vger.kernel.org>
To:  bk-commits-head-AT-vger.kernel.org
Subject:  [PATCH] do_brk() bounds checking
Date:  Thu, 25 Sep 2003 02:18:41 +0000

ChangeSet 1.1335, 2003/09/24 19:18:41-07:00, akpm@osdl.org

	[PATCH] do_brk() bounds checking
	
	check that the brk value lies in bounds.


# This patch includes the following deltas:
#	           ChangeSet	1.1334  -> 1.1335 
#	           mm/mmap.c	1.90    -> 1.91   
#

 mmap.c |    3 +++
 1 files changed, 3 insertions(+)


diff -Nru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c	Wed Sep 24 20:08:11 2003
+++ b/mm/mmap.c	Wed Sep 24 20:08:11 2003
@@ -1269,6 +1269,9 @@
 	if (!len)
 		return addr;
 
+	if ((addr + len) > TASK_SIZE || (addr + len) < addr)
+		return -EINVAL;
+
 	/*
 	 * mlock MCL_FUTURE?
 	 */
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


(Log in to post comments)

Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.