Skip to content

Commit 52024cd

Browse files
mkjkuba-moo
authored andcommitted
net: mctp: Set SOCK_RCU_FREE
Bind lookup runs under RCU, so ensure that a socket doesn't go away in the middle of a lookup. Fixes: 833ef3b ("mctp: Populate socket implementation") Signed-off-by: Matt Johnston <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f3fdd4f commit 52024cd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/mctp/af_mctp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ static int mctp_sk_hash(struct sock *sk)
630630
{
631631
struct net *net = sock_net(sk);
632632

633+
/* Bind lookup runs under RCU, remain live during that. */
634+
sock_set_flag(sk, SOCK_RCU_FREE);
635+
633636
mutex_lock(&net->mctp.bind_lock);
634637
sk_add_node_rcu(sk, &net->mctp.binds);
635638
mutex_unlock(&net->mctp.bind_lock);

0 commit comments

Comments
 (0)