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

net: ipv6: check return value of rhashtable_init

When rhashtable_init() fails, it returns -EINVAL.
However, since error return value of rhashtable_init is not checked,
it can cause use of uninitialized pointers.
So, fix unhandled errors of rhashtable_init.
Signed-off-by: NMichelleJin <shjy180909@gmail.com>
Reviewed-by: NDavid Ahern <dsahern@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d7cade51
......@@ -610,7 +610,11 @@ int ila_xlat_init_net(struct net *net)
if (err)
return err;
rhashtable_init(&ilan->xlat.rhash_table, &rht_params);
err = rhashtable_init(&ilan->xlat.rhash_table, &rht_params);
if (err) {
free_bucket_spinlocks(ilan->xlat.locks);
return err;
}
return 0;
}
......
......@@ -374,7 +374,11 @@ static int __net_init seg6_net_init(struct net *net)
net->ipv6.seg6_data = sdata;
#ifdef CONFIG_IPV6_SEG6_HMAC
seg6_hmac_net_init(net);
if (seg6_hmac_net_init(net)) {
kfree(sdata);
kfree(rcu_dereference_raw(sdata->tun_src));
return -ENOMEM;
};
#endif
return 0;
......@@ -388,7 +392,7 @@ static void __net_exit seg6_net_exit(struct net *net)
seg6_hmac_net_exit(net);
#endif
kfree(sdata->tun_src);
kfree(rcu_dereference_raw(sdata->tun_src));
kfree(sdata);
}
......
......@@ -405,9 +405,7 @@ int __net_init seg6_hmac_net_init(struct net *net)
{
struct seg6_pernet_data *sdata = seg6_pernet(net);
rhashtable_init(&sdata->hmac_infos, &rht_params);
return 0;
return rhashtable_init(&sdata->hmac_infos, &rht_params);
}
EXPORT_SYMBOL(seg6_hmac_net_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册