netfilter: Fix cleanup in ipt_recent should ipt_registrater_match error
Subsystems (2)
PATCH 1/1 netfilter: Fix cleanup in ipt_recent should ipt_registrater_match error
Name: Fix cleanup in ipt_recent should ipt_registrater_match error
Status: Tested under nfsim
Signed-off-by Rusty Russell <[email protected]>
When ipt_registrater_match() fails, ipt_recent doesn't remove its proc entry. Found by nfsim.
net/ipv4/netfilter/ipt_recent.c +5 -2
@@ -959,7 +959,7 @@/* Kernel module initialization. */ static int __init init (void ) { -int count; +int err, count;printk (version);#ifdef CONFIG_PROC_FS
@@ -983,7 +983,10 @@ if(debug) printk(KERN_INFO RECENT_NAME ": ip_list_hash_size: %d\n",ip_list_hash_size);#endif -return ipt_register_match (&recent_match); + err =ipt_register_match (&recent_match); +if (err) +remove_proc_entry ("ipt_recent" , proc_net); +return err; }/* Kernel module destruction. */
Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman