mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
ipvs: fix WARNING in __ip_vs_cleanup_batch()
[ Upstream commit3d00c6a0da
] During the initialization of ip_vs_conn_net_init(), if file ip_vs_conn or ip_vs_conn_sync fails to be created, the initialization is successful by default. Therefore, the ip_vs_conn or ip_vs_conn_sync file doesn't be found during the remove. The following is the stack information: name 'ip_vs_conn_sync' WARNING: CPU: 3 PID: 9 at fs/proc/generic.c:712 remove_proc_entry+0x389/0x460 Modules linked in: Workqueue: netns cleanup_net RIP: 0010:remove_proc_entry+0x389/0x460 Call Trace: <TASK> __ip_vs_cleanup_batch+0x7d/0x120 ops_exit_list+0x125/0x170 cleanup_net+0x4ea/0xb00 process_one_work+0x9bf/0x1710 worker_thread+0x665/0x1080 kthread+0x2e4/0x3a0 ret_from_fork+0x1f/0x30 </TASK> Fixes:61b1ab4583
("IPVS: netns, add basic init per netns.") Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2cc523978f
commit
7effc4ce3d
1 changed files with 21 additions and 5 deletions
|
@ -1373,20 +1373,36 @@ int __net_init ip_vs_conn_net_init(struct netns_ipvs *ipvs)
|
|||
{
|
||||
atomic_set(&ipvs->conn_count, 0);
|
||||
|
||||
proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
|
||||
&ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state));
|
||||
proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
|
||||
&ip_vs_conn_sync_seq_ops,
|
||||
sizeof(struct ip_vs_iter_state));
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if (!proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net,
|
||||
&ip_vs_conn_seq_ops,
|
||||
sizeof(struct ip_vs_iter_state)))
|
||||
goto err_conn;
|
||||
|
||||
if (!proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net,
|
||||
&ip_vs_conn_sync_seq_ops,
|
||||
sizeof(struct ip_vs_iter_state)))
|
||||
goto err_conn_sync;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
err_conn_sync:
|
||||
remove_proc_entry("ip_vs_conn", ipvs->net->proc_net);
|
||||
err_conn:
|
||||
return -ENOMEM;
|
||||
#endif
|
||||
}
|
||||
|
||||
void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs)
|
||||
{
|
||||
/* flush all the connection entries first */
|
||||
ip_vs_conn_flush(ipvs);
|
||||
#ifdef CONFIG_PROC_FS
|
||||
remove_proc_entry("ip_vs_conn", ipvs->net->proc_net);
|
||||
remove_proc_entry("ip_vs_conn_sync", ipvs->net->proc_net);
|
||||
#endif
|
||||
}
|
||||
|
||||
int __init ip_vs_conn_init(void)
|
||||
|
|
Loading…
Reference in a new issue