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

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)