aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-26 18:09:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-26 18:09:20 -0500
commit924d26df6b774b85c8b4548189b20e34f904a149 (patch)
tree59e0810a0149a1f8f1d15613c50e4896993310d8 /net
parent66673f13c10a817e27d71434c1198a4d874e0cd3 (diff)
parentcd1f55a5b49b74e13ed9e7bc74d005803aaa0da8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (92 commits) gianfar: Revive VLAN support vlan: Export symbols as non GPL symbols. bnx2x: tx_has_work should not wait for FW netxen: reduce memory footprint netxen: fix vlan tso/checksum offload net: Fix linux/if_frad.h's suitability for userspace. net: Move config NET_NS to from net/Kconfig to init/Kconfig isdn: Fix missing ifdef in isdn_ppp networking: document "nc" in addition to "netcat" in netconsole.txt e1000e: workaround hw errata af_key: initialize xfrm encap_oa virtio_net: Fix MAX_PACKET_LEN to support 802.1Q VLANs lcs: fix compilation for !CONFIG_IP_MULTICAST rtl8187: Add termination packet to prevent stall iwlwifi: fix rs_get_rate WARN_ON() p54usb: fix packet loss with first generation devices sctp: Fix another socket race during accept/peeloff sctp: Properly timestamp outgoing data chunks for rtx purposes sctp: Correctly start rtx timer on new packet transmissions. sctp: Fix crc32c calculations on big-endian arhes. ...
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_core.c4
-rw-r--r--net/9p/client.c2
-rw-r--r--net/Kconfig8
-rw-r--r--net/core/dev.c15
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/skbuff.c70
-rw-r--r--net/ipv6/af_inet6.c7
-rw-r--r--net/key/af_key.c1
-rw-r--r--net/mac80211/mlme.c4
-rw-r--r--net/mac80211/sta_info.h1
-rw-r--r--net/mac80211/tx.c6
-rw-r--r--net/netfilter/nf_conntrack_netlink.c3
-rw-r--r--net/sctp/input.c13
-rw-r--r--net/sctp/output.c7
-rw-r--r--net/sctp/outqueue.c3
-rw-r--r--net/wireless/reg.c128
-rw-r--r--net/xfrm/xfrm_user.c11
17 files changed, 206 insertions, 79 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 6c1323940263..e9db889d6222 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -62,13 +62,13 @@ struct net_device *vlan_dev_real_dev(const struct net_device *dev)
62{ 62{
63 return vlan_dev_info(dev)->real_dev; 63 return vlan_dev_info(dev)->real_dev;
64} 64}
65EXPORT_SYMBOL_GPL(vlan_dev_real_dev); 65EXPORT_SYMBOL(vlan_dev_real_dev);
66 66
67u16 vlan_dev_vlan_id(const struct net_device *dev) 67u16 vlan_dev_vlan_id(const struct net_device *dev)
68{ 68{
69 return vlan_dev_info(dev)->vlan_id; 69 return vlan_dev_info(dev)->vlan_id;
70} 70}
71EXPORT_SYMBOL_GPL(vlan_dev_vlan_id); 71EXPORT_SYMBOL(vlan_dev_vlan_id);
72 72
73static int vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp, 73static int vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
74 unsigned int vlan_tci, struct sk_buff *skb) 74 unsigned int vlan_tci, struct sk_buff *skb)
diff --git a/net/9p/client.c b/net/9p/client.c
index 821f1ec0b2c3..1eb580c38fbb 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -618,7 +618,7 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt)
618 return ERR_PTR(-ENOMEM); 618 return ERR_PTR(-ENOMEM);
619 619
620 ret = p9_idpool_get(clnt->fidpool); 620 ret = p9_idpool_get(clnt->fidpool);
621 if (fid->fid < 0) { 621 if (ret < 0) {
622 ret = -ENOSPC; 622 ret = -ENOSPC;
623 goto error; 623 goto error;
624 } 624 }
diff --git a/net/Kconfig b/net/Kconfig
index bf2776018f71..cdb8fdef6c4a 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -24,14 +24,6 @@ if NET
24 24
25menu "Networking options" 25menu "Networking options"
26 26
27config NET_NS
28 bool "Network namespace support"
29 default n
30 depends on EXPERIMENTAL && NAMESPACES
31 help
32 Allow user space to create what appear to be multiple instances
33 of the network stack.
34
35config COMPAT_NET_DEV_OPS 27config COMPAT_NET_DEV_OPS
36 def_bool y 28 def_bool y
37 29
diff --git a/net/core/dev.c b/net/core/dev.c
index 8d675975d85b..5379b0c1190a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1534,7 +1534,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
1534 skb->mac_len = skb->network_header - skb->mac_header; 1534 skb->mac_len = skb->network_header - skb->mac_header;
1535 __skb_pull(skb, skb->mac_len); 1535 __skb_pull(skb, skb->mac_len);
1536 1536
1537 if (WARN_ON(skb->ip_summed != CHECKSUM_PARTIAL)) { 1537 if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
1538 struct net_device *dev = skb->dev;
1539 struct ethtool_drvinfo info = {};
1540
1541 if (dev && dev->ethtool_ops && dev->ethtool_ops->get_drvinfo)
1542 dev->ethtool_ops->get_drvinfo(dev, &info);
1543
1544 WARN(1, "%s: caps=(0x%lx, 0x%lx) len=%d data_len=%d "
1545 "ip_summed=%d",
1546 info.driver, dev ? dev->features : 0L,
1547 skb->sk ? skb->sk->sk_route_caps : 0L,
1548 skb->len, skb->data_len, skb->ip_summed);
1549
1538 if (skb_header_cloned(skb) && 1550 if (skb_header_cloned(skb) &&
1539 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) 1551 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
1540 return ERR_PTR(err); 1552 return ERR_PTR(err);
@@ -2524,6 +2536,7 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
2524 2536
2525 if (!pskb_may_pull(skb, ETH_HLEN)) { 2537 if (!pskb_may_pull(skb, ETH_HLEN)) {
2526 napi_reuse_skb(napi, skb); 2538 napi_reuse_skb(napi, skb);
2539 skb = NULL;
2527 goto out; 2540 goto out;
2528 } 2541 }
2529 2542
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 55cffad2f328..55151faaf90c 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -341,8 +341,8 @@ again:
341 rv = register_pernet_operations(first_device, ops); 341 rv = register_pernet_operations(first_device, ops);
342 if (rv < 0) 342 if (rv < 0)
343 ida_remove(&net_generic_ids, *id); 343 ida_remove(&net_generic_ids, *id);
344 mutex_unlock(&net_mutex);
345out: 344out:
345 mutex_unlock(&net_mutex);
346 return rv; 346 return rv;
347} 347}
348EXPORT_SYMBOL_GPL(register_pernet_gen_subsys); 348EXPORT_SYMBOL_GPL(register_pernet_gen_subsys);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 65eac7739033..2e5f2ca3bdcd 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -73,17 +73,13 @@ static struct kmem_cache *skbuff_fclone_cache __read_mostly;
73static void sock_pipe_buf_release(struct pipe_inode_info *pipe, 73static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
74 struct pipe_buffer *buf) 74 struct pipe_buffer *buf)
75{ 75{
76 struct sk_buff *skb = (struct sk_buff *) buf->private; 76 put_page(buf->page);
77
78 kfree_skb(skb);
79} 77}
80 78
81static void sock_pipe_buf_get(struct pipe_inode_info *pipe, 79static void sock_pipe_buf_get(struct pipe_inode_info *pipe,
82 struct pipe_buffer *buf) 80 struct pipe_buffer *buf)
83{ 81{
84 struct sk_buff *skb = (struct sk_buff *) buf->private; 82 get_page(buf->page);
85
86 skb_get(skb);
87} 83}
88 84
89static int sock_pipe_buf_steal(struct pipe_inode_info *pipe, 85static int sock_pipe_buf_steal(struct pipe_inode_info *pipe,
@@ -1334,9 +1330,19 @@ fault:
1334 */ 1330 */
1335static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) 1331static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
1336{ 1332{
1337 struct sk_buff *skb = (struct sk_buff *) spd->partial[i].private; 1333 put_page(spd->pages[i]);
1334}
1338 1335
1339 kfree_skb(skb); 1336static inline struct page *linear_to_page(struct page *page, unsigned int len,
1337 unsigned int offset)
1338{
1339 struct page *p = alloc_pages(GFP_KERNEL, 0);
1340
1341 if (!p)
1342 return NULL;
1343 memcpy(page_address(p) + offset, page_address(page) + offset, len);
1344
1345 return p;
1340} 1346}
1341 1347
1342/* 1348/*
@@ -1344,16 +1350,23 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
1344 */ 1350 */
1345static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page, 1351static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
1346 unsigned int len, unsigned int offset, 1352 unsigned int len, unsigned int offset,
1347 struct sk_buff *skb) 1353 struct sk_buff *skb, int linear)
1348{ 1354{
1349 if (unlikely(spd->nr_pages == PIPE_BUFFERS)) 1355 if (unlikely(spd->nr_pages == PIPE_BUFFERS))
1350 return 1; 1356 return 1;
1351 1357
1358 if (linear) {
1359 page = linear_to_page(page, len, offset);
1360 if (!page)
1361 return 1;
1362 } else
1363 get_page(page);
1364
1352 spd->pages[spd->nr_pages] = page; 1365 spd->pages[spd->nr_pages] = page;
1353 spd->partial[spd->nr_pages].len = len; 1366 spd->partial[spd->nr_pages].len = len;
1354 spd->partial[spd->nr_pages].offset = offset; 1367 spd->partial[spd->nr_pages].offset = offset;
1355 spd->partial[spd->nr_pages].private = (unsigned long) skb_get(skb);
1356 spd->nr_pages++; 1368 spd->nr_pages++;
1369
1357 return 0; 1370 return 0;
1358} 1371}
1359 1372
@@ -1369,7 +1382,7 @@ static inline void __segment_seek(struct page **page, unsigned int *poff,
1369static inline int __splice_segment(struct page *page, unsigned int poff, 1382static inline int __splice_segment(struct page *page, unsigned int poff,
1370 unsigned int plen, unsigned int *off, 1383 unsigned int plen, unsigned int *off,
1371 unsigned int *len, struct sk_buff *skb, 1384 unsigned int *len, struct sk_buff *skb,
1372 struct splice_pipe_desc *spd) 1385 struct splice_pipe_desc *spd, int linear)
1373{ 1386{
1374 if (!*len) 1387 if (!*len)
1375 return 1; 1388 return 1;
@@ -1392,7 +1405,7 @@ static inline int __splice_segment(struct page *page, unsigned int poff,
1392 /* the linear region may spread across several pages */ 1405 /* the linear region may spread across several pages */
1393 flen = min_t(unsigned int, flen, PAGE_SIZE - poff); 1406 flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
1394 1407
1395 if (spd_fill_page(spd, page, flen, poff, skb)) 1408 if (spd_fill_page(spd, page, flen, poff, skb, linear))
1396 return 1; 1409 return 1;
1397 1410
1398 __segment_seek(&page, &poff, &plen, flen); 1411 __segment_seek(&page, &poff, &plen, flen);
@@ -1419,7 +1432,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
1419 if (__splice_segment(virt_to_page(skb->data), 1432 if (__splice_segment(virt_to_page(skb->data),
1420 (unsigned long) skb->data & (PAGE_SIZE - 1), 1433 (unsigned long) skb->data & (PAGE_SIZE - 1),
1421 skb_headlen(skb), 1434 skb_headlen(skb),
1422 offset, len, skb, spd)) 1435 offset, len, skb, spd, 1))
1423 return 1; 1436 return 1;
1424 1437
1425 /* 1438 /*
@@ -1429,7 +1442,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
1429 const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; 1442 const skb_frag_t *f = &skb_shinfo(skb)->frags[seg];
1430 1443
1431 if (__splice_segment(f->page, f->page_offset, f->size, 1444 if (__splice_segment(f->page, f->page_offset, f->size,
1432 offset, len, skb, spd)) 1445 offset, len, skb, spd, 0))
1433 return 1; 1446 return 1;
1434 } 1447 }
1435 1448
@@ -1442,7 +1455,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset,
1442 * the frag list, if such a thing exists. We'd probably need to recurse to 1455 * the frag list, if such a thing exists. We'd probably need to recurse to
1443 * handle that cleanly. 1456 * handle that cleanly.
1444 */ 1457 */
1445int skb_splice_bits(struct sk_buff *__skb, unsigned int offset, 1458int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
1446 struct pipe_inode_info *pipe, unsigned int tlen, 1459 struct pipe_inode_info *pipe, unsigned int tlen,
1447 unsigned int flags) 1460 unsigned int flags)
1448{ 1461{
@@ -1455,16 +1468,6 @@ int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
1455 .ops = &sock_pipe_buf_ops, 1468 .ops = &sock_pipe_buf_ops,
1456 .spd_release = sock_spd_release, 1469 .spd_release = sock_spd_release,
1457 }; 1470 };
1458 struct sk_buff *skb;
1459
1460 /*
1461 * I'd love to avoid the clone here, but tcp_read_sock()
1462 * ignores reference counts and unconditonally kills the sk_buff
1463 * on return from the actor.
1464 */
1465 skb = skb_clone(__skb, GFP_KERNEL);
1466 if (unlikely(!skb))
1467 return -ENOMEM;
1468 1471
1469 /* 1472 /*
1470 * __skb_splice_bits() only fails if the output has no room left, 1473 * __skb_splice_bits() only fails if the output has no room left,
@@ -1488,15 +1491,9 @@ int skb_splice_bits(struct sk_buff *__skb, unsigned int offset,
1488 } 1491 }
1489 1492
1490done: 1493done:
1491 /*
1492 * drop our reference to the clone, the pipe consumption will
1493 * drop the rest.
1494 */
1495 kfree_skb(skb);
1496
1497 if (spd.nr_pages) { 1494 if (spd.nr_pages) {
1495 struct sock *sk = skb->sk;
1498 int ret; 1496 int ret;
1499 struct sock *sk = __skb->sk;
1500 1497
1501 /* 1498 /*
1502 * Drop the socket lock, otherwise we have reverse 1499 * Drop the socket lock, otherwise we have reverse
@@ -2588,8 +2585,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2588 struct sk_buff *nskb; 2585 struct sk_buff *nskb;
2589 unsigned int headroom; 2586 unsigned int headroom;
2590 unsigned int hlen = p->data - skb_mac_header(p); 2587 unsigned int hlen = p->data - skb_mac_header(p);
2588 unsigned int len = skb->len;
2591 2589
2592 if (hlen + p->len + skb->len >= 65536) 2590 if (hlen + p->len + len >= 65536)
2593 return -E2BIG; 2591 return -E2BIG;
2594 2592
2595 if (skb_shinfo(p)->frag_list) 2593 if (skb_shinfo(p)->frag_list)
@@ -2651,9 +2649,9 @@ merge:
2651 2649
2652done: 2650done:
2653 NAPI_GRO_CB(p)->count++; 2651 NAPI_GRO_CB(p)->count++;
2654 p->data_len += skb->len; 2652 p->data_len += len;
2655 p->truesize += skb->len; 2653 p->truesize += len;
2656 p->len += skb->len; 2654 p->len += len;
2657 2655
2658 NAPI_GRO_CB(skb)->same_flow = 1; 2656 NAPI_GRO_CB(skb)->same_flow = 1;
2659 return 0; 2657 return 0;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 94f74f5b0cbf..c802bc1658a8 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -797,6 +797,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
797 unsigned int nlen; 797 unsigned int nlen;
798 int flush = 1; 798 int flush = 1;
799 int proto; 799 int proto;
800 __wsum csum;
800 801
801 if (unlikely(!pskb_may_pull(skb, sizeof(*iph)))) 802 if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
802 goto out; 803 goto out;
@@ -808,6 +809,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
808 809
809 rcu_read_lock(); 810 rcu_read_lock();
810 proto = ipv6_gso_pull_exthdrs(skb, iph->nexthdr); 811 proto = ipv6_gso_pull_exthdrs(skb, iph->nexthdr);
812 iph = ipv6_hdr(skb);
811 IPV6_GRO_CB(skb)->proto = proto; 813 IPV6_GRO_CB(skb)->proto = proto;
812 ops = rcu_dereference(inet6_protos[proto]); 814 ops = rcu_dereference(inet6_protos[proto]);
813 if (!ops || !ops->gro_receive) 815 if (!ops || !ops->gro_receive)
@@ -839,8 +841,13 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
839 841
840 NAPI_GRO_CB(skb)->flush |= flush; 842 NAPI_GRO_CB(skb)->flush |= flush;
841 843
844 csum = skb->csum;
845 skb_postpull_rcsum(skb, iph, skb_network_header_len(skb));
846
842 pp = ops->gro_receive(head, skb); 847 pp = ops->gro_receive(head, skb);
843 848
849 skb->csum = csum;
850
844out_unlock: 851out_unlock:
845 rcu_read_unlock(); 852 rcu_read_unlock();
846 853
diff --git a/net/key/af_key.c b/net/key/af_key.c
index f8bd8df5e257..7dcbde3ea7d9 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1285,6 +1285,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
1285 ext_hdrs[SADB_X_EXT_NAT_T_DPORT-1]; 1285 ext_hdrs[SADB_X_EXT_NAT_T_DPORT-1];
1286 natt->encap_dport = n_port->sadb_x_nat_t_port_port; 1286 natt->encap_dport = n_port->sadb_x_nat_t_port_port;
1287 } 1287 }
1288 memset(&natt->encap_oa, 0, sizeof(natt->encap_oa));
1288 } 1289 }
1289 1290
1290 err = xfrm_init_state(x); 1291 err = xfrm_init_state(x);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 5ba721b6a399..2b890af01ba4 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -620,8 +620,8 @@ static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
620 if (use_short_slot != bss_conf->use_short_slot) { 620 if (use_short_slot != bss_conf->use_short_slot) {
621#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 621#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
622 if (net_ratelimit()) { 622 if (net_ratelimit()) {
623 printk(KERN_DEBUG "%s: switched to %s slot" 623 printk(KERN_DEBUG "%s: switched to %s slot time"
624 " (BSSID=%s)\n", 624 " (BSSID=%pM)\n",
625 sdata->dev->name, 625 sdata->dev->name,
626 use_short_slot ? "short" : "long", 626 use_short_slot ? "short" : "long",
627 ifsta->bssid); 627 ifsta->bssid);
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index dc2606d0ae77..e49a5b99cf10 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -195,7 +195,6 @@ struct sta_ampdu_mlme {
195 * @tx_packets: number of RX/TX MSDUs 195 * @tx_packets: number of RX/TX MSDUs
196 * @tx_bytes: number of bytes transmitted to this STA 196 * @tx_bytes: number of bytes transmitted to this STA
197 * @tx_fragments: number of transmitted MPDUs 197 * @tx_fragments: number of transmitted MPDUs
198 * @last_txrate: description of the last used transmit rate
199 * @tid_seq: per-TID sequence numbers for sending to this STA 198 * @tid_seq: per-TID sequence numbers for sending to this STA
200 * @ampdu_mlme: A-MPDU state machine state 199 * @ampdu_mlme: A-MPDU state machine state
201 * @timer_to_tid: identity mapping to ID timers 200 * @timer_to_tid: identity mapping to ID timers
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index a4af3a124cce..4278e545638f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1307,8 +1307,10 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
1307 if (is_multicast_ether_addr(hdr->addr3)) 1307 if (is_multicast_ether_addr(hdr->addr3))
1308 memcpy(hdr->addr1, hdr->addr3, ETH_ALEN); 1308 memcpy(hdr->addr1, hdr->addr3, ETH_ALEN);
1309 else 1309 else
1310 if (mesh_nexthop_lookup(skb, osdata)) 1310 if (mesh_nexthop_lookup(skb, osdata)) {
1311 return 0; 1311 dev_put(odev);
1312 return 0;
1313 }
1312 if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) 1314 if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0)
1313 IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh, 1315 IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh,
1314 fwded_frames); 1316 fwded_frames);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 3dddec6d2f7e..c32a7e8e3a1b 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -831,13 +831,16 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
831 if (!parse_nat_setup) { 831 if (!parse_nat_setup) {
832#ifdef CONFIG_MODULES 832#ifdef CONFIG_MODULES
833 rcu_read_unlock(); 833 rcu_read_unlock();
834 spin_unlock_bh(&nf_conntrack_lock);
834 nfnl_unlock(); 835 nfnl_unlock();
835 if (request_module("nf-nat-ipv4") < 0) { 836 if (request_module("nf-nat-ipv4") < 0) {
836 nfnl_lock(); 837 nfnl_lock();
838 spin_lock_bh(&nf_conntrack_lock);
837 rcu_read_lock(); 839 rcu_read_lock();
838 return -EOPNOTSUPP; 840 return -EOPNOTSUPP;
839 } 841 }
840 nfnl_lock(); 842 nfnl_lock();
843 spin_lock_bh(&nf_conntrack_lock);
841 rcu_read_lock(); 844 rcu_read_lock();
842 if (nfnetlink_parse_nat_setup_hook) 845 if (nfnetlink_parse_nat_setup_hook)
843 return -EAGAIN; 846 return -EAGAIN;
diff --git a/net/sctp/input.c b/net/sctp/input.c
index bf612d954d41..2e4a8646dbc3 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -249,6 +249,19 @@ int sctp_rcv(struct sk_buff *skb)
249 */ 249 */
250 sctp_bh_lock_sock(sk); 250 sctp_bh_lock_sock(sk);
251 251
252 if (sk != rcvr->sk) {
253 /* Our cached sk is different from the rcvr->sk. This is
254 * because migrate()/accept() may have moved the association
255 * to a new socket and released all the sockets. So now we
256 * are holding a lock on the old socket while the user may
257 * be doing something with the new socket. Switch our veiw
258 * of the current sk.
259 */
260 sctp_bh_unlock_sock(sk);
261 sk = rcvr->sk;
262 sctp_bh_lock_sock(sk);
263 }
264
252 if (sock_owned_by_user(sk)) { 265 if (sock_owned_by_user(sk)) {
253 SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG); 266 SCTP_INC_STATS_BH(SCTP_MIB_IN_PKT_BACKLOG);
254 sctp_add_backlog(sk, skb); 267 sctp_add_backlog(sk, skb);
diff --git a/net/sctp/output.c b/net/sctp/output.c
index c3f417f7ec6e..73639355157e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -324,14 +324,16 @@ append:
324 switch (chunk->chunk_hdr->type) { 324 switch (chunk->chunk_hdr->type) {
325 case SCTP_CID_DATA: 325 case SCTP_CID_DATA:
326 retval = sctp_packet_append_data(packet, chunk); 326 retval = sctp_packet_append_data(packet, chunk);
327 if (SCTP_XMIT_OK != retval)
328 goto finish;
327 /* Disallow SACK bundling after DATA. */ 329 /* Disallow SACK bundling after DATA. */
328 packet->has_sack = 1; 330 packet->has_sack = 1;
329 /* Disallow AUTH bundling after DATA */ 331 /* Disallow AUTH bundling after DATA */
330 packet->has_auth = 1; 332 packet->has_auth = 1;
331 /* Let it be knows that packet has DATA in it */ 333 /* Let it be knows that packet has DATA in it */
332 packet->has_data = 1; 334 packet->has_data = 1;
333 if (SCTP_XMIT_OK != retval) 335 /* timestamp the chunk for rtx purposes */
334 goto finish; 336 chunk->sent_at = jiffies;
335 break; 337 break;
336 case SCTP_CID_COOKIE_ECHO: 338 case SCTP_CID_COOKIE_ECHO:
337 packet->has_cookie_echo = 1; 339 packet->has_cookie_echo = 1;
@@ -470,7 +472,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
470 } else 472 } else
471 chunk->resent = 1; 473 chunk->resent = 1;
472 474
473 chunk->sent_at = jiffies;
474 has_data = 1; 475 has_data = 1;
475 } 476 }
476 477
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 247ebc95c1e5..bc411c896216 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -929,7 +929,6 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
929 } 929 }
930 930
931 /* Finally, transmit new packets. */ 931 /* Finally, transmit new packets. */
932 start_timer = 0;
933 while ((chunk = sctp_outq_dequeue_data(q)) != NULL) { 932 while ((chunk = sctp_outq_dequeue_data(q)) != NULL) {
934 /* RFC 2960 6.5 Every DATA chunk MUST carry a valid 933 /* RFC 2960 6.5 Every DATA chunk MUST carry a valid
935 * stream identifier. 934 * stream identifier.
@@ -1028,7 +1027,7 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
1028 list_add_tail(&chunk->transmitted_list, 1027 list_add_tail(&chunk->transmitted_list,
1029 &transport->transmitted); 1028 &transport->transmitted);
1030 1029
1031 sctp_transport_reset_timers(transport, start_timer-1); 1030 sctp_transport_reset_timers(transport, 0);
1032 1031
1033 q->empty = 0; 1032 q->empty = 0;
1034 1033
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4f877535e666..bc494cef2102 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -421,6 +421,31 @@ static u32 freq_max_bandwidth(const struct ieee80211_freq_range *freq_range,
421 return 0; 421 return 0;
422} 422}
423 423
424/**
425 * freq_in_rule_band - tells us if a frequency is in a frequency band
426 * @freq_range: frequency rule we want to query
427 * @freq_khz: frequency we are inquiring about
428 *
429 * This lets us know if a specific frequency rule is or is not relevant to
430 * a specific frequency's band. Bands are device specific and artificial
431 * definitions (the "2.4 GHz band" and the "5 GHz band"), however it is
432 * safe for now to assume that a frequency rule should not be part of a
433 * frequency's band if the start freq or end freq are off by more than 2 GHz.
434 * This resolution can be lowered and should be considered as we add
435 * regulatory rule support for other "bands".
436 **/
437static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
438 u32 freq_khz)
439{
440#define ONE_GHZ_IN_KHZ 1000000
441 if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
442 return true;
443 if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
444 return true;
445 return false;
446#undef ONE_GHZ_IN_KHZ
447}
448
424/* Converts a country IE to a regulatory domain. A regulatory domain 449/* Converts a country IE to a regulatory domain. A regulatory domain
425 * structure has a lot of information which the IE doesn't yet have, 450 * structure has a lot of information which the IE doesn't yet have,
426 * so for the other values we use upper max values as we will intersect 451 * so for the other values we use upper max values as we will intersect
@@ -538,6 +563,7 @@ static struct ieee80211_regdomain *country_ie_2_rd(
538 563
539 /* This time around we fill in the rd */ 564 /* This time around we fill in the rd */
540 while (country_ie_len >= 3) { 565 while (country_ie_len >= 3) {
566 int end_channel = 0;
541 struct ieee80211_country_ie_triplet *triplet = 567 struct ieee80211_country_ie_triplet *triplet =
542 (struct ieee80211_country_ie_triplet *) country_ie; 568 (struct ieee80211_country_ie_triplet *) country_ie;
543 struct ieee80211_reg_rule *reg_rule = NULL; 569 struct ieee80211_reg_rule *reg_rule = NULL;
@@ -559,6 +585,23 @@ static struct ieee80211_regdomain *country_ie_2_rd(
559 585
560 reg_rule->flags = flags; 586 reg_rule->flags = flags;
561 587
588 /* 2 GHz */
589 if (triplet->chans.first_channel <= 14)
590 end_channel = triplet->chans.first_channel +
591 triplet->chans.num_channels;
592 else
593 /*
594 * 5 GHz -- For example in country IEs if the first
595 * channel given is 36 and the number of channels is 4
596 * then the individual channel numbers defined for the
597 * 5 GHz PHY by these parameters are: 36, 40, 44, and 48
598 * and not 36, 37, 38, 39.
599 *
600 * See: http://tinyurl.com/11d-clarification
601 */
602 end_channel = triplet->chans.first_channel +
603 (4 * (triplet->chans.num_channels - 1));
604
562 /* The +10 is since the regulatory domain expects 605 /* The +10 is since the regulatory domain expects
563 * the actual band edge, not the center of freq for 606 * the actual band edge, not the center of freq for
564 * its start and end freqs, assuming 20 MHz bandwidth on 607 * its start and end freqs, assuming 20 MHz bandwidth on
@@ -568,8 +611,7 @@ static struct ieee80211_regdomain *country_ie_2_rd(
568 triplet->chans.first_channel) - 10); 611 triplet->chans.first_channel) - 10);
569 freq_range->end_freq_khz = 612 freq_range->end_freq_khz =
570 MHZ_TO_KHZ(ieee80211_channel_to_frequency( 613 MHZ_TO_KHZ(ieee80211_channel_to_frequency(
571 triplet->chans.first_channel + 614 end_channel) + 10);
572 triplet->chans.num_channels) + 10);
573 615
574 /* Large arbitrary values, we intersect later */ 616 /* Large arbitrary values, we intersect later */
575 /* Increment this if we ever support >= 40 MHz channels 617 /* Increment this if we ever support >= 40 MHz channels
@@ -748,12 +790,23 @@ static u32 map_regdom_flags(u32 rd_flags)
748 * this value to the maximum allowed bandwidth. 790 * this value to the maximum allowed bandwidth.
749 * @reg_rule: the regulatory rule which we have for this frequency 791 * @reg_rule: the regulatory rule which we have for this frequency
750 * 792 *
751 * Use this function to get the regulatory rule for a specific frequency. 793 * Use this function to get the regulatory rule for a specific frequency on
794 * a given wireless device. If the device has a specific regulatory domain
795 * it wants to follow we respect that unless a country IE has been received
796 * and processed already.
797 *
798 * Returns 0 if it was able to find a valid regulatory rule which does
799 * apply to the given center_freq otherwise it returns non-zero. It will
800 * also return -ERANGE if we determine the given center_freq does not even have
801 * a regulatory rule for a frequency range in the center_freq's band. See
802 * freq_in_rule_band() for our current definition of a band -- this is purely
803 * subjective and right now its 802.11 specific.
752 */ 804 */
753static int freq_reg_info(u32 center_freq, u32 *bandwidth, 805static int freq_reg_info(u32 center_freq, u32 *bandwidth,
754 const struct ieee80211_reg_rule **reg_rule) 806 const struct ieee80211_reg_rule **reg_rule)
755{ 807{
756 int i; 808 int i;
809 bool band_rule_found = false;
757 u32 max_bandwidth = 0; 810 u32 max_bandwidth = 0;
758 811
759 if (!cfg80211_regdomain) 812 if (!cfg80211_regdomain)
@@ -767,7 +820,15 @@ static int freq_reg_info(u32 center_freq, u32 *bandwidth,
767 rr = &cfg80211_regdomain->reg_rules[i]; 820 rr = &cfg80211_regdomain->reg_rules[i];
768 fr = &rr->freq_range; 821 fr = &rr->freq_range;
769 pr = &rr->power_rule; 822 pr = &rr->power_rule;
823
824 /* We only need to know if one frequency rule was
825 * was in center_freq's band, that's enough, so lets
826 * not overwrite it once found */
827 if (!band_rule_found)
828 band_rule_found = freq_in_rule_band(fr, center_freq);
829
770 max_bandwidth = freq_max_bandwidth(fr, center_freq); 830 max_bandwidth = freq_max_bandwidth(fr, center_freq);
831
771 if (max_bandwidth && *bandwidth <= max_bandwidth) { 832 if (max_bandwidth && *bandwidth <= max_bandwidth) {
772 *reg_rule = rr; 833 *reg_rule = rr;
773 *bandwidth = max_bandwidth; 834 *bandwidth = max_bandwidth;
@@ -775,23 +836,64 @@ static int freq_reg_info(u32 center_freq, u32 *bandwidth,
775 } 836 }
776 } 837 }
777 838
839 if (!band_rule_found)
840 return -ERANGE;
841
778 return !max_bandwidth; 842 return !max_bandwidth;
779} 843}
780 844
781static void handle_channel(struct ieee80211_channel *chan) 845static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
846 unsigned int chan_idx)
782{ 847{
783 int r; 848 int r;
784 u32 flags = chan->orig_flags; 849 u32 flags;
785 u32 max_bandwidth = 0; 850 u32 max_bandwidth = 0;
786 const struct ieee80211_reg_rule *reg_rule = NULL; 851 const struct ieee80211_reg_rule *reg_rule = NULL;
787 const struct ieee80211_power_rule *power_rule = NULL; 852 const struct ieee80211_power_rule *power_rule = NULL;
853 struct ieee80211_supported_band *sband;
854 struct ieee80211_channel *chan;
855
856 sband = wiphy->bands[band];
857 BUG_ON(chan_idx >= sband->n_channels);
858 chan = &sband->channels[chan_idx];
859
860 flags = chan->orig_flags;
788 861
789 r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq), 862 r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq),
790 &max_bandwidth, &reg_rule); 863 &max_bandwidth, &reg_rule);
791 864
792 if (r) { 865 if (r) {
793 flags |= IEEE80211_CHAN_DISABLED; 866 /* This means no regulatory rule was found in the country IE
794 chan->flags = flags; 867 * with a frequency range on the center_freq's band, since
868 * IEEE-802.11 allows for a country IE to have a subset of the
869 * regulatory information provided in a country we ignore
870 * disabling the channel unless at least one reg rule was
871 * found on the center_freq's band. For details see this
872 * clarification:
873 *
874 * http://tinyurl.com/11d-clarification
875 */
876 if (r == -ERANGE &&
877 last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
878#ifdef CONFIG_CFG80211_REG_DEBUG
879 printk(KERN_DEBUG "cfg80211: Leaving channel %d MHz "
880 "intact on %s - no rule found in band on "
881 "Country IE\n",
882 chan->center_freq, wiphy_name(wiphy));
883#endif
884 } else {
885 /* In this case we know the country IE has at least one reg rule
886 * for the band so we respect its band definitions */
887#ifdef CONFIG_CFG80211_REG_DEBUG
888 if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
889 printk(KERN_DEBUG "cfg80211: Disabling "
890 "channel %d MHz on %s due to "
891 "Country IE\n",
892 chan->center_freq, wiphy_name(wiphy));
893#endif
894 flags |= IEEE80211_CHAN_DISABLED;
895 chan->flags = flags;
896 }
795 return; 897 return;
796 } 898 }
797 899
@@ -808,12 +910,16 @@ static void handle_channel(struct ieee80211_channel *chan)
808 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); 910 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
809} 911}
810 912
811static void handle_band(struct ieee80211_supported_band *sband) 913static void handle_band(struct wiphy *wiphy, enum ieee80211_band band)
812{ 914{
813 int i; 915 unsigned int i;
916 struct ieee80211_supported_band *sband;
917
918 BUG_ON(!wiphy->bands[band]);
919 sband = wiphy->bands[band];
814 920
815 for (i = 0; i < sband->n_channels; i++) 921 for (i = 0; i < sband->n_channels; i++)
816 handle_channel(&sband->channels[i]); 922 handle_channel(wiphy, band, i);
817} 923}
818 924
819static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) 925static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby)
@@ -840,7 +946,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby)
840 enum ieee80211_band band; 946 enum ieee80211_band band;
841 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 947 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
842 if (wiphy->bands[band]) 948 if (wiphy->bands[band])
843 handle_band(wiphy->bands[band]); 949 handle_band(wiphy, band);
844 if (wiphy->reg_notifier) 950 if (wiphy->reg_notifier)
845 wiphy->reg_notifier(wiphy, setby); 951 wiphy->reg_notifier(wiphy, setby);
846 } 952 }
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 7877e7975dae..b95a2d64eb59 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1914,17 +1914,10 @@ static int xfrm_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1914} 1914}
1915#endif 1915#endif
1916 1916
1917/* For the xfrm_usersa_info cases we have to work around some 32-bit vs.
1918 * 64-bit compatability issues. On 32-bit the structure is 220 bytes, but
1919 * for 64-bit it gets padded out to 224 bytes. Those bytes are just
1920 * padding and don't have any content we care about. Therefore as long
1921 * as we have enough bytes for the content we can make both cases work.
1922 */
1923
1924#define XMSGSIZE(type) sizeof(struct type) 1917#define XMSGSIZE(type) sizeof(struct type)
1925 1918
1926static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { 1919static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
1927 [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = 220, /* see above */ 1920 [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info),
1928 [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1921 [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id),
1929 [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1922 [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id),
1930 [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), 1923 [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info),
@@ -1934,7 +1927,7 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
1934 [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), 1927 [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire),
1935 [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), 1928 [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire),
1936 [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), 1929 [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info),
1937 [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = 220, /* see above */ 1930 [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info),
1938 [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), 1931 [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire),
1939 [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), 1932 [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush),
1940 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0, 1933 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0,