Skip to content

Commit 5663ed6

Browse files
zhengchaoshaoummakynes
authored andcommitted
ipvs: fix WARNING in ip_vs_app_net_cleanup()
During the initialization of ip_vs_app_net_init(), if file ip_vs_app fails to be created, the initialization is successful by default. Therefore, the ip_vs_app file doesn't be found during the remove in ip_vs_app_net_cleanup(). It will cause WRNING. The following is the stack information: name 'ip_vs_app' WARNING: CPU: 1 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> 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: 457c4cb ("[NET]: Make /proc/net per network namespace") Signed-off-by: Zhengchao Shao <[email protected]> Acked-by: Julian Anastasov <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 3d00c6a commit 5663ed6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

net/netfilter/ipvs/ip_vs_app.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,19 @@ static const struct seq_operations ip_vs_app_seq_ops = {
599599
int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs)
600600
{
601601
INIT_LIST_HEAD(&ipvs->app_list);
602-
proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops,
603-
sizeof(struct seq_net_private));
602+
#ifdef CONFIG_PROC_FS
603+
if (!proc_create_net("ip_vs_app", 0, ipvs->net->proc_net,
604+
&ip_vs_app_seq_ops,
605+
sizeof(struct seq_net_private)))
606+
return -ENOMEM;
607+
#endif
604608
return 0;
605609
}
606610

607611
void __net_exit ip_vs_app_net_cleanup(struct netns_ipvs *ipvs)
608612
{
609613
unregister_ip_vs_app(ipvs, NULL /* all */);
614+
#ifdef CONFIG_PROC_FS
610615
remove_proc_entry("ip_vs_app", ipvs->net->proc_net);
616+
#endif
611617
}

0 commit comments

Comments
 (0)