patch-2.1.54 linux/ipc/shm.c

Next file: linux/kernel/exit.c
Previous file: linux/init/main.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.53/linux/ipc/shm.c linux/ipc/shm.c
@@ -498,8 +498,14 @@
 		if (shmflg & SHM_REMAP)
 			goto out;
 		err = -ENOMEM;
-		if (!(addr = get_unmapped_area(0, shp->shm_segsz)))
+		addr = 0;
+	again:
+		if (!(addr = get_unmapped_area(addr, shp->shm_segsz)))
 			goto out;
+		if(addr & (SHMLBA - 1)) {
+			addr = (addr + (SHMLBA - 1)) & ~(SHMLBA - 1);
+			goto again;
+		}
 	} else if (addr & (SHMLBA-1)) {
 		if (shmflg & SHM_RND)
 			addr &= ~(SHMLBA-1);       /* round down */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov