tag rc6
[openwrt/svn-archive/openwrt.git] / target / linux / linux-2.4 / patches / generic / 214-net-ipv4-netfilter-ip_recent-last_pkts.patch
1 From: David S. Miller <davem@davemloft.net>
2 Date: Thu, 16 Jun 2005 03:51:14 +0000 (-0700)
3 Subject: [NETFILTER]: ipt_recent: last_pkts is an array of "unsigned long" not "u_int32_t"
4 X-Git-Tag: v2.6.12
5 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/chrisw/lsm-2.6.git;a=commitdiff;h=bcfff0b471a60df350338bcd727fc9b8a6aa54b2
6
7 [NETFILTER]: ipt_recent: last_pkts is an array of "unsigned long" not "u_int32_t"
8
9 This fixes various crashes on 64-bit when using this module.
10
11 Based upon a patch by Juergen Kreileder <jk@blackdown.de>.
12
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ACKed-by: Patrick McHardy <kaber@trash.net>
15 ---
16
17 --- a/net/ipv4/netfilter/ipt_recent.c
18 +++ b/net/ipv4/netfilter/ipt_recent.c
19 @@ -223,7 +223,7 @@ static int ip_recent_ctrl(struct file *f
20 curr_table->table[count].last_seen = 0;
21 curr_table->table[count].addr = 0;
22 curr_table->table[count].ttl = 0;
23 - memset(curr_table->table[count].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t));
24 + memset(curr_table->table[count].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long));
25 curr_table->table[count].oldest_pkt = 0;
26 curr_table->table[count].time_pos = 0;
27 curr_table->time_info[count].position = count;
28 @@ -502,7 +502,7 @@ match(const struct sk_buff *skb,
29 location = time_info[curr_table->time_pos].position;
30 hash_table[r_list[location].hash_entry] = -1;
31 hash_table[hash_result] = location;
32 - memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t));
33 + memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long));
34 r_list[location].time_pos = curr_table->time_pos;
35 r_list[location].addr = addr;
36 r_list[location].ttl = ttl;
37 @@ -631,7 +631,7 @@ match(const struct sk_buff *skb,
38 r_list[location].last_seen = 0;
39 r_list[location].addr = 0;
40 r_list[location].ttl = 0;
41 - memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(u_int32_t));
42 + memset(r_list[location].last_pkts,0,ip_pkt_list_tot*sizeof(unsigned long));
43 r_list[location].oldest_pkt = 0;
44 ans = !info->invert;
45 }
46 @@ -734,10 +734,10 @@ checkentry(const char *tablename,
47 memset(curr_table->table,0,sizeof(struct recent_ip_list)*ip_list_tot);
48 #ifdef DEBUG
49 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: Allocating %d for pkt_list.\n",
50 - sizeof(u_int32_t)*ip_pkt_list_tot*ip_list_tot);
51 + sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot);
52 #endif
53
54 - hold = vmalloc(sizeof(u_int32_t)*ip_pkt_list_tot*ip_list_tot);
55 + hold = vmalloc(sizeof(unsigned long)*ip_pkt_list_tot*ip_list_tot);
56 #ifdef DEBUG
57 if(debug) printk(KERN_INFO RECENT_NAME ": checkentry: After pkt_list allocation.\n");
58 #endif