aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-08 05:48:30 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-08 05:48:30 -0400
commit22f6dacdfcfdc792d068e9c41234808860498d04 (patch)
tree281a7d476f256ea3e2f800177ba685b169cc0540
parent928f308f556f4943e50c5064b546f47bce301f02 (diff)
parent9b05126baa146fc3f41360164141d4e1b3ea93c4 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: include/net/tcp.h
-rw-r--r--drivers/net/bnx2.c6
-rw-r--r--drivers/net/bonding/bond_alb.c12
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c31
-rw-r--r--drivers/net/igb/igb_main.c12
-rw-r--r--drivers/net/usb/Kconfig14
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c381
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
-rw-r--r--include/linux/netfilter/xt_LED.h2
-rw-r--r--include/linux/netfilter/xt_cluster.h2
-rw-r--r--include/linux/usb/cdc.h3
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--include/net/tcp.h14
-rw-r--r--net/Kconfig6
-rw-r--r--net/bluetooth/hci_conn.c2
-rw-r--r--net/bluetooth/hci_sysfs.c73
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/ipv4/tcp_input.c10
-rw-r--r--net/ipv6/netfilter/ip6t_ipv6header.c6
-rw-r--r--net/mac80211/rc80211_minstrel.c2
-rw-r--r--net/mac80211/rc80211_pid_algo.c73
-rw-r--r--net/mac80211/tx.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c48
-rw-r--r--net/netfilter/xt_cluster.c8
-rw-r--r--net/sched/sch_fifo.c2
-rw-r--r--net/wimax/op-msg.c11
-rw-r--r--net/wimax/stack.c17
-rw-r--r--net/wireless/reg.c17
-rw-r--r--net/wireless/scan.c1
32 files changed, 612 insertions, 173 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d47839184a06..b0cb29d4cc01 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "2.0.0" 57#define DRV_MODULE_VERSION "2.0.1"
58#define DRV_MODULE_RELDATE "April 2, 2009" 58#define DRV_MODULE_RELDATE "May 6, 2009"
59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw" 59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw"
60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw" 60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw"
61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw" 61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw"
@@ -2600,6 +2600,7 @@ bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi)
2600 /* Tell compiler that status block fields can change. */ 2600 /* Tell compiler that status block fields can change. */
2601 barrier(); 2601 barrier();
2602 cons = *bnapi->hw_tx_cons_ptr; 2602 cons = *bnapi->hw_tx_cons_ptr;
2603 barrier();
2603 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT)) 2604 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT))
2604 cons++; 2605 cons++;
2605 return cons; 2606 return cons;
@@ -2879,6 +2880,7 @@ bnx2_get_hw_rx_cons(struct bnx2_napi *bnapi)
2879 /* Tell compiler that status block fields can change. */ 2880 /* Tell compiler that status block fields can change. */
2880 barrier(); 2881 barrier();
2881 cons = *bnapi->hw_rx_cons_ptr; 2882 cons = *bnapi->hw_rx_cons_ptr;
2883 barrier();
2882 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) 2884 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
2883 cons++; 2885 cons++;
2884 return cons; 2886 return cons;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 553a89919778..46d312bedfb8 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1706,10 +1706,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1706 * Called with RTNL 1706 * Called with RTNL
1707 */ 1707 */
1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr) 1708int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1709 __releases(&bond->curr_slave_lock)
1710 __releases(&bond->lock)
1711 __acquires(&bond->lock) 1709 __acquires(&bond->lock)
1712 __acquires(&bond->curr_slave_lock) 1710 __releases(&bond->lock)
1713{ 1711{
1714 struct bonding *bond = netdev_priv(bond_dev); 1712 struct bonding *bond = netdev_priv(bond_dev);
1715 struct sockaddr *sa = addr; 1713 struct sockaddr *sa = addr;
@@ -1745,9 +1743,6 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1745 } 1743 }
1746 } 1744 }
1747 1745
1748 write_unlock_bh(&bond->curr_slave_lock);
1749 read_unlock(&bond->lock);
1750
1751 if (swap_slave) { 1746 if (swap_slave) {
1752 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave); 1747 alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
1753 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave); 1748 alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
@@ -1755,16 +1750,15 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
1755 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr, 1750 alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
1756 bond->alb_info.rlb_enabled); 1751 bond->alb_info.rlb_enabled);
1757 1752
1753 read_lock(&bond->lock);
1758 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr); 1754 alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
1759 if (bond->alb_info.rlb_enabled) { 1755 if (bond->alb_info.rlb_enabled) {
1760 /* inform clients mac address has changed */ 1756 /* inform clients mac address has changed */
1761 rlb_req_update_slave_clients(bond, bond->curr_active_slave); 1757 rlb_req_update_slave_clients(bond, bond->curr_active_slave);
1762 } 1758 }
1759 read_unlock(&bond->lock);
1763 } 1760 }
1764 1761
1765 read_lock(&bond->lock);
1766 write_lock_bh(&bond->curr_slave_lock);
1767
1768 return 0; 1762 return 0;
1769} 1763}
1770 1764
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index b455dca0901e..9a32d0c73cb3 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3741,7 +3741,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
3741 struct e1000_hw *hw = &adapter->hw; 3741 struct e1000_hw *hw = &adapter->hw;
3742 u32 rctl, icr = er32(ICR); 3742 u32 rctl, icr = er32(ICR);
3743 3743
3744 if (unlikely((!icr) || test_bit(__E1000_RESETTING, &adapter->flags))) 3744 if (unlikely((!icr) || test_bit(__E1000_DOWN, &adapter->flags)))
3745 return IRQ_NONE; /* Not our interrupt */ 3745 return IRQ_NONE; /* Not our interrupt */
3746 3746
3747 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is 3747 /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 6e317caf429c..16a41389575a 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0100" 43#define DRV_VERSION "EHEA_0101"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 37a190d85fcd..147c4b088fb3 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -545,14 +545,17 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
545 x &= (arr_len - 1); 545 x &= (arr_len - 1);
546 546
547 pref = skb_array[x]; 547 pref = skb_array[x];
548 prefetchw(pref); 548 if (pref) {
549 prefetchw(pref + EHEA_CACHE_LINE); 549 prefetchw(pref);
550 550 prefetchw(pref + EHEA_CACHE_LINE);
551 pref = (skb_array[x]->data); 551
552 prefetch(pref); 552 pref = (skb_array[x]->data);
553 prefetch(pref + EHEA_CACHE_LINE); 553 prefetch(pref);
554 prefetch(pref + EHEA_CACHE_LINE * 2); 554 prefetch(pref + EHEA_CACHE_LINE);
555 prefetch(pref + EHEA_CACHE_LINE * 3); 555 prefetch(pref + EHEA_CACHE_LINE * 2);
556 prefetch(pref + EHEA_CACHE_LINE * 3);
557 }
558
556 skb = skb_array[skb_index]; 559 skb = skb_array[skb_index];
557 skb_array[skb_index] = NULL; 560 skb_array[skb_index] = NULL;
558 return skb; 561 return skb;
@@ -569,12 +572,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array,
569 x &= (arr_len - 1); 572 x &= (arr_len - 1);
570 573
571 pref = skb_array[x]; 574 pref = skb_array[x];
572 prefetchw(pref); 575 if (pref) {
573 prefetchw(pref + EHEA_CACHE_LINE); 576 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE);
574 578
575 pref = (skb_array[x]->data); 579 pref = (skb_array[x]->data);
576 prefetchw(pref); 580 prefetchw(pref);
577 prefetchw(pref + EHEA_CACHE_LINE); 581 prefetchw(pref + EHEA_CACHE_LINE);
582 }
578 583
579 skb = skb_array[wqe_index]; 584 skb = skb_array[wqe_index];
580 skb_array[wqe_index] = NULL; 585 skb_array[wqe_index] = NULL;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 8784c051707e..ffd731539997 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2010,7 +2010,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2010 struct e1000_hw *hw = &adapter->hw; 2010 struct e1000_hw *hw = &adapter->hw;
2011 u32 rctl; 2011 u32 rctl;
2012 u32 srrctl = 0; 2012 u32 srrctl = 0;
2013 int i, j; 2013 int i;
2014 2014
2015 rctl = rd32(E1000_RCTL); 2015 rctl = rd32(E1000_RCTL);
2016 2016
@@ -2075,8 +2075,6 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2075 if (adapter->vfs_allocated_count) { 2075 if (adapter->vfs_allocated_count) {
2076 u32 vmolr; 2076 u32 vmolr;
2077 2077
2078 j = adapter->rx_ring[0].reg_idx;
2079
2080 /* set all queue drop enable bits */ 2078 /* set all queue drop enable bits */
2081 wr32(E1000_QDE, ALL_QUEUES); 2079 wr32(E1000_QDE, ALL_QUEUES);
2082 srrctl |= E1000_SRRCTL_DROP_EN; 2080 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -2084,16 +2082,16 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2084 /* disable queue 0 to prevent tail write w/o re-config */ 2082 /* disable queue 0 to prevent tail write w/o re-config */
2085 wr32(E1000_RXDCTL(0), 0); 2083 wr32(E1000_RXDCTL(0), 0);
2086 2084
2087 vmolr = rd32(E1000_VMOLR(j)); 2085 vmolr = rd32(E1000_VMOLR(adapter->vfs_allocated_count));
2088 if (rctl & E1000_RCTL_LPE) 2086 if (rctl & E1000_RCTL_LPE)
2089 vmolr |= E1000_VMOLR_LPE; 2087 vmolr |= E1000_VMOLR_LPE;
2090 if (adapter->num_rx_queues > 0) 2088 if (adapter->num_rx_queues > 1)
2091 vmolr |= E1000_VMOLR_RSSE; 2089 vmolr |= E1000_VMOLR_RSSE;
2092 wr32(E1000_VMOLR(j), vmolr); 2090 wr32(E1000_VMOLR(adapter->vfs_allocated_count), vmolr);
2093 } 2091 }
2094 2092
2095 for (i = 0; i < adapter->num_rx_queues; i++) { 2093 for (i = 0; i < adapter->num_rx_queues; i++) {
2096 j = adapter->rx_ring[i].reg_idx; 2094 int j = adapter->rx_ring[i].reg_idx;
2097 wr32(E1000_SRRCTL(j), srrctl); 2095 wr32(E1000_SRRCTL(j), srrctl);
2098 } 2096 }
2099 2097
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index e00b5b1f6743..3717569828bf 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -180,6 +180,20 @@ config USB_NET_CDCETHER
180 IEEE 802 "local assignment" bit is set in the address, a "usbX" 180 IEEE 802 "local assignment" bit is set in the address, a "usbX"
181 name is used instead. 181 name is used instead.
182 182
183config USB_NET_CDC_EEM
184 tristate "CDC EEM support"
185 depends on USB_USBNET && EXPERIMENTAL
186 help
187 This option supports devices conforming to the Communication Device
188 Class (CDC) Ethernet Emulation Model, a specification that's easy to
189 implement in device firmware. The CDC EEM specifications are available
190 from <http://www.usb.org/>.
191
192 This driver creates an interface named "ethX", where X depends on
193 what other networking devices you have in use. However, if the
194 IEEE 802 "local assignment" bit is set in the address, a "usbX"
195 name is used instead.
196
183config USB_NET_DM9601 197config USB_NET_DM9601
184 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 198 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
185 depends on USB_USBNET 199 depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index f4402a06e52c..b870b0b1cbe0 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_USB_RTL8150) += rtl8150.o
9obj-$(CONFIG_USB_HSO) += hso.o 9obj-$(CONFIG_USB_HSO) += hso.o
10obj-$(CONFIG_USB_NET_AX8817X) += asix.o 10obj-$(CONFIG_USB_NET_AX8817X) += asix.o
11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o 11obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
12obj-$(CONFIG_USB_NET_CDC_EEM) += cdc_eem.o
12obj-$(CONFIG_USB_NET_DM9601) += dm9601.o 13obj-$(CONFIG_USB_NET_DM9601) += dm9601.o
13obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o 14obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
14obj-$(CONFIG_USB_NET_GL620A) += gl620a.o 15obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
new file mode 100644
index 000000000000..80e01778dd3b
--- /dev/null
+++ b/drivers/net/usb/cdc_eem.c
@@ -0,0 +1,381 @@
1/*
2 * USB CDC EEM network interface driver
3 * Copyright (C) 2009 Oberthur Technologies
4 * by Omar Laazimani, Olivier Condemine
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/netdevice.h>
24#include <linux/etherdevice.h>
25#include <linux/ctype.h>
26#include <linux/ethtool.h>
27#include <linux/workqueue.h>
28#include <linux/mii.h>
29#include <linux/usb.h>
30#include <linux/crc32.h>
31#include <linux/usb/cdc.h>
32#include <linux/usb/usbnet.h>
33
34
35/*
36 * This driver is an implementation of the CDC "Ethernet Emulation
37 * Model" (EEM) specification, which encapsulates Ethernet frames
38 * for transport over USB using a simpler USB device model than the
39 * previous CDC "Ethernet Control Model" (ECM, or "CDC Ethernet").
40 *
41 * For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf
42 *
43 * This version has been tested with GIGAntIC WuaoW SIM Smart Card on 2.6.24,
44 * 2.6.27 and 2.6.30rc2 kernel.
45 * It has also been validated on Openmoko Om 2008.12 (based on 2.6.24 kernel).
46 * build on 23-April-2009
47 */
48
49#define EEM_HEAD 2 /* 2 byte header */
50
51/*-------------------------------------------------------------------------*/
52
53static void eem_linkcmd_complete(struct urb *urb)
54{
55 dev_kfree_skb(urb->context);
56 usb_free_urb(urb);
57}
58
59static void eem_linkcmd(struct usbnet *dev, struct sk_buff *skb)
60{
61 struct urb *urb;
62 int status;
63
64 urb = usb_alloc_urb(0, GFP_ATOMIC);
65 if (!urb)
66 goto fail;
67
68 usb_fill_bulk_urb(urb, dev->udev, dev->out,
69 skb->data, skb->len, eem_linkcmd_complete, skb);
70
71 status = usb_submit_urb(urb, GFP_ATOMIC);
72 if (status) {
73 usb_free_urb(urb);
74fail:
75 dev_kfree_skb(skb);
76 devwarn(dev, "link cmd failure\n");
77 return;
78 }
79}
80
81static int eem_bind(struct usbnet *dev, struct usb_interface *intf)
82{
83 int status = 0;
84
85 status = usbnet_get_endpoints(dev, intf);
86 if (status < 0) {
87 usb_set_intfdata(intf, NULL);
88 usb_driver_release_interface(driver_of(intf), intf);
89 return status;
90 }
91
92 /* no jumbogram (16K) support for now */
93
94 dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
95
96 return 0;
97}
98
99/*
100 * EEM permits packing multiple Ethernet frames into USB transfers
101 * (a "bundle"), but for TX we don't try to do that.
102 */
103static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
104 gfp_t flags)
105{
106 struct sk_buff *skb2 = NULL;
107 u16 len = skb->len;
108 u32 crc = 0;
109 int padlen = 0;
110
111 /* When ((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket) is
112 * zero, stick two bytes of zero length EEM packet on the end.
113 * Else the framework would add invalid single byte padding,
114 * since it can't know whether ZLPs will be handled right by
115 * all the relevant hardware and software.
116 */
117 if (!((len + EEM_HEAD + ETH_FCS_LEN) % dev->maxpacket))
118 padlen += 2;
119
120 if (!skb_cloned(skb)) {
121 int headroom = skb_headroom(skb);
122 int tailroom = skb_tailroom(skb);
123
124 if ((tailroom >= ETH_FCS_LEN + padlen)
125 && (headroom >= EEM_HEAD))
126 goto done;
127
128 if ((headroom + tailroom)
129 > (EEM_HEAD + ETH_FCS_LEN + padlen)) {
130 skb->data = memmove(skb->head +
131 EEM_HEAD,
132 skb->data,
133 skb->len);
134 skb_set_tail_pointer(skb, len);
135 goto done;
136 }
137 }
138
139 skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
140 if (!skb2)
141 return NULL;
142
143 dev_kfree_skb_any(skb);
144 skb = skb2;
145
146done:
147 /* we don't use the "no Ethernet CRC" option */
148 crc = crc32_le(~0, skb->data, skb->len);
149 crc = ~crc;
150
151 put_unaligned_le32(crc, skb_put(skb, 4));
152
153 /* EEM packet header format:
154 * b0..13: length of ethernet frame
155 * b14: bmCRC (1 == valid Ethernet CRC)
156 * b15: bmType (0 == data)
157 */
158 len = skb->len;
159 put_unaligned_le16(BIT(14) | len, skb_push(skb, 2));
160
161 /* Bundle a zero length EEM packet if needed */
162 if (padlen)
163 put_unaligned_le16(0, skb_put(skb, 2));
164
165 return skb;
166}
167
168static int eem_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
169{
170 /*
171 * Our task here is to strip off framing, leaving skb with one
172 * data frame for the usbnet framework code to process. But we
173 * may have received multiple EEM payloads, or command payloads.
174 * So we must process _everything_ as if it's a header, except
175 * maybe the last data payload
176 *
177 * REVISIT the framework needs updating so that when we consume
178 * all payloads (the last or only message was a command, or a
179 * zero length EEM packet) that is not accounted as an rx_error.
180 */
181 do {
182 struct sk_buff *skb2 = NULL;
183 u16 header;
184 u16 len = 0;
185
186 /* incomplete EEM header? */
187 if (skb->len < EEM_HEAD)
188 return 0;
189
190 /*
191 * EEM packet header format:
192 * b0..14: EEM type dependant (Data or Command)
193 * b15: bmType
194 */
195 header = get_unaligned_le16(skb->data);
196 skb_pull(skb, EEM_HEAD);
197
198 /*
199 * The bmType bit helps to denote when EEM
200 * packet is data or command :
201 * bmType = 0 : EEM data payload
202 * bmType = 1 : EEM (link) command
203 */
204 if (header & BIT(15)) {
205 u16 bmEEMCmd;
206
207 /*
208 * EEM (link) command packet:
209 * b0..10: bmEEMCmdParam
210 * b11..13: bmEEMCmd
211 * b14: bmReserved (must be 0)
212 * b15: 1 (EEM command)
213 */
214 if (header & BIT(14)) {
215 devdbg(dev, "reserved command %04x\n", header);
216 continue;
217 }
218
219 bmEEMCmd = (header >> 11) & 0x7;
220 switch (bmEEMCmd) {
221
222 /* Responding to echo requests is mandatory. */
223 case 0: /* Echo command */
224 len = header & 0x7FF;
225
226 /* bogus command? */
227 if (skb->len < len)
228 return 0;
229
230 skb2 = skb_clone(skb, GFP_ATOMIC);
231 if (unlikely(!skb2))
232 goto next;
233 skb_trim(skb2, len);
234 put_unaligned_le16(BIT(15) | (1 << 11) | len,
235 skb_push(skb2, 2));
236 eem_linkcmd(dev, skb2);
237 break;
238
239 /*
240 * Host may choose to ignore hints.
241 * - suspend: peripheral ready to suspend
242 * - response: suggest N millisec polling
243 * - response complete: suggest N sec polling
244 */
245 case 2: /* Suspend hint */
246 case 3: /* Response hint */
247 case 4: /* Response complete hint */
248 continue;
249
250 /*
251 * Hosts should never receive host-to-peripheral
252 * or reserved command codes; or responses to an
253 * echo command we didn't send.
254 */
255 case 1: /* Echo response */
256 case 5: /* Tickle */
257 default: /* reserved */
258 devwarn(dev, "unexpected link command %d\n",
259 bmEEMCmd);
260 continue;
261 }
262
263 } else {
264 u32 crc, crc2;
265 int is_last;
266
267 /* zero length EEM packet? */
268 if (header == 0)
269 continue;
270
271 /*
272 * EEM data packet header :
273 * b0..13: length of ethernet frame
274 * b14: bmCRC
275 * b15: 0 (EEM data)
276 */
277 len = header & 0x3FFF;
278
279 /* bogus EEM payload? */
280 if (skb->len < len)
281 return 0;
282
283 /* bogus ethernet frame? */
284 if (len < (ETH_HLEN + ETH_FCS_LEN))
285 goto next;
286
287 /*
288 * Treat the last payload differently: framework
289 * code expects our "fixup" to have stripped off
290 * headers, so "skb" is a data packet (or error).
291 * Else if it's not the last payload, keep "skb"
292 * for further processing.
293 */
294 is_last = (len == skb->len);
295 if (is_last)
296 skb2 = skb;
297 else {
298 skb2 = skb_clone(skb, GFP_ATOMIC);
299 if (unlikely(!skb2))
300 return 0;
301 }
302
303 crc = get_unaligned_le32(skb2->data
304 + len - ETH_FCS_LEN);
305 skb_trim(skb2, len - ETH_FCS_LEN);
306
307 /*
308 * The bmCRC helps to denote when the CRC field in
309 * the Ethernet frame contains a calculated CRC:
310 * bmCRC = 1 : CRC is calculated
311 * bmCRC = 0 : CRC = 0xDEADBEEF
312 */
313 if (header & BIT(14))
314 crc2 = ~crc32_le(~0, skb2->data, len);
315 else
316 crc2 = 0xdeadbeef;
317
318 if (is_last)
319 return crc == crc2;
320
321 if (unlikely(crc != crc2)) {
322 dev->stats.rx_errors++;
323 dev_kfree_skb_any(skb2);
324 } else
325 usbnet_skb_return(dev, skb2);
326 }
327
328next:
329 skb_pull(skb, len);
330 } while (skb->len);
331
332 return 1;
333}
334
335static const struct driver_info eem_info = {
336 .description = "CDC EEM Device",
337 .flags = FLAG_ETHER,
338 .bind = eem_bind,
339 .rx_fixup = eem_rx_fixup,
340 .tx_fixup = eem_tx_fixup,
341};
342
343/*-------------------------------------------------------------------------*/
344
345static const struct usb_device_id products[] = {
346{
347 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_EEM,
348 USB_CDC_PROTO_EEM),
349 .driver_info = (unsigned long) &eem_info,
350},
351{
352 /* EMPTY == end of list */
353},
354};
355MODULE_DEVICE_TABLE(usb, products);
356
357static struct usb_driver eem_driver = {
358 .name = "cdc_eem",
359 .id_table = products,
360 .probe = usbnet_probe,
361 .disconnect = usbnet_disconnect,
362 .suspend = usbnet_suspend,
363 .resume = usbnet_resume,
364};
365
366
367static int __init eem_init(void)
368{
369 return usb_register(&eem_driver);
370}
371module_init(eem_init);
372
373static void __exit eem_exit(void)
374{
375 usb_deregister(&eem_driver);
376}
377module_exit(eem_exit);
378
379MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>");
380MODULE_DESCRIPTION("USB CDC EEM");
381MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 17a4dd2be1f2..0072ea2c5361 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -719,6 +719,14 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
719{ 719{
720 unsigned long flags; 720 unsigned long flags;
721 int ret = 0; 721 int ret = 0;
722 __le16 key_flags = 0;
723
724 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
725 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
726 key_flags &= ~STA_KEY_FLG_INVALID;
727
728 if (sta_id == priv->hw_params.bcast_sta_id)
729 key_flags |= STA_KEY_MULTICAST_MSK;
722 730
723 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 731 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
724 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 732 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
@@ -738,6 +746,9 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
738 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, 746 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
739 "no space for a new key"); 747 "no space for a new key");
740 748
749 priv->stations[sta_id].sta.key.key_flags = key_flags;
750
751
741 /* This copy is acutally not needed: we get the key with each TX */ 752 /* This copy is acutally not needed: we get the key with each TX */
742 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); 753 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
743 754
@@ -754,9 +765,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
754{ 765{
755 u8 sta_id = IWL_INVALID_STATION; 766 u8 sta_id = IWL_INVALID_STATION;
756 unsigned long flags; 767 unsigned long flags;
757 __le16 key_flags = 0;
758 int i; 768 int i;
759 DECLARE_MAC_BUF(mac);
760 769
761 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 770 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr);
762 if (sta_id == IWL_INVALID_STATION) { 771 if (sta_id == IWL_INVALID_STATION) {
@@ -771,16 +780,8 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
771 return; 780 return;
772 } 781 }
773 782
774 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
775 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
776 key_flags &= ~STA_KEY_FLG_INVALID;
777
778 if (sta_id == priv->hw_params.bcast_sta_id)
779 key_flags |= STA_KEY_MULTICAST_MSK;
780
781 spin_lock_irqsave(&priv->sta_lock, flags); 783 spin_lock_irqsave(&priv->sta_lock, flags);
782 784
783 priv->stations[sta_id].sta.key.key_flags = key_flags;
784 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; 785 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
785 786
786 for (i = 0; i < 5; i++) 787 for (i = 0; i < 5; i++)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a782292ed435..6b42ea2a1f1d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1462,7 +1462,6 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1462 rxq->bd = NULL; 1462 rxq->bd = NULL;
1463 rxq->rb_stts = NULL; 1463 rxq->rb_stts = NULL;
1464} 1464}
1465EXPORT_SYMBOL(iwl3945_rx_queue_free);
1466 1465
1467 1466
1468/* Convert linear signal-to-noise ratio into dB */ 1467/* Convert linear signal-to-noise ratio into dB */
diff --git a/include/linux/netfilter/xt_LED.h b/include/linux/netfilter/xt_LED.h
index 4c91a0d770d0..f5509e7524d3 100644
--- a/include/linux/netfilter/xt_LED.h
+++ b/include/linux/netfilter/xt_LED.h
@@ -1,6 +1,8 @@
1#ifndef _XT_LED_H 1#ifndef _XT_LED_H
2#define _XT_LED_H 2#define _XT_LED_H
3 3
4#include <linux/types.h>
5
4struct xt_led_info { 6struct xt_led_info {
5 char id[27]; /* Unique ID for this trigger in the LED class */ 7 char id[27]; /* Unique ID for this trigger in the LED class */
6 __u8 always_blink; /* Blink even if the LED is already on */ 8 __u8 always_blink; /* Blink even if the LED is already on */
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
index 5e0a0d07b526..886682656f09 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/linux/netfilter/xt_cluster.h
@@ -12,4 +12,6 @@ struct xt_cluster_match_info {
12 u_int32_t flags; 12 u_int32_t flags;
13}; 13};
14 14
15#define XT_CLUSTER_NODES_MAX 32
16
15#endif /* _XT_CLUSTER_MATCH_H */ 17#endif /* _XT_CLUSTER_MATCH_H */
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 3c86ed25a04c..c24124a42ce5 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -17,6 +17,7 @@
17#define USB_CDC_SUBCLASS_DMM 0x09 17#define USB_CDC_SUBCLASS_DMM 0x09
18#define USB_CDC_SUBCLASS_MDLM 0x0a 18#define USB_CDC_SUBCLASS_MDLM 0x0a
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c
20 21
21#define USB_CDC_PROTO_NONE 0 22#define USB_CDC_PROTO_NONE 0
22 23
@@ -28,6 +29,8 @@
28#define USB_CDC_ACM_PROTO_AT_CDMA 6 29#define USB_CDC_ACM_PROTO_AT_CDMA 6
29#define USB_CDC_ACM_PROTO_VENDOR 0xff 30#define USB_CDC_ACM_PROTO_VENDOR 0xff
30 31
32#define USB_CDC_PROTO_EEM 7
33
31/*-------------------------------------------------------------------------*/ 34/*-------------------------------------------------------------------------*/
32 35
33/* 36/*
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index be5bd713d2c9..73aead222b32 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -457,6 +457,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
457 457
458int hci_register_sysfs(struct hci_dev *hdev); 458int hci_register_sysfs(struct hci_dev *hdev);
459void hci_unregister_sysfs(struct hci_dev *hdev); 459void hci_unregister_sysfs(struct hci_dev *hdev);
460void hci_conn_init_sysfs(struct hci_conn *conn);
460void hci_conn_add_sysfs(struct hci_conn *conn); 461void hci_conn_add_sysfs(struct hci_conn *conn);
461void hci_conn_del_sysfs(struct hci_conn *conn); 462void hci_conn_del_sysfs(struct hci_conn *conn);
462 463
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 87d210bb12a4..19f4150f4d4d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -41,6 +41,7 @@
41#include <net/ip.h> 41#include <net/ip.h>
42#include <net/tcp_states.h> 42#include <net/tcp_states.h>
43#include <net/inet_ecn.h> 43#include <net/inet_ecn.h>
44#include <net/dst.h>
44 45
45#include <linux/seq_file.h> 46#include <linux/seq_file.h>
46 47
@@ -543,6 +544,17 @@ static inline void tcp_fast_path_check(struct sock *sk)
543 tcp_fast_path_on(tp); 544 tcp_fast_path_on(tp);
544} 545}
545 546
547/* Compute the actual rto_min value */
548static inline u32 tcp_rto_min(struct sock *sk)
549{
550 struct dst_entry *dst = __sk_dst_get(sk);
551 u32 rto_min = TCP_RTO_MIN;
552
553 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
554 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
555 return rto_min;
556}
557
546/* Compute the actual receive window we are currently advertising. 558/* Compute the actual receive window we are currently advertising.
547 * Rcv_nxt can be after the window if our peer push more data 559 * Rcv_nxt can be after the window if our peer push more data
548 * than the offered window. 560 * than the offered window.
@@ -912,7 +924,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
912 POLLIN | POLLRDNORM | POLLRDBAND); 924 POLLIN | POLLRDNORM | POLLRDBAND);
913 if (!inet_csk_ack_scheduled(sk)) 925 if (!inet_csk_ack_scheduled(sk))
914 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, 926 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
915 (3 * TCP_RTO_MIN) / 4, 927 (3 * tcp_rto_min(sk)) / 4,
916 TCP_RTO_MAX); 928 TCP_RTO_MAX);
917 } 929 }
918 return 1; 930 return 1;
diff --git a/net/Kconfig b/net/Kconfig
index ce77db4fcec8..c19f549c8e74 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -119,12 +119,6 @@ menuconfig NETFILTER
119 <file:Documentation/Changes> under "iptables" for the location of 119 <file:Documentation/Changes> under "iptables" for the location of
120 these packages. 120 these packages.
121 121
122 Make sure to say N to "Fast switching" below if you intend to say Y
123 here, as Fast switching currently bypasses netfilter.
124
125 Chances are that you should say Y here if you compile a kernel which
126 will run as a router and N for regular hosts. If unsure, say N.
127
128if NETFILTER 122if NETFILTER
129 123
130config NETFILTER_DEBUG 124config NETFILTER_DEBUG
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 375f4b4f7f79..61309b26f271 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -248,6 +248,8 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
248 if (hdev->notify) 248 if (hdev->notify)
249 hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); 249 hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
250 250
251 hci_conn_init_sysfs(conn);
252
251 tasklet_enable(&hdev->tx_task); 253 tasklet_enable(&hdev->tx_task);
252 254
253 return conn; 255 return conn;
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index b7c51082ddeb..a05d45eb3ba1 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -9,7 +9,7 @@
9struct class *bt_class = NULL; 9struct class *bt_class = NULL;
10EXPORT_SYMBOL_GPL(bt_class); 10EXPORT_SYMBOL_GPL(bt_class);
11 11
12static struct workqueue_struct *bluetooth; 12static struct workqueue_struct *bt_workq;
13 13
14static inline char *link_typetostr(int type) 14static inline char *link_typetostr(int type)
15{ 15{
@@ -88,9 +88,12 @@ static struct device_type bt_link = {
88static void add_conn(struct work_struct *work) 88static void add_conn(struct work_struct *work)
89{ 89{
90 struct hci_conn *conn = container_of(work, struct hci_conn, work_add); 90 struct hci_conn *conn = container_of(work, struct hci_conn, work_add);
91 struct hci_dev *hdev = conn->hdev;
92
93 /* ensure previous del is complete */
94 flush_work(&conn->work_del);
91 95
92 /* ensure previous add/del is complete */ 96 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
93 flush_workqueue(bluetooth);
94 97
95 if (device_add(&conn->dev) < 0) { 98 if (device_add(&conn->dev) < 0) {
96 BT_ERR("Failed to register connection device"); 99 BT_ERR("Failed to register connection device");
@@ -98,27 +101,6 @@ static void add_conn(struct work_struct *work)
98 } 101 }
99} 102}
100 103
101void hci_conn_add_sysfs(struct hci_conn *conn)
102{
103 struct hci_dev *hdev = conn->hdev;
104
105 BT_DBG("conn %p", conn);
106
107 conn->dev.type = &bt_link;
108 conn->dev.class = bt_class;
109 conn->dev.parent = &hdev->dev;
110
111 dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle);
112
113 dev_set_drvdata(&conn->dev, conn);
114
115 device_initialize(&conn->dev);
116
117 INIT_WORK(&conn->work_add, add_conn);
118
119 queue_work(bluetooth, &conn->work_add);
120}
121
122/* 104/*
123 * The rfcomm tty device will possibly retain even when conn 105 * The rfcomm tty device will possibly retain even when conn
124 * is down, and sysfs doesn't support move zombie device, 106 * is down, and sysfs doesn't support move zombie device,
@@ -134,8 +116,11 @@ static void del_conn(struct work_struct *work)
134 struct hci_conn *conn = container_of(work, struct hci_conn, work_del); 116 struct hci_conn *conn = container_of(work, struct hci_conn, work_del);
135 struct hci_dev *hdev = conn->hdev; 117 struct hci_dev *hdev = conn->hdev;
136 118
137 /* ensure previous add/del is complete */ 119 /* ensure previous add is complete */
138 flush_workqueue(bluetooth); 120 flush_work(&conn->work_add);
121
122 if (!device_is_registered(&conn->dev))
123 return;
139 124
140 while (1) { 125 while (1) {
141 struct device *dev; 126 struct device *dev;
@@ -152,16 +137,36 @@ static void del_conn(struct work_struct *work)
152 hci_dev_put(hdev); 137 hci_dev_put(hdev);
153} 138}
154 139
155void hci_conn_del_sysfs(struct hci_conn *conn) 140void hci_conn_init_sysfs(struct hci_conn *conn)
156{ 141{
142 struct hci_dev *hdev = conn->hdev;
143
157 BT_DBG("conn %p", conn); 144 BT_DBG("conn %p", conn);
158 145
159 if (!device_is_registered(&conn->dev)) 146 conn->dev.type = &bt_link;
160 return; 147 conn->dev.class = bt_class;
148 conn->dev.parent = &hdev->dev;
149
150 dev_set_drvdata(&conn->dev, conn);
151
152 device_initialize(&conn->dev);
161 153
154 INIT_WORK(&conn->work_add, add_conn);
162 INIT_WORK(&conn->work_del, del_conn); 155 INIT_WORK(&conn->work_del, del_conn);
156}
157
158void hci_conn_add_sysfs(struct hci_conn *conn)
159{
160 BT_DBG("conn %p", conn);
161
162 queue_work(bt_workq, &conn->work_add);
163}
164
165void hci_conn_del_sysfs(struct hci_conn *conn)
166{
167 BT_DBG("conn %p", conn);
163 168
164 queue_work(bluetooth, &conn->work_del); 169 queue_work(bt_workq, &conn->work_del);
165} 170}
166 171
167static inline char *host_typetostr(int type) 172static inline char *host_typetostr(int type)
@@ -438,13 +443,13 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
438 443
439int __init bt_sysfs_init(void) 444int __init bt_sysfs_init(void)
440{ 445{
441 bluetooth = create_singlethread_workqueue("bluetooth"); 446 bt_workq = create_singlethread_workqueue("bluetooth");
442 if (!bluetooth) 447 if (!bt_workq)
443 return -ENOMEM; 448 return -ENOMEM;
444 449
445 bt_class = class_create(THIS_MODULE, "bluetooth"); 450 bt_class = class_create(THIS_MODULE, "bluetooth");
446 if (IS_ERR(bt_class)) { 451 if (IS_ERR(bt_class)) {
447 destroy_workqueue(bluetooth); 452 destroy_workqueue(bt_workq);
448 return PTR_ERR(bt_class); 453 return PTR_ERR(bt_class);
449 } 454 }
450 455
@@ -453,7 +458,7 @@ int __init bt_sysfs_init(void)
453 458
454void bt_sysfs_cleanup(void) 459void bt_sysfs_cleanup(void)
455{ 460{
456 destroy_workqueue(bluetooth); 461 destroy_workqueue(bt_workq);
457 462
458 class_destroy(bt_class); 463 class_destroy(bt_class);
459} 464}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f091a5a845c1..d152394b2611 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -502,7 +502,9 @@ int skb_recycle_check(struct sk_buff *skb, int skb_size)
502 shinfo->gso_segs = 0; 502 shinfo->gso_segs = 0;
503 shinfo->gso_type = 0; 503 shinfo->gso_type = 0;
504 shinfo->ip6_frag_id = 0; 504 shinfo->ip6_frag_id = 0;
505 shinfo->tx_flags.flags = 0;
505 shinfo->frag_list = NULL; 506 shinfo->frag_list = NULL;
507 memset(&shinfo->hwtstamps, 0, sizeof(shinfo->hwtstamps));
506 508
507 memset(skb, 0, offsetof(struct sk_buff, tail)); 509 memset(skb, 0, offsetof(struct sk_buff, tail));
508 skb->data = skb->head + NET_SKB_PAD; 510 skb->data = skb->head + NET_SKB_PAD;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 56dcf97a97fb..eeb8a92aa416 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -597,16 +597,6 @@ static void tcp_event_data_recv(struct sock *sk, struct sk_buff *skb)
597 tcp_grow_window(sk, skb); 597 tcp_grow_window(sk, skb);
598} 598}
599 599
600static u32 tcp_rto_min(struct sock *sk)
601{
602 struct dst_entry *dst = __sk_dst_get(sk);
603 u32 rto_min = TCP_RTO_MIN;
604
605 if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
606 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
607 return rto_min;
608}
609
610/* Called to compute a smoothed rtt estimate. The data fed to this 600/* Called to compute a smoothed rtt estimate. The data fed to this
611 * routine either comes from timestamps, or from segments that were 601 * routine either comes from timestamps, or from segments that were
612 * known _not_ to have been retransmitted [see Karn/Partridge 602 * known _not_ to have been retransmitted [see Karn/Partridge
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c
index 14e6724d5672..91490ad9302c 100644
--- a/net/ipv6/netfilter/ip6t_ipv6header.c
+++ b/net/ipv6/netfilter/ip6t_ipv6header.c
@@ -50,14 +50,14 @@ ipv6header_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
50 struct ipv6_opt_hdr _hdr; 50 struct ipv6_opt_hdr _hdr;
51 int hdrlen; 51 int hdrlen;
52 52
53 /* Is there enough space for the next ext header? */
54 if (len < (int)sizeof(struct ipv6_opt_hdr))
55 return false;
56 /* No more exthdr -> evaluate */ 53 /* No more exthdr -> evaluate */
57 if (nexthdr == NEXTHDR_NONE) { 54 if (nexthdr == NEXTHDR_NONE) {
58 temp |= MASK_NONE; 55 temp |= MASK_NONE;
59 break; 56 break;
60 } 57 }
58 /* Is there enough space for the next ext header? */
59 if (len < (int)sizeof(struct ipv6_opt_hdr))
60 return false;
61 /* ESP -> evaluate */ 61 /* ESP -> evaluate */
62 if (nexthdr == NEXTHDR_ESP) { 62 if (nexthdr == NEXTHDR_ESP) {
63 temp |= MASK_ESP; 63 temp |= MASK_ESP;
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 3824990d340b..70df3dcc3cf6 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -476,7 +476,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
476 return NULL; 476 return NULL;
477 477
478 for (i = 0; i < IEEE80211_NUM_BANDS; i++) { 478 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
479 sband = hw->wiphy->bands[hw->conf.channel->band]; 479 sband = hw->wiphy->bands[i];
480 if (sband->n_bitrates > max_rates) 480 if (sband->n_bitrates > max_rates)
481 max_rates = sband->n_bitrates; 481 max_rates = sband->n_bitrates;
482 } 482 }
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index b16801cde06f..01d59a8e334c 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -317,13 +317,44 @@ rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband,
317 struct ieee80211_sta *sta, void *priv_sta) 317 struct ieee80211_sta *sta, void *priv_sta)
318{ 318{
319 struct rc_pid_sta_info *spinfo = priv_sta; 319 struct rc_pid_sta_info *spinfo = priv_sta;
320 struct rc_pid_info *pinfo = priv;
321 struct rc_pid_rateinfo *rinfo = pinfo->rinfo;
320 struct sta_info *si; 322 struct sta_info *si;
323 int i, j, tmp;
324 bool s;
321 325
322 /* TODO: This routine should consider using RSSI from previous packets 326 /* TODO: This routine should consider using RSSI from previous packets
323 * as we need to have IEEE 802.1X auth succeed immediately after assoc.. 327 * as we need to have IEEE 802.1X auth succeed immediately after assoc..
324 * Until that method is implemented, we will use the lowest supported 328 * Until that method is implemented, we will use the lowest supported
325 * rate as a workaround. */ 329 * rate as a workaround. */
326 330
331 /* Sort the rates. This is optimized for the most common case (i.e.
332 * almost-sorted CCK+OFDM rates). Kind of bubble-sort with reversed
333 * mapping too. */
334 for (i = 0; i < sband->n_bitrates; i++) {
335 rinfo[i].index = i;
336 rinfo[i].rev_index = i;
337 if (RC_PID_FAST_START)
338 rinfo[i].diff = 0;
339 else
340 rinfo[i].diff = i * pinfo->norm_offset;
341 }
342 for (i = 1; i < sband->n_bitrates; i++) {
343 s = 0;
344 for (j = 0; j < sband->n_bitrates - i; j++)
345 if (unlikely(sband->bitrates[rinfo[j].index].bitrate >
346 sband->bitrates[rinfo[j + 1].index].bitrate)) {
347 tmp = rinfo[j].index;
348 rinfo[j].index = rinfo[j + 1].index;
349 rinfo[j + 1].index = tmp;
350 rinfo[rinfo[j].index].rev_index = j;
351 rinfo[rinfo[j + 1].index].rev_index = j + 1;
352 s = 1;
353 }
354 if (!s)
355 break;
356 }
357
327 spinfo->txrate_idx = rate_lowest_index(sband, sta); 358 spinfo->txrate_idx = rate_lowest_index(sband, sta);
328 /* HACK */ 359 /* HACK */
329 si = container_of(sta, struct sta_info, sta); 360 si = container_of(sta, struct sta_info, sta);
@@ -336,21 +367,22 @@ static void *rate_control_pid_alloc(struct ieee80211_hw *hw,
336 struct rc_pid_info *pinfo; 367 struct rc_pid_info *pinfo;
337 struct rc_pid_rateinfo *rinfo; 368 struct rc_pid_rateinfo *rinfo;
338 struct ieee80211_supported_band *sband; 369 struct ieee80211_supported_band *sband;
339 int i, j, tmp; 370 int i, max_rates = 0;
340 bool s;
341#ifdef CONFIG_MAC80211_DEBUGFS 371#ifdef CONFIG_MAC80211_DEBUGFS
342 struct rc_pid_debugfs_entries *de; 372 struct rc_pid_debugfs_entries *de;
343#endif 373#endif
344 374
345 sband = hw->wiphy->bands[hw->conf.channel->band];
346
347 pinfo = kmalloc(sizeof(*pinfo), GFP_ATOMIC); 375 pinfo = kmalloc(sizeof(*pinfo), GFP_ATOMIC);
348 if (!pinfo) 376 if (!pinfo)
349 return NULL; 377 return NULL;
350 378
351 /* We can safely assume that sband won't change unless we get 379 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
352 * reinitialized. */ 380 sband = hw->wiphy->bands[i];
353 rinfo = kmalloc(sizeof(*rinfo) * sband->n_bitrates, GFP_ATOMIC); 381 if (sband->n_bitrates > max_rates)
382 max_rates = sband->n_bitrates;
383 }
384
385 rinfo = kmalloc(sizeof(*rinfo) * max_rates, GFP_ATOMIC);
354 if (!rinfo) { 386 if (!rinfo) {
355 kfree(pinfo); 387 kfree(pinfo);
356 return NULL; 388 return NULL;
@@ -368,33 +400,6 @@ static void *rate_control_pid_alloc(struct ieee80211_hw *hw,
368 pinfo->rinfo = rinfo; 400 pinfo->rinfo = rinfo;
369 pinfo->oldrate = 0; 401 pinfo->oldrate = 0;
370 402
371 /* Sort the rates. This is optimized for the most common case (i.e.
372 * almost-sorted CCK+OFDM rates). Kind of bubble-sort with reversed
373 * mapping too. */
374 for (i = 0; i < sband->n_bitrates; i++) {
375 rinfo[i].index = i;
376 rinfo[i].rev_index = i;
377 if (RC_PID_FAST_START)
378 rinfo[i].diff = 0;
379 else
380 rinfo[i].diff = i * pinfo->norm_offset;
381 }
382 for (i = 1; i < sband->n_bitrates; i++) {
383 s = 0;
384 for (j = 0; j < sband->n_bitrates - i; j++)
385 if (unlikely(sband->bitrates[rinfo[j].index].bitrate >
386 sband->bitrates[rinfo[j + 1].index].bitrate)) {
387 tmp = rinfo[j].index;
388 rinfo[j].index = rinfo[j + 1].index;
389 rinfo[j + 1].index = tmp;
390 rinfo[rinfo[j].index].rev_index = j;
391 rinfo[rinfo[j + 1].index].rev_index = j + 1;
392 s = 1;
393 }
394 if (!s)
395 break;
396 }
397
398#ifdef CONFIG_MAC80211_DEBUGFS 403#ifdef CONFIG_MAC80211_DEBUGFS
399 de = &pinfo->dentries; 404 de = &pinfo->dentries;
400 de->target = debugfs_create_u32("target_pf", S_IRUSR | S_IWUSR, 405 de->target = debugfs_create_u32("target_pf", S_IRUSR | S_IWUSR,
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1865622003c9..e5b148fe24bb 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -787,7 +787,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
787 hdrlen = ieee80211_hdrlen(hdr->frame_control); 787 hdrlen = ieee80211_hdrlen(hdr->frame_control);
788 788
789 /* internal error, why is TX_FRAGMENTED set? */ 789 /* internal error, why is TX_FRAGMENTED set? */
790 if (WARN_ON(skb->len <= frag_threshold)) 790 if (WARN_ON(skb->len + FCS_LEN <= frag_threshold))
791 return TX_DROP; 791 return TX_DROP;
792 792
793 /* 793 /*
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index f13fc57e1ecb..c523f0b8cee5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1186,28 +1186,6 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nlattr *cda[])
1186 return 0; 1186 return 0;
1187} 1187}
1188 1188
1189static inline void
1190ctnetlink_event_report(struct nf_conn *ct, u32 pid, int report)
1191{
1192 unsigned int events = 0;
1193
1194 if (test_bit(IPS_EXPECTED_BIT, &ct->status))
1195 events |= IPCT_RELATED;
1196 else
1197 events |= IPCT_NEW;
1198
1199 nf_conntrack_event_report(IPCT_STATUS |
1200 IPCT_HELPER |
1201 IPCT_REFRESH |
1202 IPCT_PROTOINFO |
1203 IPCT_NATSEQADJ |
1204 IPCT_MARK |
1205 events,
1206 ct,
1207 pid,
1208 report);
1209}
1210
1211static struct nf_conn * 1189static struct nf_conn *
1212ctnetlink_create_conntrack(struct nlattr *cda[], 1190ctnetlink_create_conntrack(struct nlattr *cda[],
1213 struct nf_conntrack_tuple *otuple, 1191 struct nf_conntrack_tuple *otuple,
@@ -1373,6 +1351,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1373 err = -ENOENT; 1351 err = -ENOENT;
1374 if (nlh->nlmsg_flags & NLM_F_CREATE) { 1352 if (nlh->nlmsg_flags & NLM_F_CREATE) {
1375 struct nf_conn *ct; 1353 struct nf_conn *ct;
1354 enum ip_conntrack_events events;
1376 1355
1377 ct = ctnetlink_create_conntrack(cda, &otuple, 1356 ct = ctnetlink_create_conntrack(cda, &otuple,
1378 &rtuple, u3); 1357 &rtuple, u3);
@@ -1383,9 +1362,18 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1383 err = 0; 1362 err = 0;
1384 nf_conntrack_get(&ct->ct_general); 1363 nf_conntrack_get(&ct->ct_general);
1385 spin_unlock_bh(&nf_conntrack_lock); 1364 spin_unlock_bh(&nf_conntrack_lock);
1386 ctnetlink_event_report(ct, 1365 if (test_bit(IPS_EXPECTED_BIT, &ct->status))
1387 NETLINK_CB(skb).pid, 1366 events = IPCT_RELATED;
1388 nlmsg_report(nlh)); 1367 else
1368 events = IPCT_NEW;
1369
1370 nf_conntrack_event_report(IPCT_STATUS |
1371 IPCT_HELPER |
1372 IPCT_PROTOINFO |
1373 IPCT_NATSEQADJ |
1374 IPCT_MARK | events,
1375 ct, NETLINK_CB(skb).pid,
1376 nlmsg_report(nlh));
1389 nf_ct_put(ct); 1377 nf_ct_put(ct);
1390 } else 1378 } else
1391 spin_unlock_bh(&nf_conntrack_lock); 1379 spin_unlock_bh(&nf_conntrack_lock);
@@ -1404,9 +1392,13 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1404 if (err == 0) { 1392 if (err == 0) {
1405 nf_conntrack_get(&ct->ct_general); 1393 nf_conntrack_get(&ct->ct_general);
1406 spin_unlock_bh(&nf_conntrack_lock); 1394 spin_unlock_bh(&nf_conntrack_lock);
1407 ctnetlink_event_report(ct, 1395 nf_conntrack_event_report(IPCT_STATUS |
1408 NETLINK_CB(skb).pid, 1396 IPCT_HELPER |
1409 nlmsg_report(nlh)); 1397 IPCT_PROTOINFO |
1398 IPCT_NATSEQADJ |
1399 IPCT_MARK,
1400 ct, NETLINK_CB(skb).pid,
1401 nlmsg_report(nlh));
1410 nf_ct_put(ct); 1402 nf_ct_put(ct);
1411 } else 1403 } else
1412 spin_unlock_bh(&nf_conntrack_lock); 1404 spin_unlock_bh(&nf_conntrack_lock);
diff --git a/net/netfilter/xt_cluster.c b/net/netfilter/xt_cluster.c
index 6c4847662b85..69a639f35403 100644
--- a/net/netfilter/xt_cluster.c
+++ b/net/netfilter/xt_cluster.c
@@ -135,7 +135,13 @@ static bool xt_cluster_mt_checkentry(const struct xt_mtchk_param *par)
135{ 135{
136 struct xt_cluster_match_info *info = par->matchinfo; 136 struct xt_cluster_match_info *info = par->matchinfo;
137 137
138 if (info->node_mask >= (1 << info->total_nodes)) { 138 if (info->total_nodes > XT_CLUSTER_NODES_MAX) {
139 printk(KERN_ERR "xt_cluster: you have exceeded the maximum "
140 "number of cluster nodes (%u > %u)\n",
141 info->total_nodes, XT_CLUSTER_NODES_MAX);
142 return false;
143 }
144 if (info->node_mask >= (1ULL << info->total_nodes)) {
139 printk(KERN_ERR "xt_cluster: this node mask cannot be " 145 printk(KERN_ERR "xt_cluster: this node mask cannot be "
140 "higher than the total number of nodes\n"); 146 "higher than the total number of nodes\n");
141 return false; 147 return false;
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index 92cfc9d7e3b9..69188e8358b4 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -51,7 +51,7 @@ static int fifo_init(struct Qdisc *sch, struct nlattr *opt)
51 u32 limit = qdisc_dev(sch)->tx_queue_len ? : 1; 51 u32 limit = qdisc_dev(sch)->tx_queue_len ? : 1;
52 52
53 if (sch->ops == &bfifo_qdisc_ops) 53 if (sch->ops == &bfifo_qdisc_ops)
54 limit *= qdisc_dev(sch)->mtu; 54 limit *= psched_mtu(qdisc_dev(sch));
55 55
56 q->limit = limit; 56 q->limit = limit;
57 } else { 57 } else {
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c
index 5d149c1b5f0d..9ad4d893a566 100644
--- a/net/wimax/op-msg.c
+++ b/net/wimax/op-msg.c
@@ -149,7 +149,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
149 } 149 }
150 result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg); 150 result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
151 if (result < 0) { 151 if (result < 0) {
152 dev_err(dev, "no memory to add payload in attribute\n"); 152 dev_err(dev, "no memory to add payload (msg %p size %zu) in "
153 "attribute: %d\n", msg, size, result);
153 goto error_nla_put; 154 goto error_nla_put;
154 } 155 }
155 genlmsg_end(skb, genl_msg); 156 genlmsg_end(skb, genl_msg);
@@ -299,10 +300,10 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
299 struct sk_buff *skb; 300 struct sk_buff *skb;
300 301
301 skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags); 302 skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags);
302 if (skb == NULL) 303 if (IS_ERR(skb))
303 goto error_msg_new; 304 result = PTR_ERR(skb);
304 result = wimax_msg_send(wimax_dev, skb); 305 else
305error_msg_new: 306 result = wimax_msg_send(wimax_dev, skb);
306 return result; 307 return result;
307} 308}
308EXPORT_SYMBOL_GPL(wimax_msg); 309EXPORT_SYMBOL_GPL(wimax_msg);
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index a0ee76b52510..933e1422b09f 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -338,8 +338,21 @@ out:
338 */ 338 */
339void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state) 339void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
340{ 340{
341 /*
342 * A driver cannot take the wimax_dev out of the
343 * __WIMAX_ST_NULL state unless by calling wimax_dev_add(). If
344 * the wimax_dev's state is still NULL, we ignore any request
345 * to change its state because it means it hasn't been yet
346 * registered.
347 *
348 * There is no need to complain about it, as routines that
349 * call this might be shared from different code paths that
350 * are called before or after wimax_dev_add() has done its
351 * job.
352 */
341 mutex_lock(&wimax_dev->mutex); 353 mutex_lock(&wimax_dev->mutex);
342 __wimax_state_change(wimax_dev, new_state); 354 if (wimax_dev->state > __WIMAX_ST_NULL)
355 __wimax_state_change(wimax_dev, new_state);
343 mutex_unlock(&wimax_dev->mutex); 356 mutex_unlock(&wimax_dev->mutex);
344 return; 357 return;
345} 358}
@@ -376,7 +389,7 @@ EXPORT_SYMBOL_GPL(wimax_state_get);
376void wimax_dev_init(struct wimax_dev *wimax_dev) 389void wimax_dev_init(struct wimax_dev *wimax_dev)
377{ 390{
378 INIT_LIST_HEAD(&wimax_dev->id_table_node); 391 INIT_LIST_HEAD(&wimax_dev->id_table_node);
379 __wimax_state_set(wimax_dev, WIMAX_ST_UNINITIALIZED); 392 __wimax_state_set(wimax_dev, __WIMAX_ST_NULL);
380 mutex_init(&wimax_dev->mutex); 393 mutex_init(&wimax_dev->mutex);
381 mutex_init(&wimax_dev->mutex_reset); 394 mutex_init(&wimax_dev->mutex_reset);
382} 395}
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f38cc39fa79e..139d13fdc94f 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -906,6 +906,7 @@ EXPORT_SYMBOL(freq_reg_info);
906int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth, 906int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
907 const struct ieee80211_reg_rule **reg_rule) 907 const struct ieee80211_reg_rule **reg_rule)
908{ 908{
909 assert_cfg80211_lock();
909 return freq_reg_info_regd(wiphy, center_freq, 910 return freq_reg_info_regd(wiphy, center_freq,
910 bandwidth, reg_rule, NULL); 911 bandwidth, reg_rule, NULL);
911} 912}
@@ -1134,7 +1135,8 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
1134 if (is_world_regdom(cfg80211_regdomain->alpha2) || 1135 if (is_world_regdom(cfg80211_regdomain->alpha2) ||
1135 (wiphy->regd && is_world_regdom(wiphy->regd->alpha2))) 1136 (wiphy->regd && is_world_regdom(wiphy->regd->alpha2)))
1136 return true; 1137 return true;
1137 if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && 1138 if (last_request &&
1139 last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
1138 wiphy->custom_regulatory) 1140 wiphy->custom_regulatory)
1139 return true; 1141 return true;
1140 return false; 1142 return false;
@@ -1143,6 +1145,12 @@ static bool reg_is_world_roaming(struct wiphy *wiphy)
1143/* Reap the advantages of previously found beacons */ 1145/* Reap the advantages of previously found beacons */
1144static void reg_process_beacons(struct wiphy *wiphy) 1146static void reg_process_beacons(struct wiphy *wiphy)
1145{ 1147{
1148 /*
1149 * Means we are just firing up cfg80211, so no beacons would
1150 * have been processed yet.
1151 */
1152 if (!last_request)
1153 return;
1146 if (!reg_is_world_roaming(wiphy)) 1154 if (!reg_is_world_roaming(wiphy))
1147 return; 1155 return;
1148 wiphy_update_beacon_reg(wiphy); 1156 wiphy_update_beacon_reg(wiphy);
@@ -1177,6 +1185,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
1177 struct ieee80211_supported_band *sband; 1185 struct ieee80211_supported_band *sband;
1178 struct ieee80211_channel *chan; 1186 struct ieee80211_channel *chan;
1179 1187
1188 assert_cfg80211_lock();
1189
1180 sband = wiphy->bands[band]; 1190 sband = wiphy->bands[band];
1181 BUG_ON(chan_idx >= sband->n_channels); 1191 BUG_ON(chan_idx >= sband->n_channels);
1182 chan = &sband->channels[chan_idx]; 1192 chan = &sband->channels[chan_idx];
@@ -1215,10 +1225,13 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
1215 const struct ieee80211_regdomain *regd) 1225 const struct ieee80211_regdomain *regd)
1216{ 1226{
1217 enum ieee80211_band band; 1227 enum ieee80211_band band;
1228
1229 mutex_lock(&cfg80211_mutex);
1218 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 1230 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
1219 if (wiphy->bands[band]) 1231 if (wiphy->bands[band])
1220 handle_band_custom(wiphy, band, regd); 1232 handle_band_custom(wiphy, band, regd);
1221 } 1233 }
1234 mutex_unlock(&cfg80211_mutex);
1222} 1235}
1223EXPORT_SYMBOL(wiphy_apply_custom_regulatory); 1236EXPORT_SYMBOL(wiphy_apply_custom_regulatory);
1224 1237
@@ -1424,7 +1437,7 @@ new_request:
1424 return call_crda(last_request->alpha2); 1437 return call_crda(last_request->alpha2);
1425} 1438}
1426 1439
1427/* This currently only processes user and driver regulatory hints */ 1440/* This processes *all* regulatory hints */
1428static void reg_process_hint(struct regulatory_request *reg_request) 1441static void reg_process_hint(struct regulatory_request *reg_request)
1429{ 1442{
1430 int r = 0; 1443 int r = 0;
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 723aeb3d9462..dfb53d19fd77 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -395,6 +395,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
395 memcpy(ies, res->pub.information_elements, ielen); 395 memcpy(ies, res->pub.information_elements, ielen);
396 found->ies_allocated = true; 396 found->ies_allocated = true;
397 found->pub.information_elements = ies; 397 found->pub.information_elements = ies;
398 found->pub.len_information_elements = ielen;
398 } 399 }
399 } 400 }
400 } 401 }