提交 23b08260 编写于 作者: M MichelleJin 提交者: David S. Miller

net: ipv6: fix use after free of struct seg6_pernet_data

sdata->tun_src should be freed before sdata is freed
because sdata->tun_src is allocated after sdata allocation.
So, kfree(sdata) and kfree(rcu_dereference_raw(sdata->tun_src)) are
changed code order.

Fixes: f04ed7d2 ("net: ipv6: check return value of rhashtable_init")
Signed-off-by: NMichelleJin <shjy180909@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e4addd4e
......@@ -375,8 +375,8 @@ static int __net_init seg6_net_init(struct net *net)
#ifdef CONFIG_IPV6_SEG6_HMAC
if (seg6_hmac_net_init(net)) {
kfree(sdata);
kfree(rcu_dereference_raw(sdata->tun_src));
kfree(sdata);
return -ENOMEM;
};
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册