summaryrefslogtreecommitdiff
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-09-13 15:58:35 +0300
committerDavid S. Miller <davem@davemloft.net>2023-09-16 12:09:43 +0300
commit41862d12e77f78b4ecb59b028bf44de92991bda2 (patch)
treee4f3ed2dcbaaf1a8b14bf2da554650b2ca92b0b0 /net/core/sock.c
parent4fa5ce3e3a10da4ecc438a548fc701dec5f28758 (diff)
downloadlinux-41862d12e77f78b4ecb59b028bf44de92991bda2.tar.xz
net: use indirect call helpers for sk->sk_prot->release_cb()
When adding sk->sk_prot->release_cb() call from __sk_flush_backlog() Paolo suggested using indirect call helpers to take care of CONFIG_RETPOLINE=y case. It turns out Google had such mitigation for years in release_sock(), it is time to make this public :) Suggested-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 213a62ac13f2..a5995750c5c5 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3003,7 +3003,9 @@ void __sk_flush_backlog(struct sock *sk)
__release_sock(sk);
if (sk->sk_prot->release_cb)
- sk->sk_prot->release_cb(sk);
+ INDIRECT_CALL_INET_1(sk->sk_prot->release_cb,
+ tcp_release_cb, sk);
+
spin_unlock_bh(&sk->sk_lock.slock);
}
EXPORT_SYMBOL_GPL(__sk_flush_backlog);
@@ -3523,7 +3525,8 @@ void release_sock(struct sock *sk)
__release_sock(sk);
if (sk->sk_prot->release_cb)
- sk->sk_prot->release_cb(sk);
+ INDIRECT_CALL_INET_1(sk->sk_prot->release_cb,
+ tcp_release_cb, sk);
sock_release_ownership(sk);
if (waitqueue_active(&sk->sk_lock.wq))