Message ID | 20220824050213.3643599-6-steffen.klassert@secunet.com (mailing list archive) |
---|---|
State | Accepted |
Commit | ba953a9d89a00c078b85f4b190bc1dde66fe16b5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/6] xfrm: fix refcount leak in __xfrm_policy_check() | expand |
diff --git a/net/key/af_key.c b/net/key/af_key.c index fb16d7c4e1b8..20e73643b9c8 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -1697,9 +1697,12 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad pfk->registered |= (1<<hdr->sadb_msg_satype); } + mutex_lock(&pfkey_mutex); xfrm_probe_algs(); supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO); + mutex_unlock(&pfkey_mutex); + if (!supp_skb) { if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC) pfk->registered &= ~(1<<hdr->sadb_msg_satype);