patch-2.4.6 linux/net/core/sock.c

Next file: linux/net/decnet/af_decnet.c
Previous file: linux/net/core/neighbour.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/net/core/sock.c linux/net/core/sock.c
@@ -7,7 +7,7 @@
  *		handler for protocols to use and generic option handler.
  *
  *
- * Version:	$Id: sock.c,v 1.110 2001/04/20 20:46:19 davem Exp $
+ * Version:	$Id: sock.c,v 1.111 2001/06/26 23:29:17 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -80,6 +80,7 @@
  *		Andi Kleen	:	Add sock_kmalloc()/sock_kfree_s()
  *		Andi Kleen	:	Fix write_space callback
  *		Chris Evans	:	Security fixes - signedness again
+ *		Arnaldo C. Melo :       cleanups, use skb_queue_purge
  *
  * To Fix:
  *
@@ -172,7 +173,6 @@
 #endif
 	int val;
 	int valbool;
-	int err;
 	struct linger ling;
 	int ret = 0;
 	
@@ -192,9 +192,8 @@
   	if(optlen<sizeof(int))
   		return(-EINVAL);
   	
-	err = get_user(val, (int *)optval);
-	if (err)
-		return err;
+	if (get_user(val, (int *)optval))
+		return -EFAULT;
 	
   	valbool = val?1:0;
 
@@ -918,14 +917,10 @@
  
 void sklist_destroy_socket(struct sock **list,struct sock *sk)
 {
-	struct sk_buff *skb;
 	if(list)
 		sklist_remove_socket(list, sk);
 
-	while((skb=skb_dequeue(&sk->receive_queue))!=NULL)
-	{
-		kfree_skb(skb);
-	}
+	skb_queue_purge(&sk->receive_queue);
 
 	if(atomic_read(&sk->wmem_alloc) == 0 &&
 	   atomic_read(&sk->rmem_alloc) == 0 &&

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