aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/inet_hashtables.c2
-rw-r--r--net/packet/af_packet.c4
-rw-r--r--net/unix/af_unix.c6
3 files changed, 7 insertions, 5 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 11fcb87a1fdd..6a1045da48d2 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -402,9 +402,9 @@ void inet_unhash(struct sock *sk)
402 402
403 spin_lock_bh(lock); 403 spin_lock_bh(lock);
404 done =__sk_nulls_del_node_init_rcu(sk); 404 done =__sk_nulls_del_node_init_rcu(sk);
405 spin_unlock_bh(lock);
406 if (done) 405 if (done)
407 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); 406 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
407 spin_unlock_bh(lock);
408} 408}
409EXPORT_SYMBOL_GPL(inet_unhash); 409EXPORT_SYMBOL_GPL(inet_unhash);
410 410
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b4870a34c435..5f94db2f3e9e 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -872,6 +872,7 @@ static int packet_release(struct socket *sock)
872 872
873 write_lock_bh(&net->packet.sklist_lock); 873 write_lock_bh(&net->packet.sklist_lock);
874 sk_del_node_init(sk); 874 sk_del_node_init(sk);
875 sock_prot_inuse_add(net, sk->sk_prot, -1);
875 write_unlock_bh(&net->packet.sklist_lock); 876 write_unlock_bh(&net->packet.sklist_lock);
876 877
877 /* 878 /*
@@ -910,7 +911,6 @@ static int packet_release(struct socket *sock)
910 skb_queue_purge(&sk->sk_receive_queue); 911 skb_queue_purge(&sk->sk_receive_queue);
911 sk_refcnt_debug_release(sk); 912 sk_refcnt_debug_release(sk);
912 913
913 sock_prot_inuse_add(net, sk->sk_prot, -1);
914 sock_put(sk); 914 sock_put(sk);
915 return 0; 915 return 0;
916} 916}
@@ -1085,8 +1085,8 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
1085 1085
1086 write_lock_bh(&net->packet.sklist_lock); 1086 write_lock_bh(&net->packet.sklist_lock);
1087 sk_add_node(sk, &net->packet.sklist); 1087 sk_add_node(sk, &net->packet.sklist);
1088 write_unlock_bh(&net->packet.sklist_lock);
1089 sock_prot_inuse_add(net, &packet_proto, 1); 1088 sock_prot_inuse_add(net, &packet_proto, 1);
1089 write_unlock_bh(&net->packet.sklist_lock);
1090 return(0); 1090 return(0);
1091out: 1091out:
1092 return err; 1092 return err;
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a45a9f7369ed..3a35a6e8bf91 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -615,9 +615,11 @@ static struct sock *unix_create1(struct net *net, struct socket *sock)
615out: 615out:
616 if (sk == NULL) 616 if (sk == NULL)
617 atomic_dec(&unix_nr_socks); 617 atomic_dec(&unix_nr_socks);
618 else 618 else {
619 local_bh_disable();
619 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); 620 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
620 621 local_bh_enable();
622 }
621 return sk; 623 return sk;
622} 624}
623 625