diff options
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_input.c | 3 | ||||
-rw-r--r-- | net/bridge/br_netfilter.c | 13 | ||||
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 38 |
3 files changed, 27 insertions, 27 deletions
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index b7766562d72c..b0b7f55c1edd 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -125,9 +125,6 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb) | |||
125 | struct sk_buff *skb = *pskb; | 125 | struct sk_buff *skb = *pskb; |
126 | const unsigned char *dest = eth_hdr(skb)->h_dest; | 126 | const unsigned char *dest = eth_hdr(skb)->h_dest; |
127 | 127 | ||
128 | if (p->state == BR_STATE_DISABLED) | ||
129 | goto err; | ||
130 | |||
131 | if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) | 128 | if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) |
132 | goto err; | 129 | goto err; |
133 | 130 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index f29450b788be..3da9264449f7 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -765,6 +765,15 @@ out: | |||
765 | return NF_STOLEN; | 765 | return NF_STOLEN; |
766 | } | 766 | } |
767 | 767 | ||
768 | static int br_nf_dev_queue_xmit(struct sk_buff *skb) | ||
769 | { | ||
770 | if (skb->protocol == htons(ETH_P_IP) && | ||
771 | skb->len > skb->dev->mtu && | ||
772 | !(skb_shinfo(skb)->ufo_size || skb_shinfo(skb)->tso_size)) | ||
773 | return ip_fragment(skb, br_dev_queue_push_xmit); | ||
774 | else | ||
775 | return br_dev_queue_push_xmit(skb); | ||
776 | } | ||
768 | 777 | ||
769 | /* PF_BRIDGE/POST_ROUTING ********************************************/ | 778 | /* PF_BRIDGE/POST_ROUTING ********************************************/ |
770 | static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | 779 | static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, |
@@ -824,7 +833,7 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | |||
824 | realoutdev = nf_bridge->netoutdev; | 833 | realoutdev = nf_bridge->netoutdev; |
825 | #endif | 834 | #endif |
826 | NF_HOOK(pf, NF_IP_POST_ROUTING, skb, NULL, realoutdev, | 835 | NF_HOOK(pf, NF_IP_POST_ROUTING, skb, NULL, realoutdev, |
827 | br_dev_queue_push_xmit); | 836 | br_nf_dev_queue_xmit); |
828 | 837 | ||
829 | return NF_STOLEN; | 838 | return NF_STOLEN; |
830 | 839 | ||
@@ -869,7 +878,7 @@ static unsigned int ip_sabotage_out(unsigned int hook, struct sk_buff **pskb, | |||
869 | 878 | ||
870 | if ((out->hard_start_xmit == br_dev_xmit && | 879 | if ((out->hard_start_xmit == br_dev_xmit && |
871 | okfn != br_nf_forward_finish && | 880 | okfn != br_nf_forward_finish && |
872 | okfn != br_nf_local_out_finish && okfn != br_dev_queue_push_xmit) | 881 | okfn != br_nf_local_out_finish && okfn != br_nf_dev_queue_xmit) |
873 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 882 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
874 | || ((out->priv_flags & IFF_802_1Q_VLAN) && | 883 | || ((out->priv_flags & IFF_802_1Q_VLAN) && |
875 | VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit) | 884 | VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit) |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 01eae97c53d9..3a13ed643459 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -824,14 +824,14 @@ static int translate_table(struct ebt_replace *repl, | |||
824 | if (udc_cnt) { | 824 | if (udc_cnt) { |
825 | /* this will get free'd in do_replace()/ebt_register_table() | 825 | /* this will get free'd in do_replace()/ebt_register_table() |
826 | if an error occurs */ | 826 | if an error occurs */ |
827 | newinfo->chainstack = (struct ebt_chainstack **) | 827 | newinfo->chainstack = |
828 | vmalloc((highest_possible_processor_id()+1) | 828 | vmalloc((highest_possible_processor_id()+1) |
829 | * sizeof(struct ebt_chainstack)); | 829 | * sizeof(*(newinfo->chainstack))); |
830 | if (!newinfo->chainstack) | 830 | if (!newinfo->chainstack) |
831 | return -ENOMEM; | 831 | return -ENOMEM; |
832 | for_each_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 */ |
@@ -901,7 +900,7 @@ static void get_counters(struct ebt_counter *oldcounters, | |||
901 | sizeof(struct ebt_counter) * nentries); | 900 | sizeof(struct ebt_counter) * nentries); |
902 | 901 | ||
903 | /* add other counters to those of cpu 0 */ | 902 | /* add other counters to those of cpu 0 */ |
904 | for_each_cpu(cpu) { | 903 | for_each_possible_cpu(cpu) { |
905 | if (cpu == 0) | 904 | if (cpu == 0) |
906 | continue; | 905 | continue; |
907 | counter_base = COUNTER_BASE(oldcounters, nentries, cpu); | 906 | counter_base = COUNTER_BASE(oldcounters, nentries, cpu); |
@@ -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; |
@@ -1036,7 +1033,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
1036 | 1033 | ||
1037 | vfree(table->entries); | 1034 | vfree(table->entries); |
1038 | if (table->chainstack) { | 1035 | if (table->chainstack) { |
1039 | for_each_cpu(i) | 1036 | for_each_possible_cpu(i) |
1040 | vfree(table->chainstack[i]); | 1037 | vfree(table->chainstack[i]); |
1041 | vfree(table->chainstack); | 1038 | vfree(table->chainstack); |
1042 | } | 1039 | } |
@@ -1054,7 +1051,7 @@ free_counterstmp: | |||
1054 | vfree(counterstmp); | 1051 | vfree(counterstmp); |
1055 | /* can be initialized in translate_table() */ | 1052 | /* can be initialized in translate_table() */ |
1056 | if (newinfo->chainstack) { | 1053 | if (newinfo->chainstack) { |
1057 | for_each_cpu(i) | 1054 | for_each_possible_cpu(i) |
1058 | vfree(newinfo->chainstack[i]); | 1055 | vfree(newinfo->chainstack[i]); |
1059 | vfree(newinfo->chainstack); | 1056 | vfree(newinfo->chainstack); |
1060 | } | 1057 | } |
@@ -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; |
@@ -1201,7 +1197,7 @@ free_unlock: | |||
1201 | mutex_unlock(&ebt_mutex); | 1197 | mutex_unlock(&ebt_mutex); |
1202 | free_chainstack: | 1198 | free_chainstack: |
1203 | if (newinfo->chainstack) { | 1199 | if (newinfo->chainstack) { |
1204 | for_each_cpu(i) | 1200 | for_each_possible_cpu(i) |
1205 | vfree(newinfo->chainstack[i]); | 1201 | vfree(newinfo->chainstack[i]); |
1206 | vfree(newinfo->chainstack); | 1202 | vfree(newinfo->chainstack); |
1207 | } | 1203 | } |
@@ -1224,7 +1220,7 @@ void ebt_unregister_table(struct ebt_table *table) | |||
1224 | mutex_unlock(&ebt_mutex); | 1220 | mutex_unlock(&ebt_mutex); |
1225 | vfree(table->private->entries); | 1221 | vfree(table->private->entries); |
1226 | if (table->private->chainstack) { | 1222 | if (table->private->chainstack) { |
1227 | for_each_cpu(i) | 1223 | for_each_possible_cpu(i) |
1228 | vfree(table->private->chainstack[i]); | 1224 | vfree(table->private->chainstack[i]); |
1229 | vfree(table->private->chainstack); | 1225 | vfree(table->private->chainstack); |
1230 | } | 1226 | } |
@@ -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; |