Commit 8f559333 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Fix cleanup path when sysctl registration fails

nfsim gains sysctl support, and sure enough, --failtest uncovered an
unregister when the registration had failed.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7e00d78d
...@@ -791,7 +791,8 @@ static int init_or_cleanup(int init) ...@@ -791,7 +791,8 @@ static int init_or_cleanup(int init)
ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0); ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0);
if (ip_ct_sysctl_header == NULL) { if (ip_ct_sysctl_header == NULL) {
printk("ip_conntrack: can't register to sysctl.\n"); printk("ip_conntrack: can't register to sysctl.\n");
goto cleanup; ret = -ENOMEM;
goto cleanup_localinops;
} }
#endif #endif
...@@ -800,6 +801,7 @@ static int init_or_cleanup(int init) ...@@ -800,6 +801,7 @@ static int init_or_cleanup(int init)
cleanup: cleanup:
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
unregister_sysctl_table(ip_ct_sysctl_header); unregister_sysctl_table(ip_ct_sysctl_header);
cleanup_localinops:
#endif #endif
nf_unregister_hook(&ip_conntrack_local_in_ops); nf_unregister_hook(&ip_conntrack_local_in_ops);
cleanup_inoutandlocalops: cleanup_inoutandlocalops:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment