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

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

diff -u --recursive --new-file v2.2.4/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.77 1999/03/21 05:22:26 davem Exp $
+ * Version:	$Id: sock.c,v 1.79 1999/03/28 10:18:25 davem Exp $
  *
  * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -150,6 +150,9 @@
 		    char *optval, int optlen)
 {
 	struct sock *sk=sock->sk;
+#ifdef CONFIG_FILTER
+	struct sk_filter *filter;
+#endif
 	int val;
 	int valbool;
 	int err;
@@ -341,17 +344,11 @@
 			break;
 
 		case SO_DETACH_FILTER:
-                        if(sk->filter) {
-				struct sk_filter *filter;
-
-				filter = sk->filter;
-
-				net_serialize_enter();
+			filter = sk->filter;
+                        if(filter) {
 				sk->filter = NULL;
-				net_serialize_leave();
-				
-				if (filter)
-					sk_filter_release(sk, filter);
+				synchronize_bh();
+				sk_filter_release(sk, filter);
 				return 0;
 			}
 			return -ENOENT;
@@ -501,22 +498,16 @@
 
 void sk_free(struct sock *sk)
 {
-	if (sk->destruct)
-		sk->destruct(sk);
-
 #ifdef CONFIG_FILTER
-	if (sk->filter) {
-		sk_filter_release(sk, sk->filter);
-		sk->filter = NULL;
-	}
+	struct sk_filter *filter;
 #endif
-
-	if (atomic_read(&sk->omem_alloc))
-		printk(KERN_DEBUG "sk_free: optmem leakage (%d bytes) detected.\n", atomic_read(&sk->omem_alloc));
+	if (sk->destruct)
+		sk->destruct(sk);
 
 #ifdef CONFIG_FILTER
-	if (sk->filter) {
-		sk_filter_release(sk, sk->filter);
+	filter = sk->filter;
+	if (filter) {
+		sk_filter_release(sk, filter);
 		sk->filter = NULL;
 	}
 #endif

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