projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f3fdd4f
)
net: mctp: Set SOCK_RCU_FREE
author
Matt Johnston
<matt@codeconstruct.com.au>
Thu, 10 Apr 2025 03:53:19 +0000
(11:53 +0800)
committer
Jakub Kicinski
<kuba@kernel.org>
Sat, 12 Apr 2025 01:42:34 +0000
(18:42 -0700)
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>
Link:
https://patch.msgid.link/20250410-mctp-rcu-sock-v1-1-872de9fdc877@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mctp/af_mctp.c
patch
|
blob
|
blame
|
history
diff --git
a/net/mctp/af_mctp.c
b/net/mctp/af_mctp.c
index dd895617defd37f1c66f33cd05f2893e4c48b82e..9b12ca97f412827c350fe7a03b7a6d365df74826 100644
(file)
--- 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);