[PATCH] 2.4.0-test1-ac21 mmap bug

From: Stephen Rothwell (sfr@linuxcare.com)
Date: Wed Jun 21 2000 - 03:39:02 EST


Hi Linus,

The following small patch (hopefully) fixes and bug in shared anonymous
mappings. If you ask for a large amount of memory (i.e. more than the
currently available virtual memory), the mmap currently succeeds, but
it is possible for the memory to not be shared (or worse).

--- 2.4.0-test1-ac21/mm/mmap.c Mon Jun 19 09:42:39 2000
+++ test/mm/mmap.c Wed Jun 21 18:18:27 2000
@@ -310,6 +310,8 @@
                         goto unmap_and_free_vma;
         } else if (flags & MAP_SHARED) {
                 error = map_zero_setup(vma);
+ if (error)
+ goto free_vma;
         }
 
         /*

This patch should also apply to 2.4.0-test2-pre5 (and anything
beyond 2.3.99pre8 which is the earliest kernel I tested).

Cheers,
Stephen

-- 
Stephen Rothwell, Open Source Project Engineer, Linuxcare, Inc.
+61-2-62628990 tel, +61-2-62628991 fax 
sfr@linuxcare.com, http://www.linuxcare.com/ 
Linuxcare. Support for the revolution.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:21 EST