From: Rusty Russell Peejix's nfsim test for ipt_recent, written two days ago, revealed this bugs with ipt_recent: checkentry() returns true or false, not an error. (Maybe it should, but that's a much larger change). Also, make hash_func() static. Signed-off-by: Rusty Russell Signed-off-by: Andrew Morton --- 25-akpm/net/ipv4/netfilter/ipt_recent.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff -puN net/ipv4/netfilter/ipt_recent.c~netfilter-fix-return-values-of-ipt_recent-checkentry net/ipv4/netfilter/ipt_recent.c --- 25/net/ipv4/netfilter/ipt_recent.c~netfilter-fix-return-values-of-ipt_recent-checkentry 2004-12-31 03:55:54.957305600 -0800 +++ 25-akpm/net/ipv4/netfilter/ipt_recent.c 2004-12-31 03:55:54.962304840 -0800 @@ -107,7 +107,7 @@ match(const struct sk_buff *skb, int *hotdrop); /* Function to hash a given address into the hash table of table_size size */ -int hash_func(unsigned int addr, int table_size) +static int hash_func(unsigned int addr, int table_size) { int result = 0; unsigned int value = addr; @@ -713,7 +713,7 @@ checkentry(const char *tablename, #endif curr_table = vmalloc(sizeof(struct recent_ip_tables)); - if(curr_table == NULL) return -ENOMEM; + if(curr_table == NULL) return 0; spin_lock_init(&curr_table->list_lock); curr_table->next = NULL; @@ -730,7 +730,7 @@ checkentry(const char *tablename, #endif curr_table->table = vmalloc(sizeof(struct recent_ip_list)*ip_list_tot); - if(curr_table->table == NULL) { vfree(curr_table); return -ENOMEM; } + if(curr_table->table == NULL) { vfree(curr_table); return 0; } memset(curr_table->table,0,sizeof(struct recent_ip_list)*ip_list_tot); #ifdef DEBUG if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for pkt_list.\n", @@ -745,7 +745,7 @@ checkentry(const char *tablename, printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for pkt_list.\n"); vfree(curr_table->table); vfree(curr_table); - return -ENOMEM; + return 0; } for(c = 0; c < ip_list_tot; c++) { curr_table->table[c].last_pkts = hold + c*ip_pkt_list_tot; @@ -763,7 +763,7 @@ checkentry(const char *tablename, vfree(hold); vfree(curr_table->table); vfree(curr_table); - return -ENOMEM; + return 0; } for(c = 0; c < ip_list_hash_size; c++) { @@ -783,7 +783,7 @@ checkentry(const char *tablename, vfree(hold); vfree(curr_table->table); vfree(curr_table); - return -ENOMEM; + return 0; } for(c = 0; c < ip_list_tot; c++) { curr_table->time_info[c].position = c; @@ -827,7 +827,7 @@ checkentry(const char *tablename, if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, no tables.\n"); #endif spin_unlock_bh(&recent_lock); - return -ENOMEM; + return 0; } while( strncmp(info->name,curr_table->name,IPT_RECENT_NAME_LEN) && (last_table = curr_table) && (curr_table = curr_table->next) ); if(!curr_table) { @@ -835,7 +835,7 @@ checkentry(const char *tablename, if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, table already destroyed.\n"); #endif spin_unlock_bh(&recent_lock); - return -ENOMEM; + return 0; } if(last_table) last_table->next = curr_table->next; else r_tables = curr_table->next; spin_unlock_bh(&recent_lock); @@ -844,7 +844,7 @@ checkentry(const char *tablename, vfree(hold); vfree(curr_table->table); vfree(curr_table); - return -ENOMEM; + return 0; } curr_table->status_proc->owner = THIS_MODULE; _