patch-1.3.65 linux/net/ipv4/udp.c

Next file: linux/net/ipx/af_ipx.c
Previous file: linux/net/ipv4/timer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.64/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
@@ -392,7 +392,7 @@
   	if(!sk->broadcast && ip_chk_addr(usin->sin_addr.s_addr)==IS_BROADCAST)
 	    	return -EACCES;			/* Must turn broadcast on first */
 
-	sk->inuse = 1;
+	lock_sock(sk);
 
 	/* Send the packet. */
 	tmp = udp_send(sk, usin, from, len, flags, saddr, noblock);
@@ -539,8 +539,7 @@
 		sin->sin_addr.s_addr = skb->daddr;
   	}
   
-  	skb_free_datagram(skb);
-  	release_sock(sk);
+  	skb_free_datagram(sk, skb);
   	return(copied);
 }
 
@@ -576,14 +575,13 @@
 
 static void udp_close(struct sock *sk, int timeout)
 {
-	sk->inuse = 1;
+	lock_sock(sk);
 	sk->state = TCP_CLOSE;
 	if(uh_cache_sk==sk)
 		udp_cache_zap();
+	release_sock(sk);
 	if (sk->dead) 
 		destroy_sock(sk);
-	else
-		release_sock(sk);
 }
 
 
@@ -746,11 +744,9 @@
 		ip_statistics.IpInDelivers--;
 		skb->sk = NULL;
 		kfree_skb(skb, FREE_WRITE);
-		release_sock(sk);
 		return(0);
 	}
   	udp_statistics.UdpInDatagrams++;
-	release_sock(sk);
 	return(0);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this