Skip to content

Commit

Permalink
net: use indirect call helpers for sk->sk_prot->release_cb()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 16, 2023
1 parent 4fa5ce3 commit 41862d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 41862d1

Please sign in to comment.