summaryrefslogtreecommitdiff
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-10-05 23:37:23 +0300
committerDavid S. Miller <davem@davemloft.net>2019-10-05 23:37:23 +0300
commit6f4c930e02355664d89c976eccea5d999a90de16 (patch)
treebc08932fbf43b9560ba5bde3284674054e3b56eb /net/core/sock.c
parent26e0105550862a137eba701e2f4e3eeb343759e9 (diff)
parent2d00aee21a5d4966e086d98f9d710afb92fb14e8 (diff)
downloadlinux-6f4c930e02355664d89c976eccea5d999a90de16.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 9774ab2ed3f1..24e93407239a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1701,8 +1701,6 @@ static void __sk_destruct(struct rcu_head *head)
sk_filter_uncharge(sk, filter);
RCU_INIT_POINTER(sk->sk_filter, NULL);
}
- if (rcu_access_pointer(sk->sk_reuseport_cb))
- reuseport_detach_sock(sk);
sock_disable_timestamp(sk, SK_FLAGS_TIMESTAMP);
@@ -1729,7 +1727,14 @@ static void __sk_destruct(struct rcu_head *head)
void sk_destruct(struct sock *sk)
{
- if (sock_flag(sk, SOCK_RCU_FREE))
+ bool use_call_rcu = sock_flag(sk, SOCK_RCU_FREE);
+
+ if (rcu_access_pointer(sk->sk_reuseport_cb)) {
+ reuseport_detach_sock(sk);
+ use_call_rcu = true;
+ }
+
+ if (use_call_rcu)
call_rcu(&sk->sk_rcu, __sk_destruct);
else
__sk_destruct(&sk->sk_rcu);
@@ -3493,7 +3498,7 @@ static long sock_prot_memory_allocated(struct proto *proto)
return proto->memory_allocated != NULL ? proto_memory_allocated(proto) : -1L;
}
-static char *sock_prot_memory_pressure(struct proto *proto)
+static const char *sock_prot_memory_pressure(struct proto *proto)
{
return proto->memory_pressure != NULL ?
proto_memory_pressure(proto) ? "yes" : "no" : "NI";