diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-03 08:30:35 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-03 08:30:35 -0400 |
commit | edc4ff7c08e9885c40e60c4fb39fa42cc91a0602 (patch) | |
tree | f375d28043dd4457428a841167dc93d760ba9a46 /net | |
parent | cbb9a56177b16294ed347ba7fcb1c66c8adb5dc4 (diff) | |
parent | e17df688f7064dae1417ce425dd1e4b71d24d63b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'net')
43 files changed, 245 insertions, 141 deletions
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 2d24fb400e0c..56f3aa47e758 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
18 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
19 | #include <linux/if_vlan.h> | ||
19 | #include <linux/netfilter_bridge.h> | 20 | #include <linux/netfilter_bridge.h> |
20 | #include "br_private.h" | 21 | #include "br_private.h" |
21 | 22 | ||
@@ -29,10 +30,15 @@ static inline int should_deliver(const struct net_bridge_port *p, | |||
29 | return 1; | 30 | return 1; |
30 | } | 31 | } |
31 | 32 | ||
33 | static inline unsigned packet_length(const struct sk_buff *skb) | ||
34 | { | ||
35 | return skb->len - (skb->protocol == htons(ETH_P_8021Q) ? VLAN_HLEN : 0); | ||
36 | } | ||
37 | |||
32 | int br_dev_queue_push_xmit(struct sk_buff *skb) | 38 | int br_dev_queue_push_xmit(struct sk_buff *skb) |
33 | { | 39 | { |
34 | /* drop mtu oversized packets except tso */ | 40 | /* drop mtu oversized packets except tso */ |
35 | if (skb->len > skb->dev->mtu && !skb_shinfo(skb)->tso_size) | 41 | if (packet_length(skb) > skb->dev->mtu && !skb_shinfo(skb)->tso_size) |
36 | kfree_skb(skb); | 42 | kfree_skb(skb); |
37 | else { | 43 | else { |
38 | #ifdef CONFIG_BRIDGE_NETFILTER | 44 | #ifdef CONFIG_BRIDGE_NETFILTER |
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/dev.c b/net/core/dev.c index 83231a27ae02..3bad1afc89fa 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2698,7 +2698,8 @@ int dev_ioctl(unsigned int cmd, void __user *arg) | |||
2698 | /* If command is `set a parameter', or | 2698 | /* If command is `set a parameter', or |
2699 | * `get the encoding parameters', check if | 2699 | * `get the encoding parameters', check if |
2700 | * the user has the right to do it */ | 2700 | * the user has the right to do it */ |
2701 | if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE) { | 2701 | if (IW_IS_SET(cmd) || cmd == SIOCGIWENCODE |
2702 | || cmd == SIOCGIWENCODEEXT) { | ||
2702 | if (!capable(CAP_NET_ADMIN)) | 2703 | if (!capable(CAP_NET_ADMIN)) |
2703 | return -EPERM; | 2704 | return -EPERM; |
2704 | } | 2705 | } |
diff --git a/net/core/filter.c b/net/core/filter.c index 93fbd01d2259..5b4486a60cf6 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/timer.h> | 34 | #include <linux/timer.h> |
35 | #include <asm/system.h> | 35 | #include <asm/system.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <asm/unaligned.h> | ||
37 | #include <linux/filter.h> | 38 | #include <linux/filter.h> |
38 | 39 | ||
39 | /* No hurry in this branch */ | 40 | /* No hurry in this branch */ |
@@ -177,7 +178,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int | |||
177 | load_w: | 178 | load_w: |
178 | ptr = load_pointer(skb, k, 4, &tmp); | 179 | ptr = load_pointer(skb, k, 4, &tmp); |
179 | if (ptr != NULL) { | 180 | if (ptr != NULL) { |
180 | A = ntohl(*(u32 *)ptr); | 181 | A = ntohl(get_unaligned((u32 *)ptr)); |
181 | continue; | 182 | continue; |
182 | } | 183 | } |
183 | break; | 184 | break; |
@@ -186,7 +187,7 @@ load_w: | |||
186 | load_h: | 187 | load_h: |
187 | ptr = load_pointer(skb, k, 2, &tmp); | 188 | ptr = load_pointer(skb, k, 2, &tmp); |
188 | if (ptr != NULL) { | 189 | if (ptr != NULL) { |
189 | A = ntohs(*(u16 *)ptr); | 190 | A = ntohs(get_unaligned((u16 *)ptr)); |
190 | continue; | 191 | continue; |
191 | } | 192 | } |
192 | break; | 193 | break; |
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/core/wireless.c b/net/core/wireless.c index 81d6995fcfdb..d2bc72d318f7 100644 --- a/net/core/wireless.c +++ b/net/core/wireless.c | |||
@@ -1726,6 +1726,14 @@ int wireless_rtnetlink_get(struct net_device * dev, | |||
1726 | if(!IW_IS_GET(request->cmd)) | 1726 | if(!IW_IS_GET(request->cmd)) |
1727 | return -EOPNOTSUPP; | 1727 | return -EOPNOTSUPP; |
1728 | 1728 | ||
1729 | /* If command is `get the encoding parameters', check if | ||
1730 | * the user has the right to do it */ | ||
1731 | if (request->cmd == SIOCGIWENCODE || | ||
1732 | request->cmd == SIOCGIWENCODEEXT) { | ||
1733 | if (!capable(CAP_NET_ADMIN)) | ||
1734 | return -EPERM; | ||
1735 | } | ||
1736 | |||
1729 | /* Special cases */ | 1737 | /* Special cases */ |
1730 | if(request->cmd == SIOCGIWSTATS) | 1738 | if(request->cmd == SIOCGIWSTATS) |
1731 | /* Get Wireless Stats */ | 1739 | /* Get Wireless Stats */ |
diff --git a/net/ieee80211/softmac/Kconfig b/net/ieee80211/softmac/Kconfig index 6cd9f3427be6..f2a27cc6ecb1 100644 --- a/net/ieee80211/softmac/Kconfig +++ b/net/ieee80211/softmac/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config IEEE80211_SOFTMAC | 1 | config IEEE80211_SOFTMAC |
2 | tristate "Software MAC add-on to the IEEE 802.11 networking stack" | 2 | tristate "Software MAC add-on to the IEEE 802.11 networking stack" |
3 | depends on IEEE80211 && EXPERIMENTAL | 3 | depends on IEEE80211 && EXPERIMENTAL |
4 | select WIRELESS_EXT | ||
4 | ---help--- | 5 | ---help--- |
5 | This option enables the hardware independent software MAC addon | 6 | This option enables the hardware independent software MAC addon |
6 | for the IEEE 802.11 networking stack. | 7 | for the IEEE 802.11 networking stack. |
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index be61de78dfa4..fb79ce7d6439 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -101,6 +101,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac, u16 reason) | |||
101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ | 101 | /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ |
102 | mac->associated = 0; | 102 | mac->associated = 0; |
103 | mac->associnfo.associating = 0; | 103 | mac->associnfo.associating = 0; |
104 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
104 | spin_unlock_irqrestore(&mac->lock, flags); | 105 | spin_unlock_irqrestore(&mac->lock, flags); |
105 | } | 106 | } |
106 | 107 | ||
@@ -143,6 +144,12 @@ network_matches_request(struct ieee80211softmac_device *mac, struct ieee80211_ne | |||
143 | if (!we_support_all_basic_rates(mac, net->rates_ex, net->rates_ex_len)) | 144 | if (!we_support_all_basic_rates(mac, net->rates_ex, net->rates_ex_len)) |
144 | return 0; | 145 | return 0; |
145 | 146 | ||
147 | /* assume that users know what they're doing ... | ||
148 | * (note we don't let them select a net we're incompatible with) */ | ||
149 | if (mac->associnfo.bssfixed) { | ||
150 | return !memcmp(mac->associnfo.bssid, net->bssid, ETH_ALEN); | ||
151 | } | ||
152 | |||
146 | /* if 'ANY' network requested, take any that doesn't have privacy enabled */ | 153 | /* if 'ANY' network requested, take any that doesn't have privacy enabled */ |
147 | if (mac->associnfo.req_essid.len == 0 | 154 | if (mac->associnfo.req_essid.len == 0 |
148 | && !(net->capability & WLAN_CAPABILITY_PRIVACY)) | 155 | && !(net->capability & WLAN_CAPABILITY_PRIVACY)) |
@@ -175,7 +182,7 @@ ieee80211softmac_assoc_work(void *d) | |||
175 | ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); | 182 | ieee80211softmac_disassoc(mac, WLAN_REASON_DISASSOC_STA_HAS_LEFT); |
176 | 183 | ||
177 | /* try to find the requested network in our list, if we found one already */ | 184 | /* try to find the requested network in our list, if we found one already */ |
178 | if (mac->associnfo.bssvalid) | 185 | if (mac->associnfo.bssvalid || mac->associnfo.bssfixed) |
179 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); | 186 | found = ieee80211softmac_get_network_by_bssid(mac, mac->associnfo.bssid); |
180 | 187 | ||
181 | /* Search the ieee80211 networks for this network if we didn't find it by bssid, | 188 | /* Search the ieee80211 networks for this network if we didn't find it by bssid, |
@@ -240,19 +247,25 @@ ieee80211softmac_assoc_work(void *d) | |||
240 | if (ieee80211softmac_start_scan(mac)) | 247 | if (ieee80211softmac_start_scan(mac)) |
241 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); | 248 | dprintk(KERN_INFO PFX "Associate: failed to initiate scan. Is device up?\n"); |
242 | return; | 249 | return; |
243 | } | 250 | } else { |
244 | else { | ||
245 | spin_lock_irqsave(&mac->lock, flags); | 251 | spin_lock_irqsave(&mac->lock, flags); |
246 | mac->associnfo.associating = 0; | 252 | mac->associnfo.associating = 0; |
247 | mac->associated = 0; | 253 | mac->associated = 0; |
248 | spin_unlock_irqrestore(&mac->lock, flags); | 254 | spin_unlock_irqrestore(&mac->lock, flags); |
249 | 255 | ||
250 | dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); | 256 | dprintk(KERN_INFO PFX "Unable to find matching network after scan!\n"); |
257 | /* reset the retry counter for the next user request since we | ||
258 | * break out and don't reschedule ourselves after this point. */ | ||
259 | mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
251 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); | 260 | ieee80211softmac_call_events(mac, IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND, NULL); |
252 | return; | 261 | return; |
253 | } | 262 | } |
254 | } | 263 | } |
255 | 264 | ||
265 | /* reset the retry counter for the next user request since we | ||
266 | * now found a net and will try to associate to it, but not | ||
267 | * schedule this function again. */ | ||
268 | mac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
256 | mac->associnfo.bssvalid = 1; | 269 | mac->associnfo.bssvalid = 1; |
257 | memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); | 270 | memcpy(mac->associnfo.bssid, found->bssid, ETH_ALEN); |
258 | /* copy the ESSID for displaying it */ | 271 | /* copy the ESSID for displaying it */ |
@@ -373,6 +386,7 @@ ieee80211softmac_handle_disassoc(struct net_device * dev, | |||
373 | spin_lock_irqsave(&mac->lock, flags); | 386 | spin_lock_irqsave(&mac->lock, flags); |
374 | mac->associnfo.bssvalid = 0; | 387 | mac->associnfo.bssvalid = 0; |
375 | mac->associated = 0; | 388 | mac->associated = 0; |
389 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | ||
376 | schedule_work(&mac->associnfo.work); | 390 | schedule_work(&mac->associnfo.work); |
377 | spin_unlock_irqrestore(&mac->lock, flags); | 391 | spin_unlock_irqrestore(&mac->lock, flags); |
378 | 392 | ||
@@ -391,6 +405,7 @@ ieee80211softmac_handle_reassoc_req(struct net_device * dev, | |||
391 | dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); | 405 | dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); |
392 | return 0; | 406 | return 0; |
393 | } | 407 | } |
394 | ieee80211softmac_assoc(mac, network); | 408 | schedule_work(&mac->associnfo.work); |
409 | |||
395 | return 0; | 410 | return 0; |
396 | } | 411 | } |
diff --git a/net/ieee80211/softmac/ieee80211softmac_event.c b/net/ieee80211/softmac/ieee80211softmac_event.c index 0a52bbda1e4c..8cc8f3f0f8e7 100644 --- a/net/ieee80211/softmac/ieee80211softmac_event.c +++ b/net/ieee80211/softmac/ieee80211softmac_event.c | |||
@@ -67,6 +67,7 @@ static char *event_descriptions[IEEE80211SOFTMAC_EVENT_LAST+1] = { | |||
67 | "authenticating failed", | 67 | "authenticating failed", |
68 | "authenticating timed out", | 68 | "authenticating timed out", |
69 | "associating failed because no suitable network was found", | 69 | "associating failed because no suitable network was found", |
70 | "disassociated", | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | 73 | ||
@@ -128,13 +129,42 @@ void | |||
128 | ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) | 129 | ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) |
129 | { | 130 | { |
130 | struct ieee80211softmac_event *eventptr, *tmp; | 131 | struct ieee80211softmac_event *eventptr, *tmp; |
131 | union iwreq_data wrqu; | 132 | struct ieee80211softmac_network *network; |
132 | char *msg; | ||
133 | 133 | ||
134 | if (event >= 0) { | 134 | if (event >= 0) { |
135 | msg = event_descriptions[event]; | 135 | union iwreq_data wrqu; |
136 | wrqu.data.length = strlen(msg); | 136 | int we_event; |
137 | wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); | 137 | char *msg = NULL; |
138 | |||
139 | switch(event) { | ||
140 | case IEEE80211SOFTMAC_EVENT_ASSOCIATED: | ||
141 | network = (struct ieee80211softmac_network *)event_ctx; | ||
142 | wrqu.data.length = 0; | ||
143 | wrqu.data.flags = 0; | ||
144 | memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); | ||
145 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
146 | we_event = SIOCGIWAP; | ||
147 | break; | ||
148 | case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: | ||
149 | wrqu.data.length = 0; | ||
150 | wrqu.data.flags = 0; | ||
151 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
152 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; | ||
153 | we_event = SIOCGIWAP; | ||
154 | break; | ||
155 | case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: | ||
156 | wrqu.data.length = 0; | ||
157 | wrqu.data.flags = 0; | ||
158 | memset(&wrqu, '\0', sizeof (union iwreq_data)); | ||
159 | we_event = SIOCGIWSCAN; | ||
160 | break; | ||
161 | default: | ||
162 | msg = event_descriptions[event]; | ||
163 | wrqu.data.length = strlen(msg); | ||
164 | we_event = IWEVCUSTOM; | ||
165 | break; | ||
166 | } | ||
167 | wireless_send_event(mac->dev, we_event, &wrqu, msg); | ||
138 | } | 168 | } |
139 | 169 | ||
140 | if (!list_empty(&mac->events)) | 170 | if (!list_empty(&mac->events)) |
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index febc51dbb412..cc6cd56c85b1 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c | |||
@@ -180,9 +180,21 @@ ieee80211softmac_assoc_req(struct ieee80211_assoc_request **pkt, | |||
180 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); | 180 | ieee80211softmac_hdr_3addr(mac, &((*pkt)->header), IEEE80211_STYPE_ASSOC_REQ, net->bssid, net->bssid); |
181 | 181 | ||
182 | /* Fill in capability Info */ | 182 | /* Fill in capability Info */ |
183 | (*pkt)->capability = (mac->ieee->iw_mode == IW_MODE_MASTER) || (mac->ieee->iw_mode == IW_MODE_INFRA) ? | 183 | switch (mac->ieee->iw_mode) { |
184 | cpu_to_le16(WLAN_CAPABILITY_ESS) : | 184 | case IW_MODE_INFRA: |
185 | cpu_to_le16(WLAN_CAPABILITY_IBSS); | 185 | (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_ESS); |
186 | break; | ||
187 | case IW_MODE_ADHOC: | ||
188 | (*pkt)->capability = cpu_to_le16(WLAN_CAPABILITY_IBSS); | ||
189 | break; | ||
190 | case IW_MODE_AUTO: | ||
191 | (*pkt)->capability = net->capabilities & (WLAN_CAPABILITY_ESS|WLAN_CAPABILITY_IBSS); | ||
192 | break; | ||
193 | default: | ||
194 | /* bleh. we don't ever go to these modes */ | ||
195 | printk(KERN_ERR PFX "invalid iw_mode!\n"); | ||
196 | break; | ||
197 | } | ||
186 | /* Need to add this | 198 | /* Need to add this |
187 | (*pkt)->capability |= mac->ieee->short_slot ? | 199 | (*pkt)->capability |= mac->ieee->short_slot ? |
188 | cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; | 200 | cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME) : 0; |
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 60f06a31f0d1..be83bdc1644a 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c | |||
@@ -45,6 +45,8 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) | |||
45 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; | 45 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; |
46 | softmac->scaninfo = NULL; | 46 | softmac->scaninfo = NULL; |
47 | 47 | ||
48 | softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
49 | |||
48 | /* TODO: initialise all the other callbacks in the ieee struct | 50 | /* TODO: initialise all the other callbacks in the ieee struct |
49 | * (once they're written) | 51 | * (once they're written) |
50 | */ | 52 | */ |
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index bb9ab8b45d09..2b9e7edfa3ce 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c | |||
@@ -47,6 +47,7 @@ ieee80211softmac_start_scan(struct ieee80211softmac_device *sm) | |||
47 | sm->scanning = 1; | 47 | sm->scanning = 1; |
48 | spin_unlock_irqrestore(&sm->lock, flags); | 48 | spin_unlock_irqrestore(&sm->lock, flags); |
49 | 49 | ||
50 | netif_tx_disable(sm->ieee->dev); | ||
50 | ret = sm->start_scan(sm->dev); | 51 | ret = sm->start_scan(sm->dev); |
51 | if (ret) { | 52 | if (ret) { |
52 | spin_lock_irqsave(&sm->lock, flags); | 53 | spin_lock_irqsave(&sm->lock, flags); |
@@ -239,6 +240,7 @@ void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm) | |||
239 | if (net) | 240 | if (net) |
240 | sm->set_channel(sm->dev, net->channel); | 241 | sm->set_channel(sm->dev, net->channel); |
241 | } | 242 | } |
243 | netif_wake_queue(sm->ieee->dev); | ||
242 | ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); | 244 | ieee80211softmac_call_events(sm, IEEE80211SOFTMAC_EVENT_SCAN_FINISHED, NULL); |
243 | } | 245 | } |
244 | EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); | 246 | EXPORT_SYMBOL_GPL(ieee80211softmac_scan_finished); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index b559aa9b5507..27edb2b5581a 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c | |||
@@ -27,7 +27,8 @@ | |||
27 | #include "ieee80211softmac_priv.h" | 27 | #include "ieee80211softmac_priv.h" |
28 | 28 | ||
29 | #include <net/iw_handler.h> | 29 | #include <net/iw_handler.h> |
30 | 30 | /* for is_broadcast_ether_addr and is_zero_ether_addr */ | |
31 | #include <linux/etherdevice.h> | ||
31 | 32 | ||
32 | int | 33 | int |
33 | ieee80211softmac_wx_trigger_scan(struct net_device *net_dev, | 34 | ieee80211softmac_wx_trigger_scan(struct net_device *net_dev, |
@@ -41,13 +42,23 @@ ieee80211softmac_wx_trigger_scan(struct net_device *net_dev, | |||
41 | EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan); | 42 | EXPORT_SYMBOL_GPL(ieee80211softmac_wx_trigger_scan); |
42 | 43 | ||
43 | 44 | ||
45 | /* if we're still scanning, return -EAGAIN so that userspace tools | ||
46 | * can get the complete scan results, otherwise return 0. */ | ||
44 | int | 47 | int |
45 | ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, | 48 | ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, |
46 | struct iw_request_info *info, | 49 | struct iw_request_info *info, |
47 | union iwreq_data *data, | 50 | union iwreq_data *data, |
48 | char *extra) | 51 | char *extra) |
49 | { | 52 | { |
53 | unsigned long flags; | ||
50 | struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); | 54 | struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); |
55 | |||
56 | spin_lock_irqsave(&sm->lock, flags); | ||
57 | if (sm->scanning) { | ||
58 | spin_unlock_irqrestore(&sm->lock, flags); | ||
59 | return -EAGAIN; | ||
60 | } | ||
61 | spin_unlock_irqrestore(&sm->lock, flags); | ||
51 | return ieee80211_wx_get_scan(sm->ieee, info, data, extra); | 62 | return ieee80211_wx_get_scan(sm->ieee, info, data, extra); |
52 | } | 63 | } |
53 | EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results); | 64 | EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results); |
@@ -73,7 +84,6 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev, | |||
73 | sm->associnfo.static_essid = 1; | 84 | sm->associnfo.static_essid = 1; |
74 | } | 85 | } |
75 | } | 86 | } |
76 | sm->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | ||
77 | 87 | ||
78 | /* set our requested ESSID length. | 88 | /* set our requested ESSID length. |
79 | * If applicable, we have already copied the data in */ | 89 | * If applicable, we have already copied the data in */ |
@@ -300,8 +310,6 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, | |||
300 | char *extra) | 310 | char *extra) |
301 | { | 311 | { |
302 | struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); | 312 | struct ieee80211softmac_device *mac = ieee80211_priv(net_dev); |
303 | static const unsigned char any[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
304 | static const unsigned char off[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
305 | unsigned long flags; | 313 | unsigned long flags; |
306 | 314 | ||
307 | /* sanity check */ | 315 | /* sanity check */ |
@@ -310,10 +318,17 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, | |||
310 | } | 318 | } |
311 | 319 | ||
312 | spin_lock_irqsave(&mac->lock, flags); | 320 | spin_lock_irqsave(&mac->lock, flags); |
313 | if (!memcmp(any, data->ap_addr.sa_data, ETH_ALEN) || | 321 | if (is_broadcast_ether_addr(data->ap_addr.sa_data)) { |
314 | !memcmp(off, data->ap_addr.sa_data, ETH_ALEN)) { | 322 | /* the bssid we have is not to be fixed any longer, |
315 | schedule_work(&mac->associnfo.work); | 323 | * and we should reassociate to the best AP. */ |
316 | goto out; | 324 | mac->associnfo.bssfixed = 0; |
325 | /* force reassociation */ | ||
326 | mac->associnfo.bssvalid = 0; | ||
327 | if (mac->associated) | ||
328 | schedule_work(&mac->associnfo.work); | ||
329 | } else if (is_zero_ether_addr(data->ap_addr.sa_data)) { | ||
330 | /* the bssid we have is no longer fixed */ | ||
331 | mac->associnfo.bssfixed = 0; | ||
317 | } else { | 332 | } else { |
318 | if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { | 333 | if (!memcmp(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN)) { |
319 | if (mac->associnfo.associating || mac->associated) { | 334 | if (mac->associnfo.associating || mac->associated) { |
@@ -323,12 +338,14 @@ ieee80211softmac_wx_set_wap(struct net_device *net_dev, | |||
323 | } else { | 338 | } else { |
324 | /* copy new value in data->ap_addr.sa_data to bssid */ | 339 | /* copy new value in data->ap_addr.sa_data to bssid */ |
325 | memcpy(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN); | 340 | memcpy(mac->associnfo.bssid, data->ap_addr.sa_data, ETH_ALEN); |
326 | } | 341 | } |
342 | /* tell the other code that this bssid should be used no matter what */ | ||
343 | mac->associnfo.bssfixed = 1; | ||
327 | /* queue associate if new bssid or (old one again and not associated) */ | 344 | /* queue associate if new bssid or (old one again and not associated) */ |
328 | schedule_work(&mac->associnfo.work); | 345 | schedule_work(&mac->associnfo.work); |
329 | } | 346 | } |
330 | 347 | ||
331 | out: | 348 | out: |
332 | spin_unlock_irqrestore(&mac->lock, flags); | 349 | spin_unlock_irqrestore(&mac->lock, flags); |
333 | return 0; | 350 | return 0; |
334 | } | 351 | } |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index dc206f1f914f..0a277453526b 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1257,7 +1257,7 @@ out_unregister_udp_proto: | |||
1257 | goto out; | 1257 | goto out; |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | module_init(inet_init); | 1260 | fs_initcall(inet_init); |
1261 | 1261 | ||
1262 | /* ------------------------------------------------------------------------ */ | 1262 | /* ------------------------------------------------------------------------ */ |
1263 | 1263 | ||
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 04a429465665..cd810f41af1a 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -290,11 +290,8 @@ static void ipcomp_free_scratches(void) | |||
290 | if (!scratches) | 290 | if (!scratches) |
291 | return; | 291 | return; |
292 | 292 | ||
293 | for_each_possible_cpu(i) { | 293 | for_each_possible_cpu(i) |
294 | void *scratch = *per_cpu_ptr(scratches, i); | 294 | vfree(*per_cpu_ptr(scratches, i)); |
295 | if (scratch) | ||
296 | vfree(scratch); | ||
297 | } | ||
298 | 295 | ||
299 | free_percpu(scratches); | 296 | free_percpu(scratches); |
300 | } | 297 | } |
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/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index 5259abd0fb42..0416073c5600 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c | |||
@@ -235,12 +235,15 @@ static int do_basic_checks(struct ip_conntrack *conntrack, | |||
235 | flag = 1; | 235 | flag = 1; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Cookie Ack/Echo chunks not the first OR | 238 | /* |
239 | Init / Init Ack / Shutdown compl chunks not the only chunks */ | 239 | * Cookie Ack/Echo chunks not the first OR |
240 | if ((sch->type == SCTP_CID_COOKIE_ACK | 240 | * Init / Init Ack / Shutdown compl chunks not the only chunks |
241 | * OR zero-length. | ||
242 | */ | ||
243 | if (((sch->type == SCTP_CID_COOKIE_ACK | ||
241 | || sch->type == SCTP_CID_COOKIE_ECHO | 244 | || sch->type == SCTP_CID_COOKIE_ECHO |
242 | || flag) | 245 | || flag) |
243 | && count !=0 ) { | 246 | && count !=0) || !sch->length) { |
244 | DEBUGP("Basic checks failed\n"); | 247 | DEBUGP("Basic checks failed\n"); |
245 | return 1; | 248 | return 1; |
246 | } | 249 | } |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index d25ac8ba6eba..6d1c11563943 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -956,15 +956,16 @@ struct compat_ipt_standard_target | |||
956 | compat_int_t verdict; | 956 | compat_int_t verdict; |
957 | }; | 957 | }; |
958 | 958 | ||
959 | #define IPT_ST_OFFSET (sizeof(struct ipt_standard_target) - \ | ||
960 | sizeof(struct compat_ipt_standard_target)) | ||
961 | |||
962 | struct compat_ipt_standard | 959 | struct compat_ipt_standard |
963 | { | 960 | { |
964 | struct compat_ipt_entry entry; | 961 | struct compat_ipt_entry entry; |
965 | struct compat_ipt_standard_target target; | 962 | struct compat_ipt_standard_target target; |
966 | }; | 963 | }; |
967 | 964 | ||
965 | #define IPT_ST_LEN XT_ALIGN(sizeof(struct ipt_standard_target)) | ||
966 | #define IPT_ST_COMPAT_LEN COMPAT_XT_ALIGN(sizeof(struct compat_ipt_standard_target)) | ||
967 | #define IPT_ST_OFFSET (IPT_ST_LEN - IPT_ST_COMPAT_LEN) | ||
968 | |||
968 | static int compat_ipt_standard_fn(void *target, | 969 | static int compat_ipt_standard_fn(void *target, |
969 | void **dstptr, int *size, int convert) | 970 | void **dstptr, int *size, int convert) |
970 | { | 971 | { |
@@ -975,35 +976,29 @@ static int compat_ipt_standard_fn(void *target, | |||
975 | ret = 0; | 976 | ret = 0; |
976 | switch (convert) { | 977 | switch (convert) { |
977 | case COMPAT_TO_USER: | 978 | case COMPAT_TO_USER: |
978 | pst = (struct ipt_standard_target *)target; | 979 | pst = target; |
979 | memcpy(&compat_st.target, &pst->target, | 980 | memcpy(&compat_st.target, &pst->target, |
980 | sizeof(struct ipt_entry_target)); | 981 | sizeof(compat_st.target)); |
981 | compat_st.verdict = pst->verdict; | 982 | compat_st.verdict = pst->verdict; |
982 | if (compat_st.verdict > 0) | 983 | if (compat_st.verdict > 0) |
983 | compat_st.verdict -= | 984 | compat_st.verdict -= |
984 | compat_calc_jump(compat_st.verdict); | 985 | compat_calc_jump(compat_st.verdict); |
985 | compat_st.target.u.user.target_size = | 986 | compat_st.target.u.user.target_size = IPT_ST_COMPAT_LEN; |
986 | sizeof(struct compat_ipt_standard_target); | 987 | if (copy_to_user(*dstptr, &compat_st, IPT_ST_COMPAT_LEN)) |
987 | if (__copy_to_user(*dstptr, &compat_st, | ||
988 | sizeof(struct compat_ipt_standard_target))) | ||
989 | ret = -EFAULT; | 988 | ret = -EFAULT; |
990 | *size -= IPT_ST_OFFSET; | 989 | *size -= IPT_ST_OFFSET; |
991 | *dstptr += sizeof(struct compat_ipt_standard_target); | 990 | *dstptr += IPT_ST_COMPAT_LEN; |
992 | break; | 991 | break; |
993 | case COMPAT_FROM_USER: | 992 | case COMPAT_FROM_USER: |
994 | pcompat_st = | 993 | pcompat_st = target; |
995 | (struct compat_ipt_standard_target *)target; | 994 | memcpy(&st.target, &pcompat_st->target, IPT_ST_COMPAT_LEN); |
996 | memcpy(&st.target, &pcompat_st->target, | ||
997 | sizeof(struct ipt_entry_target)); | ||
998 | st.verdict = pcompat_st->verdict; | 995 | st.verdict = pcompat_st->verdict; |
999 | if (st.verdict > 0) | 996 | if (st.verdict > 0) |
1000 | st.verdict += compat_calc_jump(st.verdict); | 997 | st.verdict += compat_calc_jump(st.verdict); |
1001 | st.target.u.user.target_size = | 998 | st.target.u.user.target_size = IPT_ST_LEN; |
1002 | sizeof(struct ipt_standard_target); | 999 | memcpy(*dstptr, &st, IPT_ST_LEN); |
1003 | memcpy(*dstptr, &st, | ||
1004 | sizeof(struct ipt_standard_target)); | ||
1005 | *size += IPT_ST_OFFSET; | 1000 | *size += IPT_ST_OFFSET; |
1006 | *dstptr += sizeof(struct ipt_standard_target); | 1001 | *dstptr += IPT_ST_LEN; |
1007 | break; | 1002 | break; |
1008 | case COMPAT_CALC_SIZE: | 1003 | case COMPAT_CALC_SIZE: |
1009 | *size += IPT_ST_OFFSET; | 1004 | *size += IPT_ST_OFFSET; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index ff434821909f..cc9423de7311 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2741,7 +2741,10 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | |||
2741 | /* Reserve room for dummy headers, this skb can pass | 2741 | /* Reserve room for dummy headers, this skb can pass |
2742 | through good chunk of routing engine. | 2742 | through good chunk of routing engine. |
2743 | */ | 2743 | */ |
2744 | skb->mac.raw = skb->data; | 2744 | skb->mac.raw = skb->nh.raw = skb->data; |
2745 | |||
2746 | /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */ | ||
2747 | skb->nh.iph->protocol = IPPROTO_ICMP; | ||
2745 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); | 2748 | skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); |
2746 | 2749 | ||
2747 | if (rta[RTA_SRC - 1]) | 2750 | if (rta[RTA_SRC - 1]) |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index b871db6adc55..743016baa048 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -465,7 +465,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
465 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 465 | TCP_INC_STATS(TCP_MIB_OUTSEGS); |
466 | 466 | ||
467 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 467 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
468 | if (unlikely(err <= 0)) | 468 | if (likely(err <= 0)) |
469 | return err; | 469 | return err; |
470 | 470 | ||
471 | tcp_enter_cwr(sk); | 471 | tcp_enter_cwr(sk); |
@@ -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); |
@@ -551,7 +552,11 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss | |||
551 | buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC); | 552 | buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC); |
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. */ |
555 | |||
554 | sk_charge_skb(sk, buff); | 556 | sk_charge_skb(sk, buff); |
557 | nlen = skb->len - len - nsize; | ||
558 | buff->truesize += nlen; | ||
559 | skb->truesize -= nlen; | ||
555 | 560 | ||
556 | /* Correct the sequence numbers. */ | 561 | /* Correct the sequence numbers. */ |
557 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; | 562 | TCP_SKB_CB(buff)->seq = TCP_SKB_CB(skb)->seq + len; |
@@ -1037,7 +1042,8 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, | |||
1037 | if (unlikely(buff == NULL)) | 1042 | if (unlikely(buff == NULL)) |
1038 | return -ENOMEM; | 1043 | return -ENOMEM; |
1039 | 1044 | ||
1040 | buff->truesize = nlen; | 1045 | sk_charge_skb(sk, buff); |
1046 | buff->truesize += nlen; | ||
1041 | skb->truesize -= nlen; | 1047 | skb->truesize -= nlen; |
1042 | 1048 | ||
1043 | /* Correct the sequence numbers. */ | 1049 | /* Correct the sequence numbers. */ |
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index 32ad229b4fed..4ef8efaf6a67 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -62,7 +62,7 @@ static void xfrm4_encap(struct sk_buff *skb) | |||
62 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? | 62 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? |
63 | 0 : (iph->frag_off & htons(IP_DF)); | 63 | 0 : (iph->frag_off & htons(IP_DF)); |
64 | if (!top_iph->frag_off) | 64 | if (!top_iph->frag_off) |
65 | __ip_select_ident(top_iph, dst, 0); | 65 | __ip_select_ident(top_iph, dst->child, 0); |
66 | 66 | ||
67 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); | 67 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); |
68 | 68 | ||
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 2a1e7e45b890..a18d4256372c 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
@@ -485,15 +485,27 @@ static struct tlvtype_proc tlvprochopopt_lst[] = { | |||
485 | { -1, } | 485 | { -1, } |
486 | }; | 486 | }; |
487 | 487 | ||
488 | int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff) | 488 | int ipv6_parse_hopopts(struct sk_buff *skb) |
489 | { | 489 | { |
490 | struct inet6_skb_parm *opt = IP6CB(skb); | 490 | struct inet6_skb_parm *opt = IP6CB(skb); |
491 | 491 | ||
492 | /* | ||
493 | * skb->nh.raw is equal to skb->data, and | ||
494 | * skb->h.raw - skb->nh.raw is always equal to | ||
495 | * sizeof(struct ipv6hdr) by definition of | ||
496 | * hop-by-hop options. | ||
497 | */ | ||
498 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + 8) || | ||
499 | !pskb_may_pull(skb, sizeof(struct ipv6hdr) + ((skb->h.raw[1] + 1) << 3))) { | ||
500 | kfree_skb(skb); | ||
501 | return -1; | ||
502 | } | ||
503 | |||
492 | opt->hop = sizeof(struct ipv6hdr); | 504 | opt->hop = sizeof(struct ipv6hdr); |
493 | if (ip6_parse_tlv(tlvprochopopt_lst, skb)) { | 505 | if (ip6_parse_tlv(tlvprochopopt_lst, skb)) { |
494 | skb->h.raw += (skb->h.raw[1]+1)<<3; | 506 | skb->h.raw += (skb->h.raw[1]+1)<<3; |
495 | opt->nhoff = sizeof(struct ipv6hdr); | 507 | opt->nhoff = sizeof(struct ipv6hdr); |
496 | return sizeof(struct ipv6hdr); | 508 | return 1; |
497 | } | 509 | } |
498 | return -1; | 510 | return -1; |
499 | } | 511 | } |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 29f73592e68e..aceee252503d 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -114,11 +114,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
114 | } | 114 | } |
115 | 115 | ||
116 | if (hdr->nexthdr == NEXTHDR_HOP) { | 116 | if (hdr->nexthdr == NEXTHDR_HOP) { |
117 | if (ipv6_parse_hopopts(skb, IP6CB(skb)->nhoff) < 0) { | 117 | if (ipv6_parse_hopopts(skb) < 0) { |
118 | IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | 118 | IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); |
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
121 | hdr = skb->nh.ipv6h; | ||
122 | } | 121 | } |
123 | 122 | ||
124 | return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); | 123 | return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); |
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/ipv6/route.c b/net/ipv6/route.c index 79078747a646..0190e39096b9 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -317,7 +317,7 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, | |||
317 | __FUNCTION__, head, head ? *head : NULL, oif); | 317 | __FUNCTION__, head, head ? *head : NULL, oif); |
318 | 318 | ||
319 | for (rt = rt0, metric = rt0->rt6i_metric; | 319 | for (rt = rt0, metric = rt0->rt6i_metric; |
320 | rt && rt->rt6i_metric == metric; | 320 | rt && rt->rt6i_metric == metric && (!last || rt != rt0); |
321 | rt = rt->u.next) { | 321 | rt = rt->u.next) { |
322 | int m; | 322 | int m; |
323 | 323 | ||
@@ -343,9 +343,12 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, | |||
343 | (strict & RT6_SELECT_F_REACHABLE) && | 343 | (strict & RT6_SELECT_F_REACHABLE) && |
344 | last && last != rt0) { | 344 | last && last != rt0) { |
345 | /* no entries matched; do round-robin */ | 345 | /* no entries matched; do round-robin */ |
346 | static spinlock_t lock = SPIN_LOCK_UNLOCKED; | ||
347 | spin_lock(&lock); | ||
346 | *head = rt0->u.next; | 348 | *head = rt0->u.next; |
347 | rt0->u.next = last->u.next; | 349 | rt0->u.next = last->u.next; |
348 | last->u.next = rt0; | 350 | last->u.next = rt0; |
351 | spin_unlock(&lock); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | RT6_TRACE("%s() => %p, score=%d\n", | 354 | RT6_TRACE("%s() => %p, score=%d\n", |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 91cce8b2d7a5..88c840f1beb6 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -191,16 +191,18 @@ error: | |||
191 | static inline void | 191 | static inline void |
192 | _decode_session6(struct sk_buff *skb, struct flowi *fl) | 192 | _decode_session6(struct sk_buff *skb, struct flowi *fl) |
193 | { | 193 | { |
194 | u16 offset = sizeof(struct ipv6hdr); | 194 | u16 offset = skb->h.raw - skb->nh.raw; |
195 | struct ipv6hdr *hdr = skb->nh.ipv6h; | 195 | struct ipv6hdr *hdr = skb->nh.ipv6h; |
196 | struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); | 196 | struct ipv6_opt_hdr *exthdr; |
197 | u8 nexthdr = skb->nh.ipv6h->nexthdr; | 197 | u8 nexthdr = skb->nh.raw[IP6CB(skb)->nhoff]; |
198 | 198 | ||
199 | memset(fl, 0, sizeof(struct flowi)); | 199 | memset(fl, 0, sizeof(struct flowi)); |
200 | ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); | 200 | ipv6_addr_copy(&fl->fl6_dst, &hdr->daddr); |
201 | ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); | 201 | ipv6_addr_copy(&fl->fl6_src, &hdr->saddr); |
202 | 202 | ||
203 | while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) { | 203 | while (pskb_may_pull(skb, skb->nh.raw + offset + 1 - skb->data)) { |
204 | exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset); | ||
205 | |||
204 | switch (nexthdr) { | 206 | switch (nexthdr) { |
205 | case NEXTHDR_ROUTING: | 207 | case NEXTHDR_ROUTING: |
206 | case NEXTHDR_HOP: | 208 | case NEXTHDR_HOP: |
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/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 9cccc325b687..0c6da496cfa9 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -240,12 +240,15 @@ static int do_basic_checks(struct nf_conn *conntrack, | |||
240 | flag = 1; | 240 | flag = 1; |
241 | } | 241 | } |
242 | 242 | ||
243 | /* Cookie Ack/Echo chunks not the first OR | 243 | /* |
244 | Init / Init Ack / Shutdown compl chunks not the only chunks */ | 244 | * Cookie Ack/Echo chunks not the first OR |
245 | if ((sch->type == SCTP_CID_COOKIE_ACK | 245 | * Init / Init Ack / Shutdown compl chunks not the only chunks |
246 | * OR zero-length. | ||
247 | */ | ||
248 | if (((sch->type == SCTP_CID_COOKIE_ACK | ||
246 | || sch->type == SCTP_CID_COOKIE_ECHO | 249 | || sch->type == SCTP_CID_COOKIE_ECHO |
247 | || flag) | 250 | || flag) |
248 | && count !=0 ) { | 251 | && count !=0) || !sch->length) { |
249 | DEBUGP("Basic checks failed\n"); | 252 | DEBUGP("Basic checks failed\n"); |
250 | return 1; | 253 | return 1; |
251 | } | 254 | } |
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/netlink/af_netlink.c b/net/netlink/af_netlink.c index 2a233ffcf618..3862e73d14d7 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -56,12 +56,12 @@ | |||
56 | #include <linux/mm.h> | 56 | #include <linux/mm.h> |
57 | #include <linux/types.h> | 57 | #include <linux/types.h> |
58 | #include <linux/audit.h> | 58 | #include <linux/audit.h> |
59 | #include <linux/selinux.h> | ||
59 | 60 | ||
60 | #include <net/sock.h> | 61 | #include <net/sock.h> |
61 | #include <net/scm.h> | 62 | #include <net/scm.h> |
62 | #include <net/netlink.h> | 63 | #include <net/netlink.h> |
63 | 64 | ||
64 | #define Nprintk(a...) | ||
65 | #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) | 65 | #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) |
66 | 66 | ||
67 | struct netlink_sock { | 67 | struct netlink_sock { |
@@ -1157,6 +1157,7 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1157 | NETLINK_CB(skb).dst_pid = dst_pid; | 1157 | NETLINK_CB(skb).dst_pid = dst_pid; |
1158 | NETLINK_CB(skb).dst_group = dst_group; | 1158 | NETLINK_CB(skb).dst_group = dst_group; |
1159 | NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context); | 1159 | NETLINK_CB(skb).loginuid = audit_get_loginuid(current->audit_context); |
1160 | selinux_get_task_sid(current, &(NETLINK_CB(skb).sid)); | ||
1160 | memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1161 | memcpy(NETLINK_CREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
1161 | 1162 | ||
1162 | /* What can I do? Netlink is asynchronous, so that | 1163 | /* What can I do? Netlink is asynchronous, so that |
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/sched/sch_netem.c b/net/sched/sch_netem.c index 7228d30512c7..5a4a4d0ae502 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -167,7 +167,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
167 | if (count == 0) { | 167 | if (count == 0) { |
168 | sch->qstats.drops++; | 168 | sch->qstats.drops++; |
169 | kfree_skb(skb); | 169 | kfree_skb(skb); |
170 | return NET_XMIT_DROP; | 170 | return NET_XMIT_BYPASS; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* | 173 | /* |
diff --git a/net/socket.c b/net/socket.c index 23898f45f713..02948b622bd2 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -267,6 +267,8 @@ int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ule | |||
267 | return -EINVAL; | 267 | return -EINVAL; |
268 | if(len) | 268 | if(len) |
269 | { | 269 | { |
270 | if (audit_sockaddr(klen, kaddr)) | ||
271 | return -ENOMEM; | ||
270 | if(copy_to_user(uaddr,kaddr,len)) | 272 | if(copy_to_user(uaddr,kaddr,len)) |
271 | return -EFAULT; | 273 | return -EFAULT; |
272 | } | 274 | } |
@@ -490,6 +492,7 @@ static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) | |||
490 | struct file *file; | 492 | struct file *file; |
491 | struct socket *sock; | 493 | struct socket *sock; |
492 | 494 | ||
495 | *err = -EBADF; | ||
493 | file = fget_light(fd, fput_needed); | 496 | file = fget_light(fd, fput_needed); |
494 | if (file) { | 497 | if (file) { |
495 | sock = sock_from_file(file, err); | 498 | sock = sock_from_file(file, err); |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 900ef31f5a0e..519ebc17c028 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -794,7 +794,6 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
794 | 794 | ||
795 | out_err: | 795 | out_err: |
796 | dprintk("RPC: gss_create_cred failed with error %d\n", err); | 796 | dprintk("RPC: gss_create_cred failed with error %d\n", err); |
797 | if (cred) gss_destroy_cred(&cred->gc_base); | ||
798 | return ERR_PTR(err); | 797 | return ERR_PTR(err); |
799 | } | 798 | } |
800 | 799 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 97c981fa6b8e..76b969e6904f 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
@@ -212,7 +212,6 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, | |||
212 | char *cksumname; | 212 | char *cksumname; |
213 | struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */ | 213 | struct crypto_tfm *tfm = NULL; /* XXX add to ctx? */ |
214 | struct scatterlist sg[1]; | 214 | struct scatterlist sg[1]; |
215 | u32 code = GSS_S_FAILURE; | ||
216 | 215 | ||
217 | switch (cksumtype) { | 216 | switch (cksumtype) { |
218 | case CKSUMTYPE_RSA_MD5: | 217 | case CKSUMTYPE_RSA_MD5: |
@@ -221,13 +220,11 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, | |||
221 | default: | 220 | default: |
222 | dprintk("RPC: krb5_make_checksum:" | 221 | dprintk("RPC: krb5_make_checksum:" |
223 | " unsupported checksum %d", cksumtype); | 222 | " unsupported checksum %d", cksumtype); |
224 | goto out; | 223 | return GSS_S_FAILURE; |
225 | } | 224 | } |
226 | if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP))) | 225 | if (!(tfm = crypto_alloc_tfm(cksumname, CRYPTO_TFM_REQ_MAY_SLEEP))) |
227 | goto out; | 226 | return GSS_S_FAILURE; |
228 | cksum->len = crypto_tfm_alg_digestsize(tfm); | 227 | cksum->len = crypto_tfm_alg_digestsize(tfm); |
229 | if ((cksum->data = kmalloc(cksum->len, GFP_KERNEL)) == NULL) | ||
230 | goto out; | ||
231 | 228 | ||
232 | crypto_digest_init(tfm); | 229 | crypto_digest_init(tfm); |
233 | sg_set_buf(sg, header, hdrlen); | 230 | sg_set_buf(sg, header, hdrlen); |
@@ -235,10 +232,8 @@ make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, | |||
235 | process_xdr_buf(body, body_offset, body->len - body_offset, | 232 | process_xdr_buf(body, body_offset, body->len - body_offset, |
236 | checksummer, tfm); | 233 | checksummer, tfm); |
237 | crypto_digest_final(tfm, cksum->data); | 234 | crypto_digest_final(tfm, cksum->data); |
238 | code = 0; | ||
239 | out: | ||
240 | crypto_free_tfm(tfm); | 235 | crypto_free_tfm(tfm); |
241 | return code; | 236 | return 0; |
242 | } | 237 | } |
243 | 238 | ||
244 | EXPORT_SYMBOL(make_checksum); | 239 | EXPORT_SYMBOL(make_checksum); |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index dea529666d69..15c2db26767b 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -176,7 +176,8 @@ void rpc_count_iostats(struct rpc_task *task) | |||
176 | op_metrics->om_execute += execute; | 176 | op_metrics->om_execute += execute; |
177 | } | 177 | } |
178 | 178 | ||
179 | void _print_name(struct seq_file *seq, unsigned int op, struct rpc_procinfo *procs) | 179 | static void _print_name(struct seq_file *seq, unsigned int op, |
180 | struct rpc_procinfo *procs) | ||
180 | { | 181 | { |
181 | if (procs[op].p_name) | 182 | if (procs[op].p_name) |
182 | seq_printf(seq, "\t%12s: ", procs[op].p_name); | 183 | seq_printf(seq, "\t%12s: ", procs[op].p_name); |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 953307a9df1d..a3bbc891f959 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -229,8 +229,7 @@ static void node_is_down(struct publication *publ) | |||
229 | publ->node, publ->ref, publ->key); | 229 | publ->node, publ->ref, publ->key); |
230 | assert(p == publ); | 230 | assert(p == publ); |
231 | write_unlock_bh(&tipc_nametbl_lock); | 231 | write_unlock_bh(&tipc_nametbl_lock); |
232 | if (publ) | 232 | kfree(publ); |
233 | kfree(publ); | ||
234 | } | 233 | } |
235 | 234 | ||
236 | /** | 235 | /** |
diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c index 0a92e1da3922..71ff3088f6fe 100644 --- a/net/x25/x25_timer.c +++ b/net/x25/x25_timer.c | |||
@@ -114,8 +114,9 @@ static void x25_heartbeat_expiry(unsigned long param) | |||
114 | if (sock_flag(sk, SOCK_DESTROY) || | 114 | if (sock_flag(sk, SOCK_DESTROY) || |
115 | (sk->sk_state == TCP_LISTEN && | 115 | (sk->sk_state == TCP_LISTEN && |
116 | sock_flag(sk, SOCK_DEAD))) { | 116 | sock_flag(sk, SOCK_DEAD))) { |
117 | bh_unlock_sock(sk); | ||
117 | x25_destroy_socket(sk); | 118 | x25_destroy_socket(sk); |
118 | goto unlock; | 119 | return; |
119 | } | 120 | } |
120 | break; | 121 | break; |
121 | 122 | ||
@@ -128,7 +129,6 @@ static void x25_heartbeat_expiry(unsigned long param) | |||
128 | } | 129 | } |
129 | restart_heartbeat: | 130 | restart_heartbeat: |
130 | x25_start_heartbeat(sk); | 131 | x25_start_heartbeat(sk); |
131 | unlock: | ||
132 | bh_unlock_sock(sk); | 132 | bh_unlock_sock(sk); |
133 | } | 133 | } |
134 | 134 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index c3725fe2a8fb..b469c8b54613 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -57,12 +57,12 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family) | |||
57 | return -EAFNOSUPPORT; | 57 | return -EAFNOSUPPORT; |
58 | typemap = afinfo->type_map; | 58 | typemap = afinfo->type_map; |
59 | 59 | ||
60 | write_lock(&typemap->lock); | 60 | write_lock_bh(&typemap->lock); |
61 | if (likely(typemap->map[type->proto] == NULL)) | 61 | if (likely(typemap->map[type->proto] == NULL)) |
62 | typemap->map[type->proto] = type; | 62 | typemap->map[type->proto] = type; |
63 | else | 63 | else |
64 | err = -EEXIST; | 64 | err = -EEXIST; |
65 | write_unlock(&typemap->lock); | 65 | write_unlock_bh(&typemap->lock); |
66 | xfrm_policy_put_afinfo(afinfo); | 66 | xfrm_policy_put_afinfo(afinfo); |
67 | return err; | 67 | return err; |
68 | } | 68 | } |
@@ -78,12 +78,12 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) | |||
78 | return -EAFNOSUPPORT; | 78 | return -EAFNOSUPPORT; |
79 | typemap = afinfo->type_map; | 79 | typemap = afinfo->type_map; |
80 | 80 | ||
81 | write_lock(&typemap->lock); | 81 | write_lock_bh(&typemap->lock); |
82 | if (unlikely(typemap->map[type->proto] != type)) | 82 | if (unlikely(typemap->map[type->proto] != type)) |
83 | err = -ENOENT; | 83 | err = -ENOENT; |
84 | else | 84 | else |
85 | typemap->map[type->proto] = NULL; | 85 | typemap->map[type->proto] = NULL; |
86 | write_unlock(&typemap->lock); | 86 | write_unlock_bh(&typemap->lock); |
87 | xfrm_policy_put_afinfo(afinfo); | 87 | xfrm_policy_put_afinfo(afinfo); |
88 | return err; | 88 | return err; |
89 | } | 89 | } |
@@ -1251,7 +1251,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1251 | return -EINVAL; | 1251 | return -EINVAL; |
1252 | if (unlikely(afinfo->family >= NPROTO)) | 1252 | if (unlikely(afinfo->family >= NPROTO)) |
1253 | return -EAFNOSUPPORT; | 1253 | return -EAFNOSUPPORT; |
1254 | write_lock(&xfrm_policy_afinfo_lock); | 1254 | write_lock_bh(&xfrm_policy_afinfo_lock); |
1255 | if (unlikely(xfrm_policy_afinfo[afinfo->family] != NULL)) | 1255 | if (unlikely(xfrm_policy_afinfo[afinfo->family] != NULL)) |
1256 | err = -ENOBUFS; | 1256 | err = -ENOBUFS; |
1257 | else { | 1257 | else { |
@@ -1268,7 +1268,7 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1268 | afinfo->garbage_collect = __xfrm_garbage_collect; | 1268 | afinfo->garbage_collect = __xfrm_garbage_collect; |
1269 | xfrm_policy_afinfo[afinfo->family] = afinfo; | 1269 | xfrm_policy_afinfo[afinfo->family] = afinfo; |
1270 | } | 1270 | } |
1271 | write_unlock(&xfrm_policy_afinfo_lock); | 1271 | write_unlock_bh(&xfrm_policy_afinfo_lock); |
1272 | return err; | 1272 | return err; |
1273 | } | 1273 | } |
1274 | EXPORT_SYMBOL(xfrm_policy_register_afinfo); | 1274 | EXPORT_SYMBOL(xfrm_policy_register_afinfo); |
@@ -1280,7 +1280,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1280 | return -EINVAL; | 1280 | return -EINVAL; |
1281 | if (unlikely(afinfo->family >= NPROTO)) | 1281 | if (unlikely(afinfo->family >= NPROTO)) |
1282 | return -EAFNOSUPPORT; | 1282 | return -EAFNOSUPPORT; |
1283 | write_lock(&xfrm_policy_afinfo_lock); | 1283 | write_lock_bh(&xfrm_policy_afinfo_lock); |
1284 | if (likely(xfrm_policy_afinfo[afinfo->family] != NULL)) { | 1284 | if (likely(xfrm_policy_afinfo[afinfo->family] != NULL)) { |
1285 | if (unlikely(xfrm_policy_afinfo[afinfo->family] != afinfo)) | 1285 | if (unlikely(xfrm_policy_afinfo[afinfo->family] != afinfo)) |
1286 | err = -EINVAL; | 1286 | err = -EINVAL; |
@@ -1294,7 +1294,7 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
1294 | afinfo->garbage_collect = NULL; | 1294 | afinfo->garbage_collect = NULL; |
1295 | } | 1295 | } |
1296 | } | 1296 | } |
1297 | write_unlock(&xfrm_policy_afinfo_lock); | 1297 | write_unlock_bh(&xfrm_policy_afinfo_lock); |
1298 | return err; | 1298 | return err; |
1299 | } | 1299 | } |
1300 | EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); | 1300 | EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 3dc3e1f3b7aa..93a2f36ad3db 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1061,7 +1061,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo) | |||
1061 | return -EINVAL; | 1061 | return -EINVAL; |
1062 | if (unlikely(afinfo->family >= NPROTO)) | 1062 | if (unlikely(afinfo->family >= NPROTO)) |
1063 | return -EAFNOSUPPORT; | 1063 | return -EAFNOSUPPORT; |
1064 | write_lock(&xfrm_state_afinfo_lock); | 1064 | write_lock_bh(&xfrm_state_afinfo_lock); |
1065 | if (unlikely(xfrm_state_afinfo[afinfo->family] != NULL)) | 1065 | if (unlikely(xfrm_state_afinfo[afinfo->family] != NULL)) |
1066 | err = -ENOBUFS; | 1066 | err = -ENOBUFS; |
1067 | else { | 1067 | else { |
@@ -1069,7 +1069,7 @@ int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo) | |||
1069 | afinfo->state_byspi = xfrm_state_byspi; | 1069 | afinfo->state_byspi = xfrm_state_byspi; |
1070 | xfrm_state_afinfo[afinfo->family] = afinfo; | 1070 | xfrm_state_afinfo[afinfo->family] = afinfo; |
1071 | } | 1071 | } |
1072 | write_unlock(&xfrm_state_afinfo_lock); | 1072 | write_unlock_bh(&xfrm_state_afinfo_lock); |
1073 | return err; | 1073 | return err; |
1074 | } | 1074 | } |
1075 | EXPORT_SYMBOL(xfrm_state_register_afinfo); | 1075 | EXPORT_SYMBOL(xfrm_state_register_afinfo); |
@@ -1081,7 +1081,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo) | |||
1081 | return -EINVAL; | 1081 | return -EINVAL; |
1082 | if (unlikely(afinfo->family >= NPROTO)) | 1082 | if (unlikely(afinfo->family >= NPROTO)) |
1083 | return -EAFNOSUPPORT; | 1083 | return -EAFNOSUPPORT; |
1084 | write_lock(&xfrm_state_afinfo_lock); | 1084 | write_lock_bh(&xfrm_state_afinfo_lock); |
1085 | if (likely(xfrm_state_afinfo[afinfo->family] != NULL)) { | 1085 | if (likely(xfrm_state_afinfo[afinfo->family] != NULL)) { |
1086 | if (unlikely(xfrm_state_afinfo[afinfo->family] != afinfo)) | 1086 | if (unlikely(xfrm_state_afinfo[afinfo->family] != afinfo)) |
1087 | err = -EINVAL; | 1087 | err = -EINVAL; |
@@ -1091,7 +1091,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo) | |||
1091 | afinfo->state_bydst = NULL; | 1091 | afinfo->state_bydst = NULL; |
1092 | } | 1092 | } |
1093 | } | 1093 | } |
1094 | write_unlock(&xfrm_state_afinfo_lock); | 1094 | write_unlock_bh(&xfrm_state_afinfo_lock); |
1095 | return err; | 1095 | return err; |
1096 | } | 1096 | } |
1097 | EXPORT_SYMBOL(xfrm_state_unregister_afinfo); | 1097 | EXPORT_SYMBOL(xfrm_state_unregister_afinfo); |