af_key: Do not call xfrm_probe_algs in parallel
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 4 Aug 2022 10:03:46 +0000 (18:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 08:23:54 +0000 (10:23 +0200)
commite580d3201ed222c4752ced7e629ad96bc0340713
tree3228043df0895f978d5977f84a017cf76bddd60c
parent18e6b6e2555c93f5ca09f2b85ef1fa025c8accea
af_key: Do not call xfrm_probe_algs in parallel

[ Upstream commit ba953a9d89a00c078b85f4b190bc1dde66fe16b5 ]

When namespace support was added to xfrm/afkey, it caused the
previously single-threaded call to xfrm_probe_algs to become
multi-threaded.  This is buggy and needs to be fixed with a mutex.

Reported-by: Abhishek Shah <abhishek.shah@columbia.edu>
Fixes: 283bc9f35bbb ("xfrm: Namespacify xfrm state/policy locks")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/key/af_key.c