summaryrefslogtreecommitdiff
blob: e5fb62eb95e1a70e3bf77c6a5e2c77ae94ba116c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- linux-2.4.20-wolk4.9s/mm/mremap.c	2004-02-18 15:46:31.000000000 +0000
+++ linux-2.4.20-wolk4.9s/mm/mremap.c.plasmaroo	2004-02-18 15:51:29.000000000 +0000
@@ -316,7 +316,9 @@
 		if ((addr <= new_addr) && (addr+old_len) > new_addr)
 			goto out;
 
-		do_munmap(current->mm, new_addr, new_len);
+		ret = do_munmap(current->mm, new_addr, new_len);
+		if (ret && new_len)
+			goto out;
 	}
 
 	/*
@@ -324,9 +326,11 @@
 	 * the unnecessary pages..
 	 * do_munmap does all the needed commit accounting
 	 */
-	ret = addr;
 	if (old_len >= new_len) {
-		do_munmap(current->mm, addr+new_len, old_len - new_len);
+		ret = do_munmap(current->mm, addr+new_len, old_len - new_len);
+		if (ret && old_len != new_len)
+			goto out;
+		ret = addr;
 		if (!(flags & MREMAP_FIXED) || (new_addr == addr))
 			goto out;
 		old_len = new_len;