diff options
author | Jeremy Kerr <jk@codeconstruct.com.au> | 2023-01-24 05:01:06 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-01-25 16:07:37 +0300 |
commit | b98e1a04e27fddfdc808bf46fe78eca30db89ab3 (patch) | |
tree | 0c957d35d98a69293a151f68eae03ed6380bc104 /net/mctp/af_mctp.c | |
parent | 6e54ea37e344f145665c2dc3cc534b92529e8de5 (diff) | |
download | linux-b98e1a04e27fddfdc808bf46fe78eca30db89ab3.tar.xz |
net: mctp: mark socks as dead on unhash, prevent re-add
Once a socket has been unhashed, we want to prevent it from being
re-used in a sk_key entry as part of a routing operation.
This change marks the sk as SOCK_DEAD on unhash, which prevents addition
into the net's key list.
We need to do this during the key add path, rather than key lookup, as
we release the net keys_lock between those operations.
Fixes: 4a992bbd3650 ("mctp: Implement message fragmentation & reassembly")
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mctp/af_mctp.c')
-rw-r--r-- | net/mctp/af_mctp.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c index fb6ae3110528..45bbe3e54cc2 100644 --- a/net/mctp/af_mctp.c +++ b/net/mctp/af_mctp.c @@ -577,6 +577,7 @@ static void mctp_sk_unhash(struct sock *sk) spin_lock_irqsave(&key->lock, fl2); __mctp_key_remove(key, net, fl2, MCTP_TRACE_KEY_CLOSED); } + sock_set_flag(sk, SOCK_DEAD); spin_unlock_irqrestore(&net->mctp.keys_lock, flags); /* Since there are no more tag allocations (we have removed all of the |