diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-04-26 06:15:27 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-04-26 06:15:27 -0400 |
| commit | 25f73891c3059e9ce6ff0a02670aa98baf6cbce9 (patch) | |
| tree | 18a2ef934aa353ca695c3faaa3b7497fea22037a /net | |
| parent | fef6108d4556917c45cd9ba397c1c7597f3990e1 (diff) | |
| parent | 4d5c34ec7b007cfb0771a36996b009f194acbb2f (diff) | |
Merge branch 'master' into upstream-fixes
Diffstat (limited to 'net')
| -rw-r--r-- | net/bridge/netfilter/ebtables.c | 20 | ||||
| -rw-r--r-- | net/core/skbuff.c | 8 | ||||
| -rw-r--r-- | net/core/stream.c | 1 | ||||
| -rw-r--r-- | net/ipv4/netfilter/Kconfig | 2 | ||||
| -rw-r--r-- | net/ipv4/tcp_output.c | 10 | ||||
| -rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 13 | ||||
| -rw-r--r-- | net/llc/llc_input.c | 3 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_core.c | 15 | ||||
| -rw-r--r-- | net/netfilter/nf_conntrack_l3proto_generic.c | 1 | ||||
| -rw-r--r-- | net/netfilter/x_tables.c | 2 | ||||
| -rw-r--r-- | net/sched/act_ipt.c | 5 | ||||
| -rw-r--r-- | net/socket.c | 1 |
12 files changed, 37 insertions, 44 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 84b9af76f0a2..3a13ed643459 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
| @@ -831,7 +831,7 @@ static int translate_table(struct ebt_replace *repl, | |||
| 831 | return -ENOMEM; | 831 | return -ENOMEM; |
| 832 | for_each_possible_cpu(i) { | 832 | for_each_possible_cpu(i) { |
| 833 | newinfo->chainstack[i] = | 833 | newinfo->chainstack[i] = |
| 834 | vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); | 834 | vmalloc(udc_cnt * sizeof(*(newinfo->chainstack[0]))); |
| 835 | if (!newinfo->chainstack[i]) { | 835 | if (!newinfo->chainstack[i]) { |
| 836 | while (i) | 836 | while (i) |
| 837 | vfree(newinfo->chainstack[--i]); | 837 | vfree(newinfo->chainstack[--i]); |
| @@ -841,8 +841,7 @@ static int translate_table(struct ebt_replace *repl, | |||
| 841 | } | 841 | } |
| 842 | } | 842 | } |
| 843 | 843 | ||
| 844 | cl_s = (struct ebt_cl_stack *) | 844 | cl_s = vmalloc(udc_cnt * sizeof(*cl_s)); |
| 845 | vmalloc(udc_cnt * sizeof(struct ebt_cl_stack)); | ||
| 846 | if (!cl_s) | 845 | if (!cl_s) |
| 847 | return -ENOMEM; | 846 | return -ENOMEM; |
| 848 | i = 0; /* the i'th udc */ | 847 | i = 0; /* the i'th udc */ |
| @@ -944,8 +943,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
| 944 | 943 | ||
| 945 | countersize = COUNTER_OFFSET(tmp.nentries) * | 944 | countersize = COUNTER_OFFSET(tmp.nentries) * |
| 946 | (highest_possible_processor_id()+1); | 945 | (highest_possible_processor_id()+1); |
| 947 | newinfo = (struct ebt_table_info *) | 946 | newinfo = vmalloc(sizeof(*newinfo) + countersize); |
| 948 | vmalloc(sizeof(struct ebt_table_info) + countersize); | ||
| 949 | if (!newinfo) | 947 | if (!newinfo) |
| 950 | return -ENOMEM; | 948 | return -ENOMEM; |
| 951 | 949 | ||
| @@ -967,8 +965,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
| 967 | /* the user wants counters back | 965 | /* the user wants counters back |
| 968 | the check on the size is done later, when we have the lock */ | 966 | the check on the size is done later, when we have the lock */ |
| 969 | if (tmp.num_counters) { | 967 | if (tmp.num_counters) { |
| 970 | counterstmp = (struct ebt_counter *) | 968 | counterstmp = vmalloc(tmp.num_counters * sizeof(*counterstmp)); |
| 971 | vmalloc(tmp.num_counters * sizeof(struct ebt_counter)); | ||
| 972 | if (!counterstmp) { | 969 | if (!counterstmp) { |
| 973 | ret = -ENOMEM; | 970 | ret = -ENOMEM; |
| 974 | goto free_entries; | 971 | goto free_entries; |
| @@ -1148,8 +1145,7 @@ int ebt_register_table(struct ebt_table *table) | |||
| 1148 | 1145 | ||
| 1149 | countersize = COUNTER_OFFSET(table->table->nentries) * | 1146 | countersize = COUNTER_OFFSET(table->table->nentries) * |
| 1150 | (highest_possible_processor_id()+1); | 1147 | (highest_possible_processor_id()+1); |
| 1151 | newinfo = (struct ebt_table_info *) | 1148 | newinfo = vmalloc(sizeof(*newinfo) + countersize); |
| 1152 | vmalloc(sizeof(struct ebt_table_info) + countersize); | ||
| 1153 | ret = -ENOMEM; | 1149 | ret = -ENOMEM; |
| 1154 | if (!newinfo) | 1150 | if (!newinfo) |
| 1155 | return -ENOMEM; | 1151 | return -ENOMEM; |
| @@ -1247,8 +1243,7 @@ static int update_counters(void __user *user, unsigned int len) | |||
| 1247 | if (hlp.num_counters == 0) | 1243 | if (hlp.num_counters == 0) |
| 1248 | return -EINVAL; | 1244 | return -EINVAL; |
| 1249 | 1245 | ||
| 1250 | if ( !(tmp = (struct ebt_counter *) | 1246 | if (!(tmp = vmalloc(hlp.num_counters * sizeof(*tmp)))) { |
| 1251 | vmalloc(hlp.num_counters * sizeof(struct ebt_counter))) ){ | ||
| 1252 | MEMPRINT("Update_counters && nomemory\n"); | 1247 | MEMPRINT("Update_counters && nomemory\n"); |
| 1253 | return -ENOMEM; | 1248 | return -ENOMEM; |
| 1254 | } | 1249 | } |
| @@ -1377,8 +1372,7 @@ static int copy_everything_to_user(struct ebt_table *t, void __user *user, | |||
| 1377 | BUGPRINT("Num_counters wrong\n"); | 1372 | BUGPRINT("Num_counters wrong\n"); |
| 1378 | return -EINVAL; | 1373 | return -EINVAL; |
| 1379 | } | 1374 | } |
| 1380 | counterstmp = (struct ebt_counter *) | 1375 | counterstmp = vmalloc(nentries * sizeof(*counterstmp)); |
| 1381 | vmalloc(nentries * sizeof(struct ebt_counter)); | ||
| 1382 | if (!counterstmp) { | 1376 | if (!counterstmp) { |
| 1383 | MEMPRINT("Couldn't copy counters, out of memory\n"); | 1377 | MEMPRINT("Couldn't copy counters, out of memory\n"); |
| 1384 | return -ENOMEM; | 1378 | return -ENOMEM; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 09464fa8d72f..fb3770f9c094 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -112,6 +112,14 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here) | |||
| 112 | BUG(); | 112 | BUG(); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void skb_truesize_bug(struct sk_buff *skb) | ||
| 116 | { | ||
| 117 | printk(KERN_ERR "SKB BUG: Invalid truesize (%u) " | ||
| 118 | "len=%u, sizeof(sk_buff)=%Zd\n", | ||
| 119 | skb->truesize, skb->len, sizeof(struct sk_buff)); | ||
| 120 | } | ||
| 121 | EXPORT_SYMBOL(skb_truesize_bug); | ||
| 122 | |||
| 115 | /* Allocate a new skbuff. We do this ourselves so we can fill in a few | 123 | /* Allocate a new skbuff. We do this ourselves so we can fill in a few |
| 116 | * 'private' fields and also do memory statistics to find all the | 124 | * 'private' fields and also do memory statistics to find all the |
| 117 | * [BEEP] leaks. | 125 | * [BEEP] leaks. |
diff --git a/net/core/stream.c b/net/core/stream.c index 35e25259fd95..e9489696f694 100644 --- a/net/core/stream.c +++ b/net/core/stream.c | |||
| @@ -176,6 +176,7 @@ void sk_stream_rfree(struct sk_buff *skb) | |||
| 176 | { | 176 | { |
| 177 | struct sock *sk = skb->sk; | 177 | struct sock *sk = skb->sk; |
| 178 | 178 | ||
| 179 | skb_truesize_check(skb); | ||
| 179 | atomic_sub(skb->truesize, &sk->sk_rmem_alloc); | 180 | atomic_sub(skb->truesize, &sk->sk_rmem_alloc); |
| 180 | sk->sk_forward_alloc += skb->truesize; | 181 | sk->sk_forward_alloc += skb->truesize; |
| 181 | } | 182 | } |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index c60fd5c4ea1e..3d560dec63ab 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
| @@ -345,7 +345,7 @@ config IP_NF_TARGET_LOG | |||
| 345 | To compile it as a module, choose M here. If unsure, say N. | 345 | To compile it as a module, choose M here. If unsure, say N. |
| 346 | 346 | ||
| 347 | config IP_NF_TARGET_ULOG | 347 | config IP_NF_TARGET_ULOG |
| 348 | tristate "ULOG target support (OBSOLETE)" | 348 | tristate "ULOG target support" |
| 349 | depends on IP_NF_IPTABLES | 349 | depends on IP_NF_IPTABLES |
| 350 | ---help--- | 350 | ---help--- |
| 351 | 351 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 44df1db726a3..a28ae593b976 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -533,6 +533,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss | |||
| 533 | struct tcp_sock *tp = tcp_sk(sk); | 533 | struct tcp_sock *tp = tcp_sk(sk); |
| 534 | struct sk_buff *buff; | 534 | struct sk_buff *buff; |
| 535 | int nsize, old_factor; | 535 | int nsize, old_factor; |
| 536 | int nlen; | ||
| 536 | u16 flags; | 537 | u16 flags; |
| 537 | 538 | ||
| 538 | BUG_ON(len > skb->len); | 539 | BUG_ON(len > skb->len); |
| @@ -552,8 +553,10 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss | |||
| 552 | if (buff == NULL) | 553 | if (buff == NULL) |
| 553 | return -ENOMEM; /* We'll just try again later. */ | 554 | return -ENOMEM; /* We'll just try again later. */ |
| 554 | 555 | ||
| 555 | buff->truesize = skb->len - len; | 556 | sk_charge_skb(sk, buff); |
| 556 | skb->truesize -= buff->truesize; | 557 | nlen = skb->len - len - nsize; |
| 558 | buff->truesize += nlen; | ||
| 559 | skb->truesize -= nlen; | ||
| 557 | 560 | ||
| 558 | /* Correct the sequence numbers. */ | 561 | /* Correct the sequence numbers. */ |
| 559 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; | 562 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; |
| @@ -1039,7 +1042,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, | |||
| 1039 | if (unlikely(buff == NULL)) | 1042 | if (unlikely(buff == NULL)) |
| 1040 | return -ENOMEM; | 1043 | return -ENOMEM; |
| 1041 | 1044 | ||
| 1042 | buff->truesize = nlen; | 1045 | sk_charge_skb(sk, buff); |
| 1046 | buff->truesize += nlen; | ||
| 1043 | skb->truesize -= nlen; | 1047 | skb->truesize -= nlen; |
| 1044 | 1048 | ||
| 1045 | /* Correct the sequence numbers. */ | 1049 | /* Correct the sequence numbers. */ |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 642b4b11464f..0a673038344f 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
| @@ -288,19 +288,6 @@ ip6t_do_table(struct sk_buff **pskb, | |||
| 288 | table_base = (void *)private->entries[smp_processor_id()]; | 288 | table_base = (void *)private->entries[smp_processor_id()]; |
| 289 | e = get_entry(table_base, private->hook_entry[hook]); | 289 | e = get_entry(table_base, private->hook_entry[hook]); |
| 290 | 290 | ||
| 291 | #ifdef CONFIG_NETFILTER_DEBUG | ||
| 292 | /* Check noone else using our table */ | ||
| 293 | if (((struct ip6t_entry *)table_base)->comefrom != 0xdead57ac | ||
| 294 | && ((struct ip6t_entry *)table_base)->comefrom != 0xeeeeeeec) { | ||
| 295 | printk("ASSERT: CPU #%u, %s comefrom(%p) = %X\n", | ||
| 296 | smp_processor_id(), | ||
| 297 | table->name, | ||
| 298 | &((struct ip6t_entry *)table_base)->comefrom, | ||
| 299 | ((struct ip6t_entry *)table_base)->comefrom); | ||
| 300 | } | ||
| 301 | ((struct ip6t_entry *)table_base)->comefrom = 0x57acc001; | ||
| 302 | #endif | ||
| 303 | |||
| 304 | /* For return from builtin chain */ | 291 | /* For return from builtin chain */ |
| 305 | back = get_entry(table_base, private->underflow[hook]); | 292 | back = get_entry(table_base, private->underflow[hook]); |
| 306 | 293 | ||
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index 8f3addf0724c..d62e0f9b9da3 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c | |||
| @@ -118,7 +118,8 @@ static inline int llc_fixup_skb(struct sk_buff *skb) | |||
| 118 | u16 pdulen = eth_hdr(skb)->h_proto, | 118 | u16 pdulen = eth_hdr(skb)->h_proto, |
| 119 | data_size = ntohs(pdulen) - llc_len; | 119 | data_size = ntohs(pdulen) - llc_len; |
| 120 | 120 | ||
| 121 | skb_trim(skb, data_size); | 121 | if (unlikely(pskb_trim_rcsum(skb, data_size))) |
| 122 | return 0; | ||
| 122 | } | 123 | } |
| 123 | return 1; | 124 | return 1; |
| 124 | } | 125 | } |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index e581190fb6c3..f9b83f91371a 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -178,9 +178,6 @@ static struct { | |||
| 178 | /* allocated slab cache + modules which uses this slab cache */ | 178 | /* allocated slab cache + modules which uses this slab cache */ |
| 179 | int use; | 179 | int use; |
| 180 | 180 | ||
| 181 | /* Initialization */ | ||
| 182 | int (*init_conntrack)(struct nf_conn *, u_int32_t); | ||
| 183 | |||
| 184 | } nf_ct_cache[NF_CT_F_NUM]; | 181 | } nf_ct_cache[NF_CT_F_NUM]; |
| 185 | 182 | ||
| 186 | /* protect members of nf_ct_cache except of "use" */ | 183 | /* protect members of nf_ct_cache except of "use" */ |
| @@ -208,10 +205,8 @@ nf_ct_proto_find_get(u_int16_t l3proto, u_int8_t protocol) | |||
| 208 | 205 | ||
| 209 | preempt_disable(); | 206 | preempt_disable(); |
| 210 | p = __nf_ct_proto_find(l3proto, protocol); | 207 | p = __nf_ct_proto_find(l3proto, protocol); |
| 211 | if (p) { | 208 | if (!try_module_get(p->me)) |
| 212 | if (!try_module_get(p->me)) | 209 | p = &nf_conntrack_generic_protocol; |
| 213 | p = &nf_conntrack_generic_protocol; | ||
| 214 | } | ||
| 215 | preempt_enable(); | 210 | preempt_enable(); |
| 216 | 211 | ||
| 217 | return p; | 212 | return p; |
| @@ -229,10 +224,8 @@ nf_ct_l3proto_find_get(u_int16_t l3proto) | |||
| 229 | 224 | ||
| 230 | preempt_disable(); | 225 | preempt_disable(); |
| 231 | p = __nf_ct_l3proto_find(l3proto); | 226 | p = __nf_ct_l3proto_find(l3proto); |
| 232 | if (p) { | 227 | if (!try_module_get(p->me)) |
| 233 | if (!try_module_get(p->me)) | 228 | p = &nf_conntrack_generic_l3proto; |
| 234 | p = &nf_conntrack_generic_l3proto; | ||
| 235 | } | ||
| 236 | preempt_enable(); | 229 | preempt_enable(); |
| 237 | 230 | ||
| 238 | return p; | 231 | return p; |
diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c index 7de4f06c63c5..3fc58e454d4e 100644 --- a/net/netfilter/nf_conntrack_l3proto_generic.c +++ b/net/netfilter/nf_conntrack_l3proto_generic.c | |||
| @@ -94,5 +94,4 @@ struct nf_conntrack_l3proto nf_conntrack_generic_l3proto = { | |||
| 94 | .print_conntrack = generic_print_conntrack, | 94 | .print_conntrack = generic_print_conntrack, |
| 95 | .prepare = generic_prepare, | 95 | .prepare = generic_prepare, |
| 96 | .get_features = generic_get_features, | 96 | .get_features = generic_get_features, |
| 97 | .me = THIS_MODULE, | ||
| 98 | }; | 97 | }; |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 00cf0a4f4d92..17abf60f9570 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
| @@ -529,6 +529,7 @@ int xt_register_table(struct xt_table *table, | |||
| 529 | 529 | ||
| 530 | /* Simplifies replace_table code. */ | 530 | /* Simplifies replace_table code. */ |
| 531 | table->private = bootstrap; | 531 | table->private = bootstrap; |
| 532 | rwlock_init(&table->lock); | ||
| 532 | if (!xt_replace_table(table, 0, newinfo, &ret)) | 533 | if (!xt_replace_table(table, 0, newinfo, &ret)) |
| 533 | goto unlock; | 534 | goto unlock; |
| 534 | 535 | ||
| @@ -538,7 +539,6 @@ int xt_register_table(struct xt_table *table, | |||
| 538 | /* save number of initial entries */ | 539 | /* save number of initial entries */ |
| 539 | private->initial_entries = private->number; | 540 | private->initial_entries = private->number; |
| 540 | 541 | ||
| 541 | rwlock_init(&table->lock); | ||
| 542 | list_prepend(&xt[table->af].tables, table); | 542 | list_prepend(&xt[table->af].tables, table); |
| 543 | 543 | ||
| 544 | ret = 0; | 544 | ret = 0; |
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 6056d20ef429..37640c6fc014 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c | |||
| @@ -69,6 +69,11 @@ ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int hook) | |||
| 69 | DPRINTK("ipt_init_target: found %s\n", target->name); | 69 | DPRINTK("ipt_init_target: found %s\n", target->name); |
| 70 | t->u.kernel.target = target; | 70 | t->u.kernel.target = target; |
| 71 | 71 | ||
| 72 | ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t), | ||
| 73 | table, hook, 0, 0); | ||
| 74 | if (ret) | ||
| 75 | return ret; | ||
| 76 | |||
| 72 | if (t->u.kernel.target->checkentry | 77 | if (t->u.kernel.target->checkentry |
| 73 | && !t->u.kernel.target->checkentry(table, NULL, | 78 | && !t->u.kernel.target->checkentry(table, NULL, |
| 74 | t->u.kernel.target, t->data, | 79 | t->u.kernel.target, t->data, |
diff --git a/net/socket.c b/net/socket.c index 23898f45f713..0ce12dfc7a71 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -490,6 +490,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) | |||
| 490 | struct file *file; | 490 | struct file *file; |
| 491 | struct socket *sock; | 491 | struct socket *sock; |
| 492 | 492 | ||
| 493 | *err = -EBADF; | ||
| 493 | file = fget_light(fd, fput_needed); | 494 | file = fget_light(fd, fput_needed); |
| 494 | if (file) { | 495 | if (file) { |
| 495 | sock = sock_from_file(file, err); | 496 | sock = sock_from_file(file, err); |
