Message ID | 20250410-mctp-rcu-sock-v1-1-872de9fdc877@codeconstruct.com.au (mailing list archive) |
---|---|
State | Accepted |
Commit | 52024cd6ec71a6ca934d0cc12452bd8d49850679 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net: mctp: Set SOCK_RCU_FREE | expand |
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Thu, 10 Apr 2025 11:53:19 +0800 you wrote: > Bind lookup runs under RCU, so ensure that a socket doesn't go away in > the middle of a lookup. > > Fixes: 833ef3b91de6 ("mctp: Populate socket implementation") > Signed-off-by: Matt Johnston <matt@codeconstruct.com.au> > --- > net/mctp/af_mctp.c | 3 +++ > 1 file changed, 3 insertions(+) > > [...] Here is the summary with links: - [net] net: mctp: Set SOCK_RCU_FREE https://git.kernel.org/netdev/net/c/52024cd6ec71 You are awesome, thank you!
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c index f6de136008f6f9b029e7dacc2e75dce1cd7fd075..57850d4dac5db946420120f8b15c82704c1044e7 100644 --- a/net/mctp/af_mctp.c +++ b/net/mctp/af_mctp.c @@ -630,6 +630,9 @@ static int mctp_sk_hash(struct sock *sk) { struct net *net = sock_net(sk); + /* Bind lookup runs under RCU, remain live during that. */ + sock_set_flag(sk, SOCK_RCU_FREE); + mutex_lock(&net->mctp.bind_lock); sk_add_node_rcu(sk, &net->mctp.binds); mutex_unlock(&net->mctp.bind_lock);
Bind lookup runs under RCU, so ensure that a socket doesn't go away in the middle of a lookup. Fixes: 833ef3b91de6 ("mctp: Populate socket implementation") Signed-off-by: Matt Johnston <matt@codeconstruct.com.au> --- net/mctp/af_mctp.c | 3 +++ 1 file changed, 3 insertions(+) --- base-commit: 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569 change-id: 20250410-mctp-rcu-sock-0f175bd94978 Best regards,