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

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

diff -u --recursive --new-file v2.1.3/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
@@ -922,12 +922,7 @@
 		send = tcp_enqueue_partial;
 		copy = seglen;
 	}
-	if (exception()) {
-		tcp_enqueue_partial(sk, skb);
-		return -EFAULT;
-	}
-	memcpy_fromfs(skb->tail, from, copy);
-	end_exception();
+	copy_from_user(skb->tail, from, copy);
 	tcp_size += copy;
 	skb->tail += copy;
 	skb->len += copy;
@@ -1172,11 +1167,8 @@
 				skb->h.th->urg_ptr = ntohs(copy);
 			}
 
-			if (exception())
-				goto bad_access;
 			skb->csum = csum_partial_copy_fromuser(from,
 				skb->tail, copy, 0);
-			end_exception();
 			skb->tail += copy;
 			skb->len += copy;
 			from += copy;
@@ -1187,12 +1179,7 @@
 			skb->free = 0;
 
 			send(sk, skb);
-			continue;
-
-bad_access:
-			sock_wfree(sk, skb);
-			return -EFAULT;
-			}
+		}
 	}
 	sk->err = 0;
 
@@ -1552,7 +1539,7 @@
 		*seq += used;
 
 		/*
-		 *	This memcpy_tofs can sleep. If it sleeps and we
+		 *	This copy_to_user can sleep. If it sleeps and we
 		 *	do a second read it relies on the skb->users to avoid
 		 *	a crash when cleanup_rbuf() gets called.
 		 */
@@ -2146,7 +2133,7 @@
   	if(err)
   		return err;
 
-  	val = get_user((int *)optval);
+	get_user(val, (int *)optval);
 
 	switch(optname)
 	{

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