Skip to content

Commit ba953a9

Browse files
herbertxklassert
authored andcommitted
af_key: Do not call xfrm_probe_algs in parallel
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: 283bc9f ("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>
1 parent 6aa811a commit ba953a9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/key/af_key.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,9 +1697,12 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad
16971697
pfk->registered |= (1<<hdr->sadb_msg_satype);
16981698
}
16991699

1700+
mutex_lock(&pfkey_mutex);
17001701
xfrm_probe_algs();
17011702

17021703
supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
1704+
mutex_unlock(&pfkey_mutex);
1705+
17031706
if (!supp_skb) {
17041707
if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)
17051708
pfk->registered &= ~(1<<hdr->sadb_msg_satype);

0 commit comments

Comments
 (0)