Commit 69983cab authored by Florian Westphal's avatar Florian Westphal Committed by Kleber Sacilotto de Souza

xfrm: free skb if nlsk pointer is NULL

BugLink: https://bugs.launchpad.net/bugs/1792392

[ Upstream commit 86126b77 ]

nlmsg_multicast() always frees the skb, so in case we cannot call
it we must do that ourselves.

Fixes: 21ee543e ("xfrm: fix race between netns cleanup and state expire notification")
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent d775af24
......@@ -980,10 +980,12 @@ static inline int xfrm_nlmsg_multicast(struct net *net, struct sk_buff *skb,
{
struct sock *nlsk = rcu_dereference(net->xfrm.nlsk);
if (nlsk)
return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC);
else
return -1;
if (!nlsk) {
kfree_skb(skb);
return -EPIPE;
}
return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC);
}
static inline size_t xfrm_spdinfo_msgsize(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment