aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/8xx_immap.h4
-rw-r--r--drivers/net/atl1c/atl1c.h6
-rw-r--r--drivers/net/atl1c/atl1c_main.c14
-rw-r--r--drivers/net/benet/be_main.c1
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c34
-rw-r--r--drivers/net/bonding/bond_3ad.c7
-rw-r--r--drivers/net/ehea/ehea_main.c9
-rw-r--r--drivers/net/fs_enet/mac-fec.c8
-rw-r--r--drivers/net/netconsole.c8
-rw-r--r--drivers/net/r8169.c108
-rw-r--r--drivers/net/usb/cdc_ncm.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-tx.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c10
-rw-r--r--net/bluetooth/hci_core.c5
-rw-r--r--net/bluetooth/hci_event.c2
-rw-r--r--net/bluetooth/l2cap_core.c1
-rw-r--r--net/bluetooth/sco.c9
-rw-r--r--net/bridge/br_input.c2
-rw-r--r--net/can/bcm.c7
-rw-r--r--net/can/raw.c7
-rw-r--r--net/ipv4/route.c7
-rw-r--r--net/ipv6/route.c8
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/mac80211/cfg.c2
-rw-r--r--net/mac80211/debugfs_netdev.c4
-rw-r--r--net/netfilter/ipset/ip_set_bitmap_ipmac.c4
-rw-r--r--net/netfilter/ipset/ip_set_core.c18
-rw-r--r--net/netfilter/xt_set.c18
30 files changed, 226 insertions, 102 deletions
diff --git a/arch/powerpc/include/asm/8xx_immap.h b/arch/powerpc/include/asm/8xx_immap.h
index 6b6dc20b0beb..bdf0563ba423 100644
--- a/arch/powerpc/include/asm/8xx_immap.h
+++ b/arch/powerpc/include/asm/8xx_immap.h
@@ -393,8 +393,8 @@ typedef struct fec {
393 uint fec_addr_low; /* lower 32 bits of station address */ 393 uint fec_addr_low; /* lower 32 bits of station address */
394 ushort fec_addr_high; /* upper 16 bits of station address */ 394 ushort fec_addr_high; /* upper 16 bits of station address */
395 ushort res1; /* reserved */ 395 ushort res1; /* reserved */
396 uint fec_hash_table_high; /* upper 32-bits of hash table */ 396 uint fec_grp_hash_table_high; /* upper 32-bits of hash table */
397 uint fec_hash_table_low; /* lower 32-bits of hash table */ 397 uint fec_grp_hash_table_low; /* lower 32-bits of hash table */
398 uint fec_r_des_start; /* beginning of Rx descriptor ring */ 398 uint fec_r_des_start; /* beginning of Rx descriptor ring */
399 uint fec_x_des_start; /* beginning of Tx descriptor ring */ 399 uint fec_x_des_start; /* beginning of Tx descriptor ring */
400 uint fec_r_buff_size; /* Rx buffer size */ 400 uint fec_r_buff_size; /* Rx buffer size */
diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index 7cb375e0e29c..925929d764ca 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -566,9 +566,9 @@ struct atl1c_adapter {
566#define __AT_TESTING 0x0001 566#define __AT_TESTING 0x0001
567#define __AT_RESETTING 0x0002 567#define __AT_RESETTING 0x0002
568#define __AT_DOWN 0x0003 568#define __AT_DOWN 0x0003
569 u8 work_event; 569 unsigned long work_event;
570#define ATL1C_WORK_EVENT_RESET 0x01 570#define ATL1C_WORK_EVENT_RESET 0
571#define ATL1C_WORK_EVENT_LINK_CHANGE 0x02 571#define ATL1C_WORK_EVENT_LINK_CHANGE 1
572 u32 msg_enable; 572 u32 msg_enable;
573 573
574 bool have_msi; 574 bool have_msi;
diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
index 5c64a5d91544..48868de386a0 100644
--- a/drivers/net/atl1c/atl1c_main.c
+++ b/drivers/net/atl1c/atl1c_main.c
@@ -325,7 +325,7 @@ static void atl1c_link_chg_event(struct atl1c_adapter *adapter)
325 } 325 }
326 } 326 }
327 327
328 adapter->work_event |= ATL1C_WORK_EVENT_LINK_CHANGE; 328 set_bit(ATL1C_WORK_EVENT_LINK_CHANGE, &adapter->work_event);
329 schedule_work(&adapter->common_task); 329 schedule_work(&adapter->common_task);
330} 330}
331 331
@@ -337,20 +337,16 @@ static void atl1c_common_task(struct work_struct *work)
337 adapter = container_of(work, struct atl1c_adapter, common_task); 337 adapter = container_of(work, struct atl1c_adapter, common_task);
338 netdev = adapter->netdev; 338 netdev = adapter->netdev;
339 339
340 if (adapter->work_event & ATL1C_WORK_EVENT_RESET) { 340 if (test_and_clear_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event)) {
341 adapter->work_event &= ~ATL1C_WORK_EVENT_RESET;
342 netif_device_detach(netdev); 341 netif_device_detach(netdev);
343 atl1c_down(adapter); 342 atl1c_down(adapter);
344 atl1c_up(adapter); 343 atl1c_up(adapter);
345 netif_device_attach(netdev); 344 netif_device_attach(netdev);
346 return;
347 } 345 }
348 346
349 if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE) { 347 if (test_and_clear_bit(ATL1C_WORK_EVENT_LINK_CHANGE,
350 adapter->work_event &= ~ATL1C_WORK_EVENT_LINK_CHANGE; 348 &adapter->work_event))
351 atl1c_check_link_status(adapter); 349 atl1c_check_link_status(adapter);
352 }
353 return;
354} 350}
355 351
356 352
@@ -369,7 +365,7 @@ static void atl1c_tx_timeout(struct net_device *netdev)
369 struct atl1c_adapter *adapter = netdev_priv(netdev); 365 struct atl1c_adapter *adapter = netdev_priv(netdev);
370 366
371 /* Do the reset outside of interrupt context */ 367 /* Do the reset outside of interrupt context */
372 adapter->work_event |= ATL1C_WORK_EVENT_RESET; 368 set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event);
373 schedule_work(&adapter->common_task); 369 schedule_work(&adapter->common_task);
374} 370}
375 371
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 35294005361b..7b19931acba1 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1907,6 +1907,7 @@ static void be_worker(struct work_struct *work)
1907 } 1907 }
1908 1908
1909reschedule: 1909reschedule:
1910 adapter->work_counter++;
1910 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); 1911 schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000));
1911} 1912}
1912 1913
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index bec33a87bcdc..8729061a4fd5 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -2019,15 +2019,23 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb,
2019static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb, 2019static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb,
2020 u32 *parsing_data, u32 xmit_type) 2020 u32 *parsing_data, u32 xmit_type)
2021{ 2021{
2022 *parsing_data |= ((tcp_hdrlen(skb)/4) << 2022 *parsing_data |=
2023 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) & 2023 ((((u8 *)skb_transport_header(skb) - skb->data) >> 1) <<
2024 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW; 2024 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) &
2025 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W;
2025 2026
2026 *parsing_data |= ((((u8 *)tcp_hdr(skb) - skb->data) / 2) << 2027 if (xmit_type & XMIT_CSUM_TCP) {
2027 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) & 2028 *parsing_data |= ((tcp_hdrlen(skb) / 4) <<
2028 ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W; 2029 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) &
2030 ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW;
2029 2031
2030 return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data; 2032 return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data;
2033 } else
2034 /* We support checksum offload for TCP and UDP only.
2035 * No need to pass the UDP header length - it's a constant.
2036 */
2037 return skb_transport_header(skb) +
2038 sizeof(struct udphdr) - skb->data;
2031} 2039}
2032 2040
2033/** 2041/**
@@ -2043,7 +2051,7 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
2043 struct eth_tx_parse_bd_e1x *pbd, 2051 struct eth_tx_parse_bd_e1x *pbd,
2044 u32 xmit_type) 2052 u32 xmit_type)
2045{ 2053{
2046 u8 hlen = (skb_network_header(skb) - skb->data) / 2; 2054 u8 hlen = (skb_network_header(skb) - skb->data) >> 1;
2047 2055
2048 /* for now NS flag is not used in Linux */ 2056 /* for now NS flag is not used in Linux */
2049 pbd->global_data = 2057 pbd->global_data =
@@ -2051,9 +2059,15 @@ static inline u8 bnx2x_set_pbd_csum(struct bnx2x *bp, struct sk_buff *skb,
2051 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT)); 2059 ETH_TX_PARSE_BD_E1X_LLC_SNAP_EN_SHIFT));
2052 2060
2053 pbd->ip_hlen_w = (skb_transport_header(skb) - 2061 pbd->ip_hlen_w = (skb_transport_header(skb) -
2054 skb_network_header(skb)) / 2; 2062 skb_network_header(skb)) >> 1;
2055 2063
2056 hlen += pbd->ip_hlen_w + tcp_hdrlen(skb) / 2; 2064 hlen += pbd->ip_hlen_w;
2065
2066 /* We support checksum offload for TCP and UDP only */
2067 if (xmit_type & XMIT_CSUM_TCP)
2068 hlen += tcp_hdrlen(skb) / 2;
2069 else
2070 hlen += sizeof(struct udphdr) / 2;
2057 2071
2058 pbd->total_hlen_w = cpu_to_le16(hlen); 2072 pbd->total_hlen_w = cpu_to_le16(hlen);
2059 hlen = hlen*2; 2073 hlen = hlen*2;
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index d0981c2ffbda..d4160f87e910 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1480,8 +1480,11 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1480 1480
1481static int agg_device_up(const struct aggregator *agg) 1481static int agg_device_up(const struct aggregator *agg)
1482{ 1482{
1483 return (netif_running(agg->slave->dev) && 1483 struct port *port = agg->lag_ports;
1484 netif_carrier_ok(agg->slave->dev)); 1484 if (!port)
1485 return 0;
1486 return (netif_running(port->slave->dev) &&
1487 netif_carrier_ok(port->slave->dev));
1485} 1488}
1486 1489
1487/** 1490/**
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index ce2f0ca61d9a..a004bbcf72e6 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -3040,11 +3040,14 @@ static void ehea_rereg_mrs(void)
3040 3040
3041 if (dev->flags & IFF_UP) { 3041 if (dev->flags & IFF_UP) {
3042 mutex_lock(&port->port_lock); 3042 mutex_lock(&port->port_lock);
3043 port_napi_enable(port);
3044 ret = ehea_restart_qps(dev); 3043 ret = ehea_restart_qps(dev);
3045 check_sqs(port); 3044 if (!ret) {
3046 if (!ret) 3045 check_sqs(port);
3046 port_napi_enable(port);
3047 netif_wake_queue(dev); 3047 netif_wake_queue(dev);
3048 } else {
3049 netdev_err(dev, "Unable to restart QPS\n");
3050 }
3048 mutex_unlock(&port->port_lock); 3051 mutex_unlock(&port->port_lock);
3049 } 3052 }
3050 } 3053 }
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 61035fc5599b..b9fbc83d64a7 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -226,8 +226,8 @@ static void set_multicast_finish(struct net_device *dev)
226 } 226 }
227 227
228 FC(fecp, r_cntrl, FEC_RCNTRL_PROM); 228 FC(fecp, r_cntrl, FEC_RCNTRL_PROM);
229 FW(fecp, hash_table_high, fep->fec.hthi); 229 FW(fecp, grp_hash_table_high, fep->fec.hthi);
230 FW(fecp, hash_table_low, fep->fec.htlo); 230 FW(fecp, grp_hash_table_low, fep->fec.htlo);
231} 231}
232 232
233static void set_multicast_list(struct net_device *dev) 233static void set_multicast_list(struct net_device *dev)
@@ -273,8 +273,8 @@ static void restart(struct net_device *dev)
273 /* 273 /*
274 * Reset all multicast. 274 * Reset all multicast.
275 */ 275 */
276 FW(fecp, hash_table_high, fep->fec.hthi); 276 FW(fecp, grp_hash_table_high, fep->fec.hthi);
277 FW(fecp, hash_table_low, fep->fec.htlo); 277 FW(fecp, grp_hash_table_low, fep->fec.htlo);
278 278
279 /* 279 /*
280 * Set maximum receive buffer size. 280 * Set maximum receive buffer size.
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index dfb67eb2a94b..eb41e44921e6 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -671,6 +671,7 @@ static int netconsole_netdev_event(struct notifier_block *this,
671 goto done; 671 goto done;
672 672
673 spin_lock_irqsave(&target_list_lock, flags); 673 spin_lock_irqsave(&target_list_lock, flags);
674restart:
674 list_for_each_entry(nt, &target_list, list) { 675 list_for_each_entry(nt, &target_list, list) {
675 netconsole_target_get(nt); 676 netconsole_target_get(nt);
676 if (nt->np.dev == dev) { 677 if (nt->np.dev == dev) {
@@ -683,9 +684,16 @@ static int netconsole_netdev_event(struct notifier_block *this,
683 * rtnl_lock already held 684 * rtnl_lock already held
684 */ 685 */
685 if (nt->np.dev) { 686 if (nt->np.dev) {
687 spin_unlock_irqrestore(
688 &target_list_lock,
689 flags);
686 __netpoll_cleanup(&nt->np); 690 __netpoll_cleanup(&nt->np);
691 spin_lock_irqsave(&target_list_lock,
692 flags);
687 dev_put(nt->np.dev); 693 dev_put(nt->np.dev);
688 nt->np.dev = NULL; 694 nt->np.dev = NULL;
695 netconsole_target_put(nt);
696 goto restart;
689 } 697 }
690 /* Fall through */ 698 /* Fall through */
691 case NETDEV_GOING_DOWN: 699 case NETDEV_GOING_DOWN:
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index fb03e6ff3716..025dedda40a0 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -183,6 +183,19 @@ static const struct {
183}; 183};
184#undef _R 184#undef _R
185 185
186static const struct rtl_firmware_info {
187 int mac_version;
188 const char *fw_name;
189} rtl_firmware_infos[] = {
190 { .mac_version = RTL_GIGA_MAC_VER_25, .fw_name = FIRMWARE_8168D_1 },
191 { .mac_version = RTL_GIGA_MAC_VER_26, .fw_name = FIRMWARE_8168D_2 },
192 { .mac_version = RTL_GIGA_MAC_VER_29, .fw_name = FIRMWARE_8105E_1 },
193 { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
194 { .mac_version = RTL_GIGA_MAC_VER_30, .fw_name = FIRMWARE_8105E_1 },
195 { .mac_version = RTL_GIGA_MAC_VER_31, .fw_name = FIRMWARE_8168E_1 },
196 { .mac_version = RTL_GIGA_MAC_VER_32, .fw_name = FIRMWARE_8168E_2 }
197};
198
186enum cfg_version { 199enum cfg_version {
187 RTL_CFG_0 = 0x00, 200 RTL_CFG_0 = 0x00,
188 RTL_CFG_1, 201 RTL_CFG_1,
@@ -632,6 +645,7 @@ struct rtl8169_private {
632 u32 saved_wolopts; 645 u32 saved_wolopts;
633 646
634 const struct firmware *fw; 647 const struct firmware *fw;
648#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN);
635}; 649};
636 650
637MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); 651MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
@@ -1847,25 +1861,26 @@ rtl_phy_write_fw(struct rtl8169_private *tp, const struct firmware *fw)
1847 1861
1848static void rtl_release_firmware(struct rtl8169_private *tp) 1862static void rtl_release_firmware(struct rtl8169_private *tp)
1849{ 1863{
1850 release_firmware(tp->fw); 1864 if (!IS_ERR_OR_NULL(tp->fw))
1851 tp->fw = NULL; 1865 release_firmware(tp->fw);
1866 tp->fw = RTL_FIRMWARE_UNKNOWN;
1852} 1867}
1853 1868
1854static int rtl_apply_firmware(struct rtl8169_private *tp, const char *fw_name) 1869static void rtl_apply_firmware(struct rtl8169_private *tp)
1855{ 1870{
1856 const struct firmware **fw = &tp->fw; 1871 const struct firmware *fw = tp->fw;
1857 int rc = !*fw;
1858
1859 if (rc) {
1860 rc = request_firmware(fw, fw_name, &tp->pci_dev->dev);
1861 if (rc < 0)
1862 goto out;
1863 }
1864 1872
1865 /* TODO: release firmware once rtl_phy_write_fw signals failures. */ 1873 /* TODO: release firmware once rtl_phy_write_fw signals failures. */
1866 rtl_phy_write_fw(tp, *fw); 1874 if (!IS_ERR_OR_NULL(fw))
1867out: 1875 rtl_phy_write_fw(tp, fw);
1868 return rc; 1876}
1877
1878static void rtl_apply_firmware_cond(struct rtl8169_private *tp, u8 reg, u16 val)
1879{
1880 if (rtl_readphy(tp, reg) != val)
1881 netif_warn(tp, hw, tp->dev, "chipset not ready for firmware\n");
1882 else
1883 rtl_apply_firmware(tp);
1869} 1884}
1870 1885
1871static void rtl8169s_hw_phy_config(struct rtl8169_private *tp) 1886static void rtl8169s_hw_phy_config(struct rtl8169_private *tp)
@@ -2304,10 +2319,8 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp)
2304 2319
2305 rtl_writephy(tp, 0x1f, 0x0005); 2320 rtl_writephy(tp, 0x1f, 0x0005);
2306 rtl_writephy(tp, 0x05, 0x001b); 2321 rtl_writephy(tp, 0x05, 0x001b);
2307 if ((rtl_readphy(tp, 0x06) != 0xbf00) || 2322
2308 (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) { 2323 rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xbf00);
2309 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2310 }
2311 2324
2312 rtl_writephy(tp, 0x1f, 0x0000); 2325 rtl_writephy(tp, 0x1f, 0x0000);
2313} 2326}
@@ -2409,10 +2422,8 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp)
2409 2422
2410 rtl_writephy(tp, 0x1f, 0x0005); 2423 rtl_writephy(tp, 0x1f, 0x0005);
2411 rtl_writephy(tp, 0x05, 0x001b); 2424 rtl_writephy(tp, 0x05, 0x001b);
2412 if ((rtl_readphy(tp, 0x06) != 0xb300) || 2425
2413 (rtl_apply_firmware(tp, FIRMWARE_8168D_2) < 0)) { 2426 rtl_apply_firmware_cond(tp, MII_EXPANSION, 0xb300);
2414 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2415 }
2416 2427
2417 rtl_writephy(tp, 0x1f, 0x0000); 2428 rtl_writephy(tp, 0x1f, 0x0000);
2418} 2429}
@@ -2567,16 +2578,14 @@ static void rtl8168e_hw_phy_config(struct rtl8169_private *tp)
2567 2578
2568static void rtl8168e_1_hw_phy_config(struct rtl8169_private *tp) 2579static void rtl8168e_1_hw_phy_config(struct rtl8169_private *tp)
2569{ 2580{
2570 if (rtl_apply_firmware(tp, FIRMWARE_8168E_1) < 0) 2581 rtl_apply_firmware(tp);
2571 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2572 2582
2573 rtl8168e_hw_phy_config(tp); 2583 rtl8168e_hw_phy_config(tp);
2574} 2584}
2575 2585
2576static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp) 2586static void rtl8168e_2_hw_phy_config(struct rtl8169_private *tp)
2577{ 2587{
2578 if (rtl_apply_firmware(tp, FIRMWARE_8168E_2) < 0) 2588 rtl_apply_firmware(tp);
2579 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2580 2589
2581 rtl8168e_hw_phy_config(tp); 2590 rtl8168e_hw_phy_config(tp);
2582} 2591}
@@ -2619,8 +2628,7 @@ static void rtl8105e_hw_phy_config(struct rtl8169_private *tp)
2619 rtl_writephy(tp, 0x18, 0x0310); 2628 rtl_writephy(tp, 0x18, 0x0310);
2620 msleep(100); 2629 msleep(100);
2621 2630
2622 if (rtl_apply_firmware(tp, FIRMWARE_8105E_1) < 0) 2631 rtl_apply_firmware(tp);
2623 netif_warn(tp, probe, tp->dev, "unable to apply firmware patch\n");
2624 2632
2625 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init)); 2633 rtl_writephy_batch(tp, phy_reg_init, ARRAY_SIZE(phy_reg_init));
2626} 2634}
@@ -3463,6 +3471,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3463 tp->timer.data = (unsigned long) dev; 3471 tp->timer.data = (unsigned long) dev;
3464 tp->timer.function = rtl8169_phy_timer; 3472 tp->timer.function = rtl8169_phy_timer;
3465 3473
3474 tp->fw = RTL_FIRMWARE_UNKNOWN;
3475
3466 rc = register_netdev(dev); 3476 rc = register_netdev(dev);
3467 if (rc < 0) 3477 if (rc < 0)
3468 goto err_out_msi_4; 3478 goto err_out_msi_4;
@@ -3515,10 +3525,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3515 3525
3516 cancel_delayed_work_sync(&tp->task); 3526 cancel_delayed_work_sync(&tp->task);
3517 3527
3518 rtl_release_firmware(tp);
3519
3520 unregister_netdev(dev); 3528 unregister_netdev(dev);
3521 3529
3530 rtl_release_firmware(tp);
3531
3522 if (pci_dev_run_wake(pdev)) 3532 if (pci_dev_run_wake(pdev))
3523 pm_runtime_get_noresume(&pdev->dev); 3533 pm_runtime_get_noresume(&pdev->dev);
3524 3534
@@ -3530,6 +3540,37 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3530 pci_set_drvdata(pdev, NULL); 3540 pci_set_drvdata(pdev, NULL);
3531} 3541}
3532 3542
3543static void rtl_request_firmware(struct rtl8169_private *tp)
3544{
3545 int i;
3546
3547 /* Return early if the firmware is already loaded / cached. */
3548 if (!IS_ERR(tp->fw))
3549 goto out;
3550
3551 for (i = 0; i < ARRAY_SIZE(rtl_firmware_infos); i++) {
3552 const struct rtl_firmware_info *info = rtl_firmware_infos + i;
3553
3554 if (info->mac_version == tp->mac_version) {
3555 const char *name = info->fw_name;
3556 int rc;
3557
3558 rc = request_firmware(&tp->fw, name, &tp->pci_dev->dev);
3559 if (rc < 0) {
3560 netif_warn(tp, ifup, tp->dev, "unable to load "
3561 "firmware patch %s (%d)\n", name, rc);
3562 goto out_disable_request_firmware;
3563 }
3564 goto out;
3565 }
3566 }
3567
3568out_disable_request_firmware:
3569 tp->fw = NULL;
3570out:
3571 return;
3572}
3573
3533static int rtl8169_open(struct net_device *dev) 3574static int rtl8169_open(struct net_device *dev)
3534{ 3575{
3535 struct rtl8169_private *tp = netdev_priv(dev); 3576 struct rtl8169_private *tp = netdev_priv(dev);
@@ -3561,11 +3602,13 @@ static int rtl8169_open(struct net_device *dev)
3561 3602
3562 smp_mb(); 3603 smp_mb();
3563 3604
3605 rtl_request_firmware(tp);
3606
3564 retval = request_irq(dev->irq, rtl8169_interrupt, 3607 retval = request_irq(dev->irq, rtl8169_interrupt,
3565 (tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED, 3608 (tp->features & RTL_FEATURE_MSI) ? 0 : IRQF_SHARED,
3566 dev->name, dev); 3609 dev->name, dev);
3567 if (retval < 0) 3610 if (retval < 0)
3568 goto err_release_ring_2; 3611 goto err_release_fw_2;
3569 3612
3570 napi_enable(&tp->napi); 3613 napi_enable(&tp->napi);
3571 3614
@@ -3586,7 +3629,8 @@ static int rtl8169_open(struct net_device *dev)
3586out: 3629out:
3587 return retval; 3630 return retval;
3588 3631
3589err_release_ring_2: 3632err_release_fw_2:
3633 rtl_release_firmware(tp);
3590 rtl8169_rx_clear(tp); 3634 rtl8169_rx_clear(tp);
3591err_free_rx_1: 3635err_free_rx_1:
3592 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, 3636 dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 967371f04454..1033ef6476a4 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -54,13 +54,13 @@
54#include <linux/usb/usbnet.h> 54#include <linux/usb/usbnet.h>
55#include <linux/usb/cdc.h> 55#include <linux/usb/cdc.h>
56 56
57#define DRIVER_VERSION "7-Feb-2011" 57#define DRIVER_VERSION "23-Apr-2011"
58 58
59/* CDC NCM subclass 3.2.1 */ 59/* CDC NCM subclass 3.2.1 */
60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
61 61
62/* Maximum NTB length */ 62/* Maximum NTB length */
63#define CDC_NCM_NTB_MAX_SIZE_TX 16384 /* bytes */ 63#define CDC_NCM_NTB_MAX_SIZE_TX (16384 + 4) /* bytes, must be short terminated */
64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */ 64#define CDC_NCM_NTB_MAX_SIZE_RX 16384 /* bytes */
65 65
66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */ 66/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 642504f9638c..f69dcdf0e2e6 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -503,7 +503,7 @@ bool ath_stoprecv(struct ath_softc *sc)
503 "confusing the DMA engine when we start RX up\n"); 503 "confusing the DMA engine when we start RX up\n");
504 ATH_DBG_WARN_ON_ONCE(!stopped); 504 ATH_DBG_WARN_ON_ONCE(!stopped);
505 } 505 }
506 return stopped || reset; 506 return stopped && !reset;
507} 507}
508 508
509void ath_flushrecv(struct ath_softc *sc) 509void ath_flushrecv(struct ath_softc *sc)
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
index 5c40502f869a..fbec88d48f1b 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-tx.c
@@ -1127,12 +1127,16 @@ int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1128 1128
1129 tx_info = &txq->txb[txq->q.read_ptr]; 1129 tx_info = &txq->txb[txq->q.read_ptr];
1130 iwl4965_tx_status(priv, tx_info, 1130
1131 txq_id >= IWL4965_FIRST_AMPDU_QUEUE); 1131 if (WARN_ON_ONCE(tx_info->skb == NULL))
1132 continue;
1132 1133
1133 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1134 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1134 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1135 if (ieee80211_is_data_qos(hdr->frame_control))
1135 nfreed++; 1136 nfreed++;
1137
1138 iwl4965_tx_status(priv, tx_info,
1139 txq_id >= IWL4965_FIRST_AMPDU_QUEUE);
1136 tx_info->skb = NULL; 1140 tx_info->skb = NULL;
1137 1141
1138 priv->cfg->ops->lib->txq_free_tfd(priv, txq); 1142 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 56f46ee3bacd..90e12c17801e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -336,7 +336,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
336 struct ieee80211_channel *channel = conf->channel; 336 struct ieee80211_channel *channel = conf->channel;
337 const struct iwl_channel_info *ch_info; 337 const struct iwl_channel_info *ch_info;
338 int ret = 0; 338 int ret = 0;
339 bool ht_changed[NUM_IWL_RXON_CTX] = {};
340 339
341 IWL_DEBUG_MAC80211(priv, "changed %#x", changed); 340 IWL_DEBUG_MAC80211(priv, "changed %#x", changed);
342 341
@@ -384,10 +383,8 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
384 383
385 for_each_context(priv, ctx) { 384 for_each_context(priv, ctx) {
386 /* Configure HT40 channels */ 385 /* Configure HT40 channels */
387 if (ctx->ht.enabled != conf_is_ht(conf)) { 386 if (ctx->ht.enabled != conf_is_ht(conf))
388 ctx->ht.enabled = conf_is_ht(conf); 387 ctx->ht.enabled = conf_is_ht(conf);
389 ht_changed[ctx->ctxid] = true;
390 }
391 388
392 if (ctx->ht.enabled) { 389 if (ctx->ht.enabled) {
393 if (conf_is_ht40_minus(conf)) { 390 if (conf_is_ht40_minus(conf)) {
@@ -456,8 +453,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
456 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 453 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))
457 continue; 454 continue;
458 iwlagn_commit_rxon(priv, ctx); 455 iwlagn_commit_rxon(priv, ctx);
459 if (ht_changed[ctx->ctxid])
460 iwlagn_update_qos(priv, ctx);
461 } 456 }
462 out: 457 out:
463 mutex_unlock(&priv->mutex); 458 mutex_unlock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 2816b432c62f..494de0e59cb4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1236,12 +1236,16 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1236 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1236 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1237 1237
1238 tx_info = &txq->txb[txq->q.read_ptr]; 1238 tx_info = &txq->txb[txq->q.read_ptr];
1239 iwlagn_tx_status(priv, tx_info, 1239
1240 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE); 1240 if (WARN_ON_ONCE(tx_info->skb == NULL))
1241 continue;
1241 1242
1242 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1243 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1243 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1244 if (ieee80211_is_data_qos(hdr->frame_control))
1244 nfreed++; 1245 nfreed++;
1246
1247 iwlagn_tx_status(priv, tx_info,
1248 txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);
1245 tx_info->skb = NULL; 1249 tx_info->skb = NULL;
1246 1250
1247 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl) 1251 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 1ad4907766c7..e057d1235996 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -586,10 +586,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
586 hci_req_cancel(hdev, ENODEV); 586 hci_req_cancel(hdev, ENODEV);
587 hci_req_lock(hdev); 587 hci_req_lock(hdev);
588 588
589 /* Stop timer, it might be running */
590 del_timer_sync(&hdev->cmd_timer);
591
592 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { 589 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
590 del_timer_sync(&hdev->cmd_timer);
593 hci_req_unlock(hdev); 591 hci_req_unlock(hdev);
594 return 0; 592 return 0;
595 } 593 }
@@ -628,6 +626,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
628 626
629 /* Drop last sent command */ 627 /* Drop last sent command */
630 if (hdev->sent_cmd) { 628 if (hdev->sent_cmd) {
629 del_timer_sync(&hdev->cmd_timer);
631 kfree_skb(hdev->sent_cmd); 630 kfree_skb(hdev->sent_cmd);
632 hdev->sent_cmd = NULL; 631 hdev->sent_cmd = NULL;
633 } 632 }
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index c7eb073fe633..cb25628c0583 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2419,8 +2419,6 @@ static inline void hci_io_capa_reply_evt(struct hci_dev *hdev, struct sk_buff *s
2419 if (!conn) 2419 if (!conn)
2420 goto unlock; 2420 goto unlock;
2421 2421
2422 hci_conn_hold(conn);
2423
2424 conn->remote_cap = ev->capability; 2422 conn->remote_cap = ev->capability;
2425 conn->remote_oob = ev->oob_data; 2423 conn->remote_oob = ev->oob_data;
2426 conn->remote_auth = ev->authentication; 2424 conn->remote_auth = ev->authentication;
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 8cfa2a663028..fd3c1f35aa00 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1079,6 +1079,7 @@ static void l2cap_retransmit_one_frame(struct l2cap_chan *chan, u8 tx_seq)
1079 tx_skb = skb_clone(skb, GFP_ATOMIC); 1079 tx_skb = skb_clone(skb, GFP_ATOMIC);
1080 bt_cb(skb)->retries++; 1080 bt_cb(skb)->retries++;
1081 control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE); 1081 control = get_unaligned_le16(tx_skb->data + L2CAP_HDR_SIZE);
1082 control &= L2CAP_CTRL_SAR;
1082 1083
1083 if (chan->conn_state & L2CAP_CONN_SEND_FBIT) { 1084 if (chan->conn_state & L2CAP_CONN_SEND_FBIT) {
1084 control |= L2CAP_CTRL_FINAL; 1085 control |= L2CAP_CTRL_FINAL;
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 42fdffd1d76c..94954c74f6ae 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -369,6 +369,15 @@ static void __sco_sock_close(struct sock *sk)
369 369
370 case BT_CONNECTED: 370 case BT_CONNECTED:
371 case BT_CONFIG: 371 case BT_CONFIG:
372 if (sco_pi(sk)->conn) {
373 sk->sk_state = BT_DISCONN;
374 sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
375 hci_conn_put(sco_pi(sk)->conn->hcon);
376 sco_pi(sk)->conn = NULL;
377 } else
378 sco_chan_del(sk, ECONNRESET);
379 break;
380
372 case BT_CONNECT: 381 case BT_CONNECT:
373 case BT_DISCONN: 382 case BT_DISCONN:
374 sco_chan_del(sk, ECONNRESET); 383 sco_chan_del(sk, ECONNRESET);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 785932d7ad32..f3ac1e858ee1 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -165,7 +165,7 @@ rx_handler_result_t br_handle_frame(struct sk_buff **pskb)
165 goto drop; 165 goto drop;
166 166
167 /* If STP is turned off, then forward */ 167 /* If STP is turned off, then forward */
168 if (p->br->stp_enabled == BR_NO_STP) 168 if (p->br->stp_enabled == BR_NO_STP && dest[5] == 0)
169 goto forward; 169 goto forward;
170 170
171 if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev, 171 if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 57b1aed79014..8a6a05e7c3c8 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1427,9 +1427,14 @@ static int bcm_init(struct sock *sk)
1427static int bcm_release(struct socket *sock) 1427static int bcm_release(struct socket *sock)
1428{ 1428{
1429 struct sock *sk = sock->sk; 1429 struct sock *sk = sock->sk;
1430 struct bcm_sock *bo = bcm_sk(sk); 1430 struct bcm_sock *bo;
1431 struct bcm_op *op, *next; 1431 struct bcm_op *op, *next;
1432 1432
1433 if (sk == NULL)
1434 return 0;
1435
1436 bo = bcm_sk(sk);
1437
1433 /* remove bcm_ops, timer, rx_unregister(), etc. */ 1438 /* remove bcm_ops, timer, rx_unregister(), etc. */
1434 1439
1435 unregister_netdevice_notifier(&bo->notifier); 1440 unregister_netdevice_notifier(&bo->notifier);
diff --git a/net/can/raw.c b/net/can/raw.c
index 649acfa7c70a..0eb39a7fdf64 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -305,7 +305,12 @@ static int raw_init(struct sock *sk)
305static int raw_release(struct socket *sock) 305static int raw_release(struct socket *sock)
306{ 306{
307 struct sock *sk = sock->sk; 307 struct sock *sk = sock->sk;
308 struct raw_sock *ro = raw_sk(sk); 308 struct raw_sock *ro;
309
310 if (!sk)
311 return 0;
312
313 ro = raw_sk(sk);
309 314
310 unregister_netdevice_notifier(&ro->notifier); 315 unregister_netdevice_notifier(&ro->notifier);
311 316
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f4b7f806afd8..d63f780c6941 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2692,6 +2692,12 @@ static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
2692{ 2692{
2693} 2693}
2694 2694
2695static u32 *ipv4_rt_blackhole_cow_metrics(struct dst_entry *dst,
2696 unsigned long old)
2697{
2698 return NULL;
2699}
2700
2695static struct dst_ops ipv4_dst_blackhole_ops = { 2701static struct dst_ops ipv4_dst_blackhole_ops = {
2696 .family = AF_INET, 2702 .family = AF_INET,
2697 .protocol = cpu_to_be16(ETH_P_IP), 2703 .protocol = cpu_to_be16(ETH_P_IP),
@@ -2700,6 +2706,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2700 .default_mtu = ipv4_blackhole_default_mtu, 2706 .default_mtu = ipv4_blackhole_default_mtu,
2701 .default_advmss = ipv4_default_advmss, 2707 .default_advmss = ipv4_default_advmss,
2702 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2708 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2709 .cow_metrics = ipv4_rt_blackhole_cow_metrics,
2703}; 2710};
2704 2711
2705struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig) 2712struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 852fc28ca818..19a77d0e0308 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -153,6 +153,12 @@ static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
153{ 153{
154} 154}
155 155
156static u32 *ip6_rt_blackhole_cow_metrics(struct dst_entry *dst,
157 unsigned long old)
158{
159 return NULL;
160}
161
156static struct dst_ops ip6_dst_blackhole_ops = { 162static struct dst_ops ip6_dst_blackhole_ops = {
157 .family = AF_INET6, 163 .family = AF_INET6,
158 .protocol = cpu_to_be16(ETH_P_IPV6), 164 .protocol = cpu_to_be16(ETH_P_IPV6),
@@ -161,6 +167,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
161 .default_mtu = ip6_blackhole_default_mtu, 167 .default_mtu = ip6_blackhole_default_mtu,
162 .default_advmss = ip6_default_advmss, 168 .default_advmss = ip6_default_advmss,
163 .update_pmtu = ip6_rt_blackhole_update_pmtu, 169 .update_pmtu = ip6_rt_blackhole_update_pmtu,
170 .cow_metrics = ip6_rt_blackhole_cow_metrics,
164}; 171};
165 172
166static const u32 ip6_template_metrics[RTAX_MAX] = { 173static const u32 ip6_template_metrics[RTAX_MAX] = {
@@ -2022,7 +2029,6 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
2022 rt->dst.output = ip6_output; 2029 rt->dst.output = ip6_output;
2023 rt->rt6i_dev = net->loopback_dev; 2030 rt->rt6i_dev = net->loopback_dev;
2024 rt->rt6i_idev = idev; 2031 rt->rt6i_idev = idev;
2025 dst_metric_set(&rt->dst, RTAX_HOPLIMIT, -1);
2026 rt->dst.obsolete = -1; 2032 rt->dst.obsolete = -1;
2027 2033
2028 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; 2034 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 1bdc5f053db8..98ecfd7359e2 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1335,7 +1335,7 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, u32 features)
1335 skb->ip_summed = CHECKSUM_NONE; 1335 skb->ip_summed = CHECKSUM_NONE;
1336 1336
1337 /* Check if there is enough headroom to insert fragment header. */ 1337 /* Check if there is enough headroom to insert fragment header. */
1338 if ((skb_headroom(skb) < frag_hdr_sz) && 1338 if ((skb_mac_header(skb) < skb->head + frag_hdr_sz) &&
1339 pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC)) 1339 pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))
1340 goto out; 1340 goto out;
1341 1341
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a6d191f2a0fe..a9ddaf63ee14 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1526,6 +1526,8 @@ int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata,
1526 enum ieee80211_smps_mode old_req; 1526 enum ieee80211_smps_mode old_req;
1527 int err; 1527 int err;
1528 1528
1529 lockdep_assert_held(&sdata->u.mgd.mtx);
1530
1529 old_req = sdata->u.mgd.req_smps; 1531 old_req = sdata->u.mgd.req_smps;
1530 sdata->u.mgd.req_smps = smps_mode; 1532 sdata->u.mgd.req_smps = smps_mode;
1531 1533
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index dacace6b1393..9ea7c0d0103f 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -177,9 +177,9 @@ static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
177 if (sdata->vif.type != NL80211_IFTYPE_STATION) 177 if (sdata->vif.type != NL80211_IFTYPE_STATION)
178 return -EOPNOTSUPP; 178 return -EOPNOTSUPP;
179 179
180 mutex_lock(&local->iflist_mtx); 180 mutex_lock(&sdata->u.mgd.mtx);
181 err = __ieee80211_request_smps(sdata, smps_mode); 181 err = __ieee80211_request_smps(sdata, smps_mode);
182 mutex_unlock(&local->iflist_mtx); 182 mutex_unlock(&sdata->u.mgd.mtx);
183 183
184 return err; 184 return err;
185} 185}
diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
index 00a33242e90c..a274300b6a56 100644
--- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c
+++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
@@ -343,6 +343,10 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb,
343 ipset_adtfn adtfn = set->variant->adt[adt]; 343 ipset_adtfn adtfn = set->variant->adt[adt];
344 struct ipmac data; 344 struct ipmac data;
345 345
346 /* MAC can be src only */
347 if (!(flags & IPSET_DIM_TWO_SRC))
348 return 0;
349
346 data.id = ntohl(ip4addr(skb, flags & IPSET_DIM_ONE_SRC)); 350 data.id = ntohl(ip4addr(skb, flags & IPSET_DIM_ONE_SRC));
347 if (data.id < map->first_ip || data.id > map->last_ip) 351 if (data.id < map->first_ip || data.id > map->last_ip)
348 return -IPSET_ERR_BITMAP_RANGE; 352 return -IPSET_ERR_BITMAP_RANGE;
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 9152e69a162d..72d1ac611fdc 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1022,8 +1022,9 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
1022 if (cb->args[1] >= ip_set_max) 1022 if (cb->args[1] >= ip_set_max)
1023 goto out; 1023 goto out;
1024 1024
1025 pr_debug("args[0]: %ld args[1]: %ld\n", cb->args[0], cb->args[1]);
1026 max = cb->args[0] == DUMP_ONE ? cb->args[1] + 1 : ip_set_max; 1025 max = cb->args[0] == DUMP_ONE ? cb->args[1] + 1 : ip_set_max;
1026dump_last:
1027 pr_debug("args[0]: %ld args[1]: %ld\n", cb->args[0], cb->args[1]);
1027 for (; cb->args[1] < max; cb->args[1]++) { 1028 for (; cb->args[1] < max; cb->args[1]++) {
1028 index = (ip_set_id_t) cb->args[1]; 1029 index = (ip_set_id_t) cb->args[1];
1029 set = ip_set_list[index]; 1030 set = ip_set_list[index];
@@ -1038,8 +1039,8 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
1038 * so that lists (unions of sets) are dumped last. 1039 * so that lists (unions of sets) are dumped last.
1039 */ 1040 */
1040 if (cb->args[0] != DUMP_ONE && 1041 if (cb->args[0] != DUMP_ONE &&
1041 !((cb->args[0] == DUMP_ALL) ^ 1042 ((cb->args[0] == DUMP_ALL) ==
1042 (set->type->features & IPSET_DUMP_LAST))) 1043 !!(set->type->features & IPSET_DUMP_LAST)))
1043 continue; 1044 continue;
1044 pr_debug("List set: %s\n", set->name); 1045 pr_debug("List set: %s\n", set->name);
1045 if (!cb->args[2]) { 1046 if (!cb->args[2]) {
@@ -1083,6 +1084,12 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
1083 goto release_refcount; 1084 goto release_refcount;
1084 } 1085 }
1085 } 1086 }
1087 /* If we dump all sets, continue with dumping last ones */
1088 if (cb->args[0] == DUMP_ALL) {
1089 cb->args[0] = DUMP_LAST;
1090 cb->args[1] = 0;
1091 goto dump_last;
1092 }
1086 goto out; 1093 goto out;
1087 1094
1088nla_put_failure: 1095nla_put_failure:
@@ -1093,11 +1100,6 @@ release_refcount:
1093 pr_debug("release set %s\n", ip_set_list[index]->name); 1100 pr_debug("release set %s\n", ip_set_list[index]->name);
1094 ip_set_put_byindex(index); 1101 ip_set_put_byindex(index);
1095 } 1102 }
1096
1097 /* If we dump all sets, continue with dumping last ones */
1098 if (cb->args[0] == DUMP_ALL && cb->args[1] >= max && !cb->args[2])
1099 cb->args[0] = DUMP_LAST;
1100
1101out: 1103out:
1102 if (nlh) { 1104 if (nlh) {
1103 nlmsg_end(skb, nlh); 1105 nlmsg_end(skb, nlh);
diff --git a/net/netfilter/xt_set.c b/net/netfilter/xt_set.c
index 061d48cec137..b3babaed7719 100644
--- a/net/netfilter/xt_set.c
+++ b/net/netfilter/xt_set.c
@@ -81,6 +81,7 @@ set_match_v0_checkentry(const struct xt_mtchk_param *par)
81 if (info->match_set.u.flags[IPSET_DIM_MAX-1] != 0) { 81 if (info->match_set.u.flags[IPSET_DIM_MAX-1] != 0) {
82 pr_warning("Protocol error: set match dimension " 82 pr_warning("Protocol error: set match dimension "
83 "is over the limit!\n"); 83 "is over the limit!\n");
84 ip_set_nfnl_put(info->match_set.index);
84 return -ERANGE; 85 return -ERANGE;
85 } 86 }
86 87
@@ -135,6 +136,8 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
135 if (index == IPSET_INVALID_ID) { 136 if (index == IPSET_INVALID_ID) {
136 pr_warning("Cannot find del_set index %u as target\n", 137 pr_warning("Cannot find del_set index %u as target\n",
137 info->del_set.index); 138 info->del_set.index);
139 if (info->add_set.index != IPSET_INVALID_ID)
140 ip_set_nfnl_put(info->add_set.index);
138 return -ENOENT; 141 return -ENOENT;
139 } 142 }
140 } 143 }
@@ -142,6 +145,10 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
142 info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) { 145 info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) {
143 pr_warning("Protocol error: SET target dimension " 146 pr_warning("Protocol error: SET target dimension "
144 "is over the limit!\n"); 147 "is over the limit!\n");
148 if (info->add_set.index != IPSET_INVALID_ID)
149 ip_set_nfnl_put(info->add_set.index);
150 if (info->del_set.index != IPSET_INVALID_ID)
151 ip_set_nfnl_put(info->del_set.index);
145 return -ERANGE; 152 return -ERANGE;
146 } 153 }
147 154
@@ -192,6 +199,7 @@ set_match_checkentry(const struct xt_mtchk_param *par)
192 if (info->match_set.dim > IPSET_DIM_MAX) { 199 if (info->match_set.dim > IPSET_DIM_MAX) {
193 pr_warning("Protocol error: set match dimension " 200 pr_warning("Protocol error: set match dimension "
194 "is over the limit!\n"); 201 "is over the limit!\n");
202 ip_set_nfnl_put(info->match_set.index);
195 return -ERANGE; 203 return -ERANGE;
196 } 204 }
197 205
@@ -219,7 +227,7 @@ set_target(struct sk_buff *skb, const struct xt_action_param *par)
219 if (info->del_set.index != IPSET_INVALID_ID) 227 if (info->del_set.index != IPSET_INVALID_ID)
220 ip_set_del(info->del_set.index, 228 ip_set_del(info->del_set.index,
221 skb, par->family, 229 skb, par->family,
222 info->add_set.dim, 230 info->del_set.dim,
223 info->del_set.flags); 231 info->del_set.flags);
224 232
225 return XT_CONTINUE; 233 return XT_CONTINUE;
@@ -245,13 +253,19 @@ set_target_checkentry(const struct xt_tgchk_param *par)
245 if (index == IPSET_INVALID_ID) { 253 if (index == IPSET_INVALID_ID) {
246 pr_warning("Cannot find del_set index %u as target\n", 254 pr_warning("Cannot find del_set index %u as target\n",
247 info->del_set.index); 255 info->del_set.index);
256 if (info->add_set.index != IPSET_INVALID_ID)
257 ip_set_nfnl_put(info->add_set.index);
248 return -ENOENT; 258 return -ENOENT;
249 } 259 }
250 } 260 }
251 if (info->add_set.dim > IPSET_DIM_MAX || 261 if (info->add_set.dim > IPSET_DIM_MAX ||
252 info->del_set.flags > IPSET_DIM_MAX) { 262 info->del_set.dim > IPSET_DIM_MAX) {
253 pr_warning("Protocol error: SET target dimension " 263 pr_warning("Protocol error: SET target dimension "
254 "is over the limit!\n"); 264 "is over the limit!\n");
265 if (info->add_set.index != IPSET_INVALID_ID)
266 ip_set_nfnl_put(info->add_set.index);
267 if (info->del_set.index != IPSET_INVALID_ID)
268 ip_set_nfnl_put(info->del_set.index);
255 return -ERANGE; 269 return -ERANGE;
256 } 270 }
257 271