提交 4d0c27d4 编写于 作者: D Dinghao Liu 提交者: Zheng Zengkai

netfilter: nf_nat: Fix memleak in nf_nat_init

stable inclusion
from stable-5.10.9
commit 88a5c90f39b0f8f4a747f24bb68d8b22d558daa7
bugzilla: 47457

--------------------------------

commit 869f4fda upstream.

When register_pernet_subsys() fails, nf_nat_bysource
should be freed just like when nf_ct_extend_register()
fails.

Fixes: 1cd472bf ("netfilter: nf_nat: add nat hook register functions to nf_nat")
Signed-off-by: NDinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: NFlorian Westphal <fw@strlen.de>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 9eef9a22
......@@ -1174,6 +1174,7 @@ static int __init nf_nat_init(void)
ret = register_pernet_subsys(&nat_net_ops);
if (ret < 0) {
nf_ct_extend_unregister(&nat_extend);
kvfree(nf_nat_bysource);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册