ip_conntrack: Fix cleanup path when sysctl registration fails
Subsystems (2)
PATCH 1/1 ip_conntrack: Fix cleanup path when sysctl registration fails
Name: Fix cleanup path when sysctl registration fails
Status: Tested under nfsim
Signed-off-by Rusty Russell <[email protected]>
nfsim gains sysctl support, and sure enough, --failtest uncovered an unregister when the registration had failed.
net/ipv4/netfilter/ip_conntrack_standalone.c +3 -1
@@ -791,7 +791,8 @@ ip_ct_sysctl_header =register_sysctl_table (ip_ct_net_table,0 );if (ip_ct_sysctl_header ==NULL ) {printk ("ip_conntrack: can't register to sysctl.\n" ); - goto cleanup; + ret = -ENOMEM ; + goto cleanup_localinops; }#endif
@@ -800,6 +801,7 @@ cleanup: #ifdef CONFIG_SYSCTLunregister_sysctl_table (ip_ct_sysctl_header ); + cleanup_localinops: #endifnf_unregister_hook (&ip_conntrack_local_in_ops); cleanup_inoutandlocalops:
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman