patch-2.4.5 linux/net/ipv4/tcp.c

Next file: linux/net/ipv4/tcp_input.c
Previous file: linux/net/ipv4/syncookies.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
@@ -5,7 +5,7 @@
  *
  *		Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:	$Id: tcp.c,v 1.202 2001/04/20 20:46:19 davem Exp $
+ * Version:	$Id: tcp.c,v 1.205 2001/05/05 22:25:30 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -1122,8 +1122,16 @@
 
 				/* Time to copy data. We are close to the end! */
 				err = tcp_copy_to_page(sk, from, skb, page, off, copy);
-				if (err)
+				if (err) {
+					/* If this page was new, give it to the
+					 * socket so it does not get leaked.
+					 */
+					if (TCP_PAGE(sk) == NULL) {
+						TCP_PAGE(sk) = page;
+						TCP_OFF(sk) = 0;
+					}
 					goto do_error;
+				}
 
 				/* Update the skb. */
 				if (merge) {
@@ -1182,12 +1190,9 @@
 	return copied;
 
 do_fault:
-	if (skb->len==0) {
-		if (tp->send_head == skb) {
-			tp->send_head = skb->prev;
-			if (tp->send_head == (struct sk_buff*)&sk->write_queue)
-				tp->send_head = NULL;
-		}
+	if (skb->len == 0) {
+		if (tp->send_head == skb)
+			tp->send_head = NULL;
 		__skb_unlink(skb, skb->list);
 		tcp_free_skb(sk, skb);
 	}
@@ -2352,7 +2357,7 @@
 		break;
 	case TCP_LINGER2:
 		val = tp->linger2;
-		if (val > 0)
+		if (val >= 0)
 			val = (val ? : sysctl_tcp_fin_timeout)/HZ;
 		break;
 	case TCP_DEFER_ACCEPT:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)