[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230913125835.3445264-1-edumazet@google.com>
Date: Wed, 13 Sep 2023 12:58:35 +0000
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com,
Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH net-next] 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@...hat.com>
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
net/core/sock.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index bb89b88bc1e8a042c4ee40b3c8345dc58cb1b369..969b11ede8cd8c08138a8164279b4e5923f825e6 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))
--
2.42.0.283.g2d96d420d3-goog
Powered by blists - more mailing lists