patch-2.4.24 linux-2.4.24/mm/mremap.c
Next file: linux-2.4.24/net/ipv4/netfilter/ip_fw_compat_masq.c
Previous file: linux-2.4.24/drivers/sbus/char/rtc.c
Back to the patch index
Back to the overall index
-  Lines: 14
-  Date:
2004-01-05 05:53:56.000000000 -0800
-  Orig file: 
linux-2.4.23/mm/mremap.c
-  Orig date: 
2003-08-25 04:44:44.000000000 -0700
diff -urN linux-2.4.23/mm/mremap.c linux-2.4.24/mm/mremap.c
@@ -241,6 +241,13 @@
 
 		if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
 			goto out;
+		/*
+		 * Allow new_len == 0 only if new_addr == addr
+		 * to preserve truncation in place (that was working
+		 * safe and some app may depend on it).
+		 */
+		if (unlikely(!new_len && new_addr != addr))
+			goto out;
 
 		/* Check if the location we're moving into overlaps the
 		 * old location at all, and fail if it does.
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)