]> git.itanic.dy.fi Git - linux-stable/commit
net: mctp: mark socks as dead on unhash, prevent re-add
authorJeremy Kerr <jk@codeconstruct.com.au>
Tue, 24 Jan 2023 02:01:06 +0000 (10:01 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Jan 2023 13:07:37 +0000 (13:07 +0000)
commitb98e1a04e27fddfdc808bf46fe78eca30db89ab3
tree0c957d35d98a69293a151f68eae03ed6380bc104
parent6e54ea37e344f145665c2dc3cc534b92529e8de5
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>
net/mctp/af_mctp.c
net/mctp/route.c