diff options
44 files changed, 353 insertions, 115 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index dd52d516cb89..dbca66182089 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
| @@ -36,7 +36,7 @@ neigh/default/unres_qlen_bytes - INTEGER | |||
| 36 | The maximum number of bytes which may be used by packets | 36 | The maximum number of bytes which may be used by packets |
| 37 | queued for each unresolved address by other network layers. | 37 | queued for each unresolved address by other network layers. |
| 38 | (added in linux 3.3) | 38 | (added in linux 3.3) |
| 39 | Seting negative value is meaningless and will retrun error. | 39 | Setting negative value is meaningless and will return error. |
| 40 | Default: 65536 Bytes(64KB) | 40 | Default: 65536 Bytes(64KB) |
| 41 | 41 | ||
| 42 | neigh/default/unres_qlen - INTEGER | 42 | neigh/default/unres_qlen - INTEGER |
| @@ -215,7 +215,7 @@ tcp_ecn - INTEGER | |||
| 215 | Possible values are: | 215 | Possible values are: |
| 216 | 0 Disable ECN. Neither initiate nor accept ECN. | 216 | 0 Disable ECN. Neither initiate nor accept ECN. |
| 217 | 1 Always request ECN on outgoing connection attempts. | 217 | 1 Always request ECN on outgoing connection attempts. |
| 218 | 2 Enable ECN when requested by incomming connections | 218 | 2 Enable ECN when requested by incoming connections |
| 219 | but do not request ECN on outgoing connections. | 219 | but do not request ECN on outgoing connections. |
| 220 | Default: 2 | 220 | Default: 2 |
| 221 | 221 | ||
| @@ -503,7 +503,7 @@ tcp_fastopen - INTEGER | |||
| 503 | tcp_syn_retries - INTEGER | 503 | tcp_syn_retries - INTEGER |
| 504 | Number of times initial SYNs for an active TCP connection attempt | 504 | Number of times initial SYNs for an active TCP connection attempt |
| 505 | will be retransmitted. Should not be higher than 255. Default value | 505 | will be retransmitted. Should not be higher than 255. Default value |
| 506 | is 6, which corresponds to 63seconds till the last restransmission | 506 | is 6, which corresponds to 63seconds till the last retransmission |
| 507 | with the current initial RTO of 1second. With this the final timeout | 507 | with the current initial RTO of 1second. With this the final timeout |
| 508 | for an active TCP connection attempt will happen after 127seconds. | 508 | for an active TCP connection attempt will happen after 127seconds. |
| 509 | 509 | ||
| @@ -1331,6 +1331,12 @@ force_tllao - BOOLEAN | |||
| 1331 | race condition where the sender deletes the cached link-layer address | 1331 | race condition where the sender deletes the cached link-layer address |
| 1332 | prior to receiving a response to a previous solicitation." | 1332 | prior to receiving a response to a previous solicitation." |
| 1333 | 1333 | ||
| 1334 | ndisc_notify - BOOLEAN | ||
| 1335 | Define mode for notification of address and device changes. | ||
| 1336 | 0 - (default): do nothing | ||
| 1337 | 1 - Generate unsolicited neighbour advertisements when device is brought | ||
| 1338 | up or hardware address changes. | ||
| 1339 | |||
| 1334 | icmp/*: | 1340 | icmp/*: |
| 1335 | ratelimit - INTEGER | 1341 | ratelimit - INTEGER |
| 1336 | Limit the maximal rates for sending ICMPv6 packets. | 1342 | Limit the maximal rates for sending ICMPv6 packets. |
| @@ -1530,7 +1536,7 @@ cookie_hmac_alg - STRING | |||
| 1530 | * sha1 | 1536 | * sha1 |
| 1531 | * none | 1537 | * none |
| 1532 | Ability to assign md5 or sha1 as the selected alg is predicated on the | 1538 | Ability to assign md5 or sha1 as the selected alg is predicated on the |
| 1533 | configuarion of those algorithms at build time (CONFIG_CRYPTO_MD5 and | 1539 | configuration of those algorithms at build time (CONFIG_CRYPTO_MD5 and |
| 1534 | CONFIG_CRYPTO_SHA1). | 1540 | CONFIG_CRYPTO_SHA1). |
| 1535 | 1541 | ||
| 1536 | Default: Dependent on configuration. MD5 if available, else SHA1 if | 1542 | Default: Dependent on configuration. MD5 if available, else SHA1 if |
| @@ -1548,7 +1554,7 @@ rcvbuf_policy - INTEGER | |||
| 1548 | blocking. | 1554 | blocking. |
| 1549 | 1555 | ||
| 1550 | 1: rcvbuf space is per association | 1556 | 1: rcvbuf space is per association |
| 1551 | 0: recbuf space is per socket | 1557 | 0: rcvbuf space is per socket |
| 1552 | 1558 | ||
| 1553 | Default: 0 | 1559 | Default: 0 |
| 1554 | 1560 | ||
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index d7b56a88c9f4..8b4221cfd118 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
| @@ -67,8 +67,7 @@ config BCMA_DRIVER_GMAC_CMN | |||
| 67 | 67 | ||
| 68 | config BCMA_DRIVER_GPIO | 68 | config BCMA_DRIVER_GPIO |
| 69 | bool "BCMA GPIO driver" | 69 | bool "BCMA GPIO driver" |
| 70 | depends on BCMA | 70 | depends on BCMA && GPIOLIB |
| 71 | select GPIOLIB | ||
| 72 | help | 71 | help |
| 73 | Driver to provide access to the GPIO pins of the bcma bus. | 72 | Driver to provide access to the GPIO pins of the bcma bus. |
| 74 | 73 | ||
diff --git a/drivers/bcma/driver_chipcommon_sflash.c b/drivers/bcma/driver_chipcommon_sflash.c index 63e688393825..1e694db4532d 100644 --- a/drivers/bcma/driver_chipcommon_sflash.c +++ b/drivers/bcma/driver_chipcommon_sflash.c | |||
| @@ -35,7 +35,7 @@ static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = { | |||
| 35 | { "M25P40", 0x12, 0x10000, 8, }, | 35 | { "M25P40", 0x12, 0x10000, 8, }, |
| 36 | 36 | ||
| 37 | { "M25P16", 0x14, 0x10000, 32, }, | 37 | { "M25P16", 0x14, 0x10000, 32, }, |
| 38 | { "M25P32", 0x14, 0x10000, 64, }, | 38 | { "M25P32", 0x15, 0x10000, 64, }, |
| 39 | { "M25P64", 0x16, 0x10000, 128, }, | 39 | { "M25P64", 0x16, 0x10000, 128, }, |
| 40 | { "M25FL128", 0x17, 0x10000, 256, }, | 40 | { "M25FL128", 0x17, 0x10000, 256, }, |
| 41 | { 0 }, | 41 | { 0 }, |
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c index 653487dc7b52..87fa5919c455 100644 --- a/drivers/net/ethernet/nvidia/forcedeth.c +++ b/drivers/net/ethernet/nvidia/forcedeth.c | |||
| @@ -1821,6 +1821,11 @@ static int nv_alloc_rx(struct net_device *dev) | |||
| 1821 | skb->data, | 1821 | skb->data, |
| 1822 | skb_tailroom(skb), | 1822 | skb_tailroom(skb), |
| 1823 | PCI_DMA_FROMDEVICE); | 1823 | PCI_DMA_FROMDEVICE); |
| 1824 | if (pci_dma_mapping_error(np->pci_dev, | ||
| 1825 | np->put_rx_ctx->dma)) { | ||
| 1826 | kfree_skb(skb); | ||
| 1827 | goto packet_dropped; | ||
| 1828 | } | ||
| 1824 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | 1829 | np->put_rx_ctx->dma_len = skb_tailroom(skb); |
| 1825 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); | 1830 | np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); |
| 1826 | wmb(); | 1831 | wmb(); |
| @@ -1830,6 +1835,7 @@ static int nv_alloc_rx(struct net_device *dev) | |||
| 1830 | if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) | 1835 | if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) |
| 1831 | np->put_rx_ctx = np->first_rx_ctx; | 1836 | np->put_rx_ctx = np->first_rx_ctx; |
| 1832 | } else { | 1837 | } else { |
| 1838 | packet_dropped: | ||
| 1833 | u64_stats_update_begin(&np->swstats_rx_syncp); | 1839 | u64_stats_update_begin(&np->swstats_rx_syncp); |
| 1834 | np->stat_rx_dropped++; | 1840 | np->stat_rx_dropped++; |
| 1835 | u64_stats_update_end(&np->swstats_rx_syncp); | 1841 | u64_stats_update_end(&np->swstats_rx_syncp); |
| @@ -1856,6 +1862,11 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
| 1856 | skb->data, | 1862 | skb->data, |
| 1857 | skb_tailroom(skb), | 1863 | skb_tailroom(skb), |
| 1858 | PCI_DMA_FROMDEVICE); | 1864 | PCI_DMA_FROMDEVICE); |
| 1865 | if (pci_dma_mapping_error(np->pci_dev, | ||
| 1866 | np->put_rx_ctx->dma)) { | ||
| 1867 | kfree_skb(skb); | ||
| 1868 | goto packet_dropped; | ||
| 1869 | } | ||
| 1859 | np->put_rx_ctx->dma_len = skb_tailroom(skb); | 1870 | np->put_rx_ctx->dma_len = skb_tailroom(skb); |
| 1860 | np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); | 1871 | np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); |
| 1861 | np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); | 1872 | np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); |
| @@ -1866,6 +1877,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev) | |||
| 1866 | if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) | 1877 | if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) |
| 1867 | np->put_rx_ctx = np->first_rx_ctx; | 1878 | np->put_rx_ctx = np->first_rx_ctx; |
| 1868 | } else { | 1879 | } else { |
| 1880 | packet_dropped: | ||
| 1869 | u64_stats_update_begin(&np->swstats_rx_syncp); | 1881 | u64_stats_update_begin(&np->swstats_rx_syncp); |
| 1870 | np->stat_rx_dropped++; | 1882 | np->stat_rx_dropped++; |
| 1871 | u64_stats_update_end(&np->swstats_rx_syncp); | 1883 | u64_stats_update_end(&np->swstats_rx_syncp); |
| @@ -2217,6 +2229,15 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 2217 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2229 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
| 2218 | np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, | 2230 | np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
| 2219 | PCI_DMA_TODEVICE); | 2231 | PCI_DMA_TODEVICE); |
| 2232 | if (pci_dma_mapping_error(np->pci_dev, | ||
| 2233 | np->put_tx_ctx->dma)) { | ||
| 2234 | /* on DMA mapping error - drop the packet */ | ||
| 2235 | kfree_skb(skb); | ||
| 2236 | u64_stats_update_begin(&np->swstats_tx_syncp); | ||
| 2237 | np->stat_tx_dropped++; | ||
| 2238 | u64_stats_update_end(&np->swstats_tx_syncp); | ||
| 2239 | return NETDEV_TX_OK; | ||
| 2240 | } | ||
| 2220 | np->put_tx_ctx->dma_len = bcnt; | 2241 | np->put_tx_ctx->dma_len = bcnt; |
| 2221 | np->put_tx_ctx->dma_single = 1; | 2242 | np->put_tx_ctx->dma_single = 1; |
| 2222 | put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); | 2243 | put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); |
| @@ -2337,6 +2358,15 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, | |||
| 2337 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; | 2358 | bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; |
| 2338 | np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, | 2359 | np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, |
| 2339 | PCI_DMA_TODEVICE); | 2360 | PCI_DMA_TODEVICE); |
| 2361 | if (pci_dma_mapping_error(np->pci_dev, | ||
| 2362 | np->put_tx_ctx->dma)) { | ||
| 2363 | /* on DMA mapping error - drop the packet */ | ||
| 2364 | kfree_skb(skb); | ||
| 2365 | u64_stats_update_begin(&np->swstats_tx_syncp); | ||
| 2366 | np->stat_tx_dropped++; | ||
| 2367 | u64_stats_update_end(&np->swstats_tx_syncp); | ||
| 2368 | return NETDEV_TX_OK; | ||
| 2369 | } | ||
| 2340 | np->put_tx_ctx->dma_len = bcnt; | 2370 | np->put_tx_ctx->dma_len = bcnt; |
| 2341 | np->put_tx_ctx->dma_single = 1; | 2371 | np->put_tx_ctx->dma_single = 1; |
| 2342 | put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); | 2372 | put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); |
| @@ -5003,6 +5033,11 @@ static int nv_loopback_test(struct net_device *dev) | |||
| 5003 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, | 5033 | test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, |
| 5004 | skb_tailroom(tx_skb), | 5034 | skb_tailroom(tx_skb), |
| 5005 | PCI_DMA_FROMDEVICE); | 5035 | PCI_DMA_FROMDEVICE); |
| 5036 | if (pci_dma_mapping_error(np->pci_dev, | ||
| 5037 | test_dma_addr)) { | ||
| 5038 | dev_kfree_skb_any(tx_skb); | ||
| 5039 | goto out; | ||
| 5040 | } | ||
| 5006 | pkt_data = skb_put(tx_skb, pkt_len); | 5041 | pkt_data = skb_put(tx_skb, pkt_len); |
| 5007 | for (i = 0; i < pkt_len; i++) | 5042 | for (i = 0; i < pkt_len; i++) |
| 5008 | pkt_data[i] = (u8)(i & 0xff); | 5043 | pkt_data[i] = (u8)(i & 0xff); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 91d7cb9728eb..6a1ca500e612 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -458,6 +458,7 @@ static const struct usb_device_id products[] = { | |||
| 458 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ | 458 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ |
| 459 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ | 459 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ |
| 460 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ | 460 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ |
| 461 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | ||
| 461 | 462 | ||
| 462 | /* 4. Gobi 1000 devices */ | 463 | /* 4. Gobi 1000 devices */ |
| 463 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 464 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 40f2cc135a49..656230e0d18c 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -1191,6 +1191,7 @@ static void vxlan_setup(struct net_device *dev) | |||
| 1191 | 1191 | ||
| 1192 | dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; | 1192 | dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; |
| 1193 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; | 1193 | dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; |
| 1194 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
| 1194 | 1195 | ||
| 1195 | spin_lock_init(&vxlan->hash_lock); | 1196 | spin_lock_init(&vxlan->hash_lock); |
| 1196 | 1197 | ||
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index 5fc15bf8be09..7647ed6b73d7 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
| @@ -2,6 +2,7 @@ config ATH9K_HW | |||
| 2 | tristate | 2 | tristate |
| 3 | config ATH9K_COMMON | 3 | config ATH9K_COMMON |
| 4 | tristate | 4 | tristate |
| 5 | select ATH_COMMON | ||
| 5 | config ATH9K_DFS_DEBUGFS | 6 | config ATH9K_DFS_DEBUGFS |
| 6 | def_bool y | 7 | def_bool y |
| 7 | depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED | 8 | depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED |
| @@ -17,7 +18,6 @@ config ATH9K_BTCOEX_SUPPORT | |||
| 17 | config ATH9K | 18 | config ATH9K |
| 18 | tristate "Atheros 802.11n wireless cards support" | 19 | tristate "Atheros 802.11n wireless cards support" |
| 19 | depends on MAC80211 | 20 | depends on MAC80211 |
| 20 | select ATH_COMMON | ||
| 21 | select ATH9K_HW | 21 | select ATH9K_HW |
| 22 | select MAC80211_LEDS | 22 | select MAC80211_LEDS |
| 23 | select LEDS_CLASS | 23 | select LEDS_CLASS |
| @@ -56,7 +56,8 @@ config ATH9K_AHB | |||
| 56 | 56 | ||
| 57 | config ATH9K_DEBUGFS | 57 | config ATH9K_DEBUGFS |
| 58 | bool "Atheros ath9k debugging" | 58 | bool "Atheros ath9k debugging" |
| 59 | depends on ATH9K && DEBUG_FS | 59 | depends on ATH9K |
| 60 | select MAC80211_DEBUGFS | ||
| 60 | ---help--- | 61 | ---help--- |
| 61 | Say Y, if you need access to ath9k's statistics for | 62 | Say Y, if you need access to ath9k's statistics for |
| 62 | interrupts, rate control, etc. | 63 | interrupts, rate control, etc. |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c index 74fd3977feeb..59bf5f31e212 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c | |||
| @@ -544,7 +544,7 @@ static void ar9003_rx_gain_table_mode0(struct ath_hw *ah) | |||
| 544 | ar9340Common_rx_gain_table_1p0); | 544 | ar9340Common_rx_gain_table_1p0); |
| 545 | else if (AR_SREV_9485_11(ah)) | 545 | else if (AR_SREV_9485_11(ah)) |
| 546 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 546 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
| 547 | ar9485Common_wo_xlna_rx_gain_1_1); | 547 | ar9485_common_rx_gain_1_1); |
| 548 | else if (AR_SREV_9550(ah)) { | 548 | else if (AR_SREV_9550(ah)) { |
| 549 | INIT_INI_ARRAY(&ah->iniModesRxGain, | 549 | INIT_INI_ARRAY(&ah->iniModesRxGain, |
| 550 | ar955x_1p0_common_rx_gain_table); | 550 | ar955x_1p0_common_rx_gain_table); |
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c index aaebecd19e59..63fd9af3fd39 100644 --- a/drivers/net/wireless/ath/carl9170/fw.c +++ b/drivers/net/wireless/ath/carl9170/fw.c | |||
| @@ -336,8 +336,12 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) | |||
| 336 | if (SUPP(CARL9170FW_WLANTX_CAB)) { | 336 | if (SUPP(CARL9170FW_WLANTX_CAB)) { |
| 337 | if_comb_types |= | 337 | if_comb_types |= |
| 338 | BIT(NL80211_IFTYPE_AP) | | 338 | BIT(NL80211_IFTYPE_AP) | |
| 339 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
| 340 | BIT(NL80211_IFTYPE_P2P_GO); | 339 | BIT(NL80211_IFTYPE_P2P_GO); |
| 340 | |||
| 341 | #ifdef CONFIG_MAC80211_MESH | ||
| 342 | if_comb_types |= | ||
| 343 | BIT(NL80211_IFTYPE_MESH_POINT); | ||
| 344 | #endif /* CONFIG_MAC80211_MESH */ | ||
| 341 | } | 345 | } |
| 342 | } | 346 | } |
| 343 | 347 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 1261a9b84e04..75464ad4fbd1 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
| @@ -3091,10 +3091,11 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, | |||
| 3091 | 3091 | ||
| 3092 | len = wpa_ie->len + TLV_HDR_LEN; | 3092 | len = wpa_ie->len + TLV_HDR_LEN; |
| 3093 | data = (u8 *)wpa_ie; | 3093 | data = (u8 *)wpa_ie; |
| 3094 | offset = 0; | 3094 | offset = TLV_HDR_LEN; |
| 3095 | if (!is_rsn_ie) | 3095 | if (!is_rsn_ie) |
| 3096 | offset += VS_IE_FIXED_HDR_LEN; | 3096 | offset += VS_IE_FIXED_HDR_LEN; |
| 3097 | offset += WPA_IE_VERSION_LEN; | 3097 | else |
| 3098 | offset += WPA_IE_VERSION_LEN; | ||
| 3098 | 3099 | ||
| 3099 | /* check for multicast cipher suite */ | 3100 | /* check for multicast cipher suite */ |
| 3100 | if (offset + WPA_IE_MIN_OUI_LEN > len) { | 3101 | if (offset + WPA_IE_MIN_OUI_LEN > len) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.h b/drivers/net/wireless/brcm80211/brcmsmac/debug.h index 796836b0f469..822781cf15d4 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/debug.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2012 Broadcom Corporation | 2 | * Copyright (c) 2012 Broadcom Corporation |
| 3 | * Copyright (c) 2012 Canonical Ltd. | ||
| 3 | * | 4 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for any | 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 5 | * purpose with or without fee is hereby granted, provided that the above | 6 | * purpose with or without fee is hereby granted, provided that the above |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 606b534347bc..21a824232478 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | |||
| @@ -1343,13 +1343,13 @@ static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, | |||
| 1343 | 1343 | ||
| 1344 | wlc_lcnphy_rx_gain_override_enable(pi, true); | 1344 | wlc_lcnphy_rx_gain_override_enable(pi, true); |
| 1345 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); | 1345 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); |
| 1346 | usleep_range(500, 500); | 1346 | udelay(500); |
| 1347 | write_radio_reg(pi, RADIO_2064_REG112, 0); | 1347 | write_radio_reg(pi, RADIO_2064_REG112, 0); |
| 1348 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) | 1348 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) |
| 1349 | return false; | 1349 | return false; |
| 1350 | 1350 | ||
| 1351 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); | 1351 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); |
| 1352 | usleep_range(500, 500); | 1352 | udelay(500); |
| 1353 | write_radio_reg(pi, RADIO_2064_REG112, 0); | 1353 | write_radio_reg(pi, RADIO_2064_REG112, 0); |
| 1354 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) | 1354 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) |
| 1355 | return false; | 1355 | return false; |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index e71c702e2eb1..800a16526c8e 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -47,6 +47,7 @@ static struct usb_device_id p54u_table[] = { | |||
| 47 | {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ | 47 | {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ |
| 48 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ | 48 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ |
| 49 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ | 49 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ |
| 50 | {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */ | ||
| 50 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ | 51 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ |
| 51 | {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ | 52 | {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ |
| 52 | {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ | 53 | {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ |
| @@ -82,6 +83,8 @@ static struct usb_device_id p54u_table[] = { | |||
| 82 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ | 83 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ |
| 83 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | 84 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ |
| 84 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | 85 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
| 86 | {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ | ||
| 87 | {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */ | ||
| 85 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | 88 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
| 86 | {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ | 89 | {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ |
| 87 | {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ | 90 | {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ |
| @@ -101,6 +104,7 @@ static struct usb_device_id p54u_table[] = { | |||
| 101 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | 104 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ |
| 102 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | 105 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ |
| 103 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 106 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
| 107 | /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */ | ||
| 104 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ | 108 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ |
| 105 | {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ | 109 | {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ |
| 106 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 110 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 3deacafdcd5e..4261e8ecc4c3 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
| @@ -743,6 +743,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
| 743 | 743 | ||
| 744 | done: | 744 | done: |
| 745 | bufferaddress = (*((dma_addr_t *)skb->cb)); | 745 | bufferaddress = (*((dma_addr_t *)skb->cb)); |
| 746 | if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) | ||
| 747 | return; | ||
| 746 | tmp_one = 1; | 748 | tmp_one = 1; |
| 747 | rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, | 749 | rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, |
| 748 | HW_DESC_RXBUFF_ADDR, | 750 | HW_DESC_RXBUFF_ADDR, |
| @@ -1115,6 +1117,10 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) | |||
| 1115 | PCI_DMA_FROMDEVICE); | 1117 | PCI_DMA_FROMDEVICE); |
| 1116 | 1118 | ||
| 1117 | bufferaddress = (*((dma_addr_t *)skb->cb)); | 1119 | bufferaddress = (*((dma_addr_t *)skb->cb)); |
| 1120 | if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) { | ||
| 1121 | dev_kfree_skb_any(skb); | ||
| 1122 | return 1; | ||
| 1123 | } | ||
| 1118 | rtlpriv->cfg->ops->set_desc((u8 *)entry, false, | 1124 | rtlpriv->cfg->ops->set_desc((u8 *)entry, false, |
| 1119 | HW_DESC_RXBUFF_ADDR, | 1125 | HW_DESC_RXBUFF_ADDR, |
| 1120 | (u8 *)&bufferaddress); | 1126 | (u8 *)&bufferaddress); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 173424756149..c31795e379f7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
| @@ -611,8 +611,14 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 611 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, | 611 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, |
| 612 | skb->data, skb->len, | 612 | skb->data, skb->len, |
| 613 | PCI_DMA_TODEVICE); | 613 | PCI_DMA_TODEVICE); |
| 614 | |||
| 614 | u8 bw_40 = 0; | 615 | u8 bw_40 = 0; |
| 615 | 616 | ||
| 617 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 618 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 619 | "DMA mapping error"); | ||
| 620 | return; | ||
| 621 | } | ||
| 616 | rcu_read_lock(); | 622 | rcu_read_lock(); |
| 617 | sta = get_sta(hw, mac->vif, mac->bssid); | 623 | sta = get_sta(hw, mac->vif, mac->bssid); |
| 618 | if (mac->opmode == NL80211_IFTYPE_STATION) { | 624 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
| @@ -774,6 +780,11 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
| 774 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); | 780 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); |
| 775 | __le16 fc = hdr->frame_control; | 781 | __le16 fc = hdr->frame_control; |
| 776 | 782 | ||
| 783 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 784 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 785 | "DMA mapping error"); | ||
| 786 | return; | ||
| 787 | } | ||
| 777 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 788 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
| 778 | 789 | ||
| 779 | if (firstseg) | 790 | if (firstseg) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c index f9f3861046c1..a0fbf284420e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c | |||
| @@ -587,6 +587,11 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 587 | buf_len = skb->len; | 587 | buf_len = skb->len; |
| 588 | mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, | 588 | mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, |
| 589 | PCI_DMA_TODEVICE); | 589 | PCI_DMA_TODEVICE); |
| 590 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 591 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 592 | "DMA mapping error"); | ||
| 593 | return; | ||
| 594 | } | ||
| 590 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); | 595 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); |
| 591 | if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { | 596 | if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { |
| 592 | firstseg = true; | 597 | firstseg = true; |
| @@ -740,6 +745,11 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
| 740 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); | 745 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); |
| 741 | __le16 fc = hdr->frame_control; | 746 | __le16 fc = hdr->frame_control; |
| 742 | 747 | ||
| 748 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 749 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 750 | "DMA mapping error"); | ||
| 751 | return; | ||
| 752 | } | ||
| 743 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 753 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
| 744 | if (firstseg) | 754 | if (firstseg) |
| 745 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); | 755 | SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index 0e9f6ebf078a..206561d7282f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
| @@ -611,6 +611,11 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 611 | PCI_DMA_TODEVICE); | 611 | PCI_DMA_TODEVICE); |
| 612 | u8 bw_40 = 0; | 612 | u8 bw_40 = 0; |
| 613 | 613 | ||
| 614 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 615 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 616 | "DMA mapping error"); | ||
| 617 | return; | ||
| 618 | } | ||
| 614 | if (mac->opmode == NL80211_IFTYPE_STATION) { | 619 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
| 615 | bw_40 = mac->bw_40; | 620 | bw_40 = mac->bw_40; |
| 616 | } else if (mac->opmode == NL80211_IFTYPE_AP || | 621 | } else if (mac->opmode == NL80211_IFTYPE_AP || |
| @@ -763,6 +768,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 763 | void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, | 768 | void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, |
| 764 | bool firstseg, bool lastseg, struct sk_buff *skb) | 769 | bool firstseg, bool lastseg, struct sk_buff *skb) |
| 765 | { | 770 | { |
| 771 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 766 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 772 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
| 767 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 773 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
| 768 | struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); | 774 | struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); |
| @@ -770,7 +776,12 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, | |||
| 770 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, | 776 | dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, |
| 771 | PCI_DMA_TODEVICE); | 777 | PCI_DMA_TODEVICE); |
| 772 | 778 | ||
| 773 | /* Clear all status */ | 779 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { |
| 780 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 781 | "DMA mapping error"); | ||
| 782 | return; | ||
| 783 | } | ||
| 784 | /* Clear all status */ | ||
| 774 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); | 785 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); |
| 775 | 786 | ||
| 776 | /* This bit indicate this packet is used for FW download. */ | 787 | /* This bit indicate this packet is used for FW download. */ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c index 87331d826d73..a313be8c21d2 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c | |||
| @@ -387,6 +387,11 @@ void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw, | |||
| 387 | PCI_DMA_TODEVICE); | 387 | PCI_DMA_TODEVICE); |
| 388 | u8 bw_40 = 0; | 388 | u8 bw_40 = 0; |
| 389 | 389 | ||
| 390 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 391 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 392 | "DMA mapping error"); | ||
| 393 | return; | ||
| 394 | } | ||
| 390 | if (mac->opmode == NL80211_IFTYPE_STATION) { | 395 | if (mac->opmode == NL80211_IFTYPE_STATION) { |
| 391 | bw_40 = mac->bw_40; | 396 | bw_40 = mac->bw_40; |
| 392 | } else if (mac->opmode == NL80211_IFTYPE_AP || | 397 | } else if (mac->opmode == NL80211_IFTYPE_AP || |
| @@ -542,6 +547,11 @@ void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw *hw, | |||
| 542 | PCI_DMA_TODEVICE); | 547 | PCI_DMA_TODEVICE); |
| 543 | __le16 fc = hdr->frame_control; | 548 | __le16 fc = hdr->frame_control; |
| 544 | 549 | ||
| 550 | if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { | ||
| 551 | RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, | ||
| 552 | "DMA mapping error"); | ||
| 553 | return; | ||
| 554 | } | ||
| 545 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); | 555 | CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); |
| 546 | 556 | ||
| 547 | if (firstseg) | 557 | if (firstseg) |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 29f0969e4ba0..f2ecdeb3a90d 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
| @@ -210,17 +210,16 @@ static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, | |||
| 210 | u16 index = REALTEK_USB_VENQT_CMD_IDX; | 210 | u16 index = REALTEK_USB_VENQT_CMD_IDX; |
| 211 | int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ | 211 | int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ |
| 212 | u8 *buffer; | 212 | u8 *buffer; |
| 213 | dma_addr_t dma_addr; | ||
| 214 | 213 | ||
| 215 | wvalue = (u16)(addr&0x0000ffff); | 214 | wvalue = (u16)(addr & 0x0000ffff); |
| 216 | buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); | 215 | buffer = kmalloc(len, GFP_ATOMIC); |
| 217 | if (!buffer) | 216 | if (!buffer) |
| 218 | return; | 217 | return; |
| 219 | memcpy(buffer, data, len); | 218 | memcpy(buffer, data, len); |
| 220 | usb_control_msg(udev, pipe, request, reqtype, wvalue, | 219 | usb_control_msg(udev, pipe, request, reqtype, wvalue, |
| 221 | index, buffer, len, 50); | 220 | index, buffer, len, 50); |
| 222 | 221 | ||
| 223 | usb_free_coherent(udev, (size_t)len, buffer, dma_addr); | 222 | kfree(buffer); |
| 224 | } | 223 | } |
| 225 | 224 | ||
| 226 | static void _rtl_usb_io_handler_init(struct device *dev, | 225 | static void _rtl_usb_io_handler_init(struct device *dev, |
| @@ -640,6 +639,7 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw) | |||
| 640 | RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, | 639 | RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, |
| 641 | "Failed to prep_rx_urb!!\n"); | 640 | "Failed to prep_rx_urb!!\n"); |
| 642 | err = PTR_ERR(skb); | 641 | err = PTR_ERR(skb); |
| 642 | usb_free_urb(urb); | ||
| 643 | goto err_out; | 643 | goto err_out; |
| 644 | } | 644 | } |
| 645 | 645 | ||
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index c26e28b4bd9f..7ffa43bd7cf9 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1015,29 +1015,10 @@ err: | |||
| 1015 | i = xennet_fill_frags(np, skb, &tmpq); | 1015 | i = xennet_fill_frags(np, skb, &tmpq); |
| 1016 | 1016 | ||
| 1017 | /* | 1017 | /* |
| 1018 | * Truesize approximates the size of true data plus | 1018 | * Truesize is the actual allocation size, even if the |
| 1019 | * any supervisor overheads. Adding hypervisor | 1019 | * allocation is only partially used. |
| 1020 | * overheads has been shown to significantly reduce | 1020 | */ |
| 1021 | * achievable bandwidth with the default receive | 1021 | skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; |
| 1022 | * buffer size. It is therefore not wise to account | ||
| 1023 | * for it here. | ||
| 1024 | * | ||
| 1025 | * After alloc_skb(RX_COPY_THRESHOLD), truesize is set | ||
| 1026 | * to RX_COPY_THRESHOLD + the supervisor | ||
| 1027 | * overheads. Here, we add the size of the data pulled | ||
| 1028 | * in xennet_fill_frags(). | ||
| 1029 | * | ||
| 1030 | * We also adjust for any unused space in the main | ||
| 1031 | * data area by subtracting (RX_COPY_THRESHOLD - | ||
| 1032 | * len). This is especially important with drivers | ||
| 1033 | * which split incoming packets into header and data, | ||
| 1034 | * using only 66 bytes of the main data area (see the | ||
| 1035 | * e1000 driver for example.) On such systems, | ||
| 1036 | * without this last adjustement, our achievable | ||
| 1037 | * receive throughout using the standard receive | ||
| 1038 | * buffer size was cut by 25%(!!!). | ||
| 1039 | */ | ||
| 1040 | skb->truesize += skb->data_len - RX_COPY_THRESHOLD; | ||
| 1041 | skb->len += skb->data_len; | 1022 | skb->len += skb->data_len; |
| 1042 | 1023 | ||
| 1043 | if (rx->flags & XEN_NETRXF_csum_blank) | 1024 | if (rx->flags & XEN_NETRXF_csum_blank) |
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig index ff3c8a21f10d..5d6f2ec1c705 100644 --- a/drivers/ssb/Kconfig +++ b/drivers/ssb/Kconfig | |||
| @@ -162,8 +162,7 @@ config SSB_DRIVER_GIGE | |||
| 162 | 162 | ||
| 163 | config SSB_DRIVER_GPIO | 163 | config SSB_DRIVER_GPIO |
| 164 | bool "SSB GPIO driver" | 164 | bool "SSB GPIO driver" |
| 165 | depends on SSB | 165 | depends on SSB && GPIOLIB |
| 166 | select GPIOLIB | ||
| 167 | help | 166 | help |
| 168 | Driver to provide access to the GPIO pins on the bus. | 167 | Driver to provide access to the GPIO pins on the bus. |
| 169 | 168 | ||
diff --git a/fs/splice.c b/fs/splice.c index 8890604e3fcd..6909d89d0da5 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
| @@ -696,8 +696,10 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | |||
| 696 | return -EINVAL; | 696 | return -EINVAL; |
| 697 | 697 | ||
| 698 | more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; | 698 | more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; |
| 699 | if (sd->len < sd->total_len) | 699 | |
| 700 | if (sd->len < sd->total_len && pipe->nrbufs > 1) | ||
| 700 | more |= MSG_SENDPAGE_NOTLAST; | 701 | more |= MSG_SENDPAGE_NOTLAST; |
| 702 | |||
| 701 | return file->f_op->sendpage(file, buf->page, buf->offset, | 703 | return file->f_op->sendpage(file, buf->page, buf->offset, |
| 702 | sd->len, &pos, more); | 704 | sd->len, &pos, more); |
| 703 | } | 705 | } |
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index a1d83cc8bf85..923cb20051ed 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
| @@ -71,6 +71,7 @@ struct netns_ct { | |||
| 71 | struct hlist_head *expect_hash; | 71 | struct hlist_head *expect_hash; |
| 72 | struct hlist_nulls_head unconfirmed; | 72 | struct hlist_nulls_head unconfirmed; |
| 73 | struct hlist_nulls_head dying; | 73 | struct hlist_nulls_head dying; |
| 74 | struct hlist_nulls_head tmpl; | ||
| 74 | struct ip_conntrack_stat __percpu *stat; | 75 | struct ip_conntrack_stat __percpu *stat; |
| 75 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; | 76 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; |
| 76 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb; | 77 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb; |
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h index 591db7d657a3..c24060ee411e 100644 --- a/include/net/netns/x_tables.h +++ b/include/net/netns/x_tables.h | |||
| @@ -8,6 +8,7 @@ struct ebt_table; | |||
| 8 | 8 | ||
| 9 | struct netns_xt { | 9 | struct netns_xt { |
| 10 | struct list_head tables[NFPROTO_NUMPROTO]; | 10 | struct list_head tables[NFPROTO_NUMPROTO]; |
| 11 | bool notrack_deprecated_warning; | ||
| 11 | #if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ | 12 | #if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ |
| 12 | defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) | 13 | defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) |
| 13 | struct ebt_table *broute_table; | 14 | struct ebt_table *broute_table; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 5391ca43336a..6d6f26531de2 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -1608,7 +1608,6 @@ void br_multicast_init(struct net_bridge *br) | |||
| 1608 | br_multicast_querier_expired, (unsigned long)br); | 1608 | br_multicast_querier_expired, (unsigned long)br); |
| 1609 | setup_timer(&br->multicast_query_timer, br_multicast_query_expired, | 1609 | setup_timer(&br->multicast_query_timer, br_multicast_query_expired, |
| 1610 | (unsigned long)br); | 1610 | (unsigned long)br); |
| 1611 | br_mdb_init(); | ||
| 1612 | } | 1611 | } |
| 1613 | 1612 | ||
| 1614 | void br_multicast_open(struct net_bridge *br) | 1613 | void br_multicast_open(struct net_bridge *br) |
| @@ -1633,7 +1632,6 @@ void br_multicast_stop(struct net_bridge *br) | |||
| 1633 | del_timer_sync(&br->multicast_querier_timer); | 1632 | del_timer_sync(&br->multicast_querier_timer); |
| 1634 | del_timer_sync(&br->multicast_query_timer); | 1633 | del_timer_sync(&br->multicast_query_timer); |
| 1635 | 1634 | ||
| 1636 | br_mdb_uninit(); | ||
| 1637 | spin_lock_bh(&br->multicast_lock); | 1635 | spin_lock_bh(&br->multicast_lock); |
| 1638 | mdb = mlock_dereference(br->mdb, br); | 1636 | mdb = mlock_dereference(br->mdb, br); |
| 1639 | if (!mdb) | 1637 | if (!mdb) |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 97ba0189c6f7..5dc66abcc9e2 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
| @@ -299,10 +299,21 @@ struct rtnl_link_ops br_link_ops __read_mostly = { | |||
| 299 | 299 | ||
| 300 | int __init br_netlink_init(void) | 300 | int __init br_netlink_init(void) |
| 301 | { | 301 | { |
| 302 | return rtnl_link_register(&br_link_ops); | 302 | int err; |
| 303 | |||
| 304 | br_mdb_init(); | ||
| 305 | err = rtnl_link_register(&br_link_ops); | ||
| 306 | if (err) | ||
| 307 | goto out; | ||
| 308 | |||
| 309 | return 0; | ||
| 310 | out: | ||
| 311 | br_mdb_uninit(); | ||
| 312 | return err; | ||
| 303 | } | 313 | } |
| 304 | 314 | ||
| 305 | void __exit br_netlink_fini(void) | 315 | void __exit br_netlink_fini(void) |
| 306 | { | 316 | { |
| 317 | br_mdb_uninit(); | ||
| 307 | rtnl_link_unregister(&br_link_ops); | 318 | rtnl_link_unregister(&br_link_ops); |
| 308 | } | 319 | } |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 8d83be5ffedc..711094aed41a 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
| @@ -526,6 +526,12 @@ static inline bool br_multicast_is_router(struct net_bridge *br) | |||
| 526 | { | 526 | { |
| 527 | return 0; | 527 | return 0; |
| 528 | } | 528 | } |
| 529 | static inline void br_mdb_init(void) | ||
| 530 | { | ||
| 531 | } | ||
| 532 | static inline void br_mdb_uninit(void) | ||
| 533 | { | ||
| 534 | } | ||
| 529 | #endif | 535 | #endif |
| 530 | 536 | ||
| 531 | /* br_netfilter.c */ | 537 | /* br_netfilter.c */ |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index cc06a47f1216..a8e4f2665d5e 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
| @@ -823,9 +823,9 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
| 823 | if (!ifa) { | 823 | if (!ifa) { |
| 824 | ret = -ENOBUFS; | 824 | ret = -ENOBUFS; |
| 825 | ifa = inet_alloc_ifa(); | 825 | ifa = inet_alloc_ifa(); |
| 826 | INIT_HLIST_NODE(&ifa->hash); | ||
| 827 | if (!ifa) | 826 | if (!ifa) |
| 828 | break; | 827 | break; |
| 828 | INIT_HLIST_NODE(&ifa->hash); | ||
| 829 | if (colon) | 829 | if (colon) |
| 830 | memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); | 830 | memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); |
| 831 | else | 831 | else |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index d763701cff1b..a2e50ae80b53 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
| @@ -136,6 +136,8 @@ __be32 ic_myaddr = NONE; /* My IP address */ | |||
| 136 | static __be32 ic_netmask = NONE; /* Netmask for local subnet */ | 136 | static __be32 ic_netmask = NONE; /* Netmask for local subnet */ |
| 137 | __be32 ic_gateway = NONE; /* Gateway IP address */ | 137 | __be32 ic_gateway = NONE; /* Gateway IP address */ |
| 138 | 138 | ||
| 139 | __be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */ | ||
| 140 | |||
| 139 | __be32 ic_servaddr = NONE; /* Boot server IP address */ | 141 | __be32 ic_servaddr = NONE; /* Boot server IP address */ |
| 140 | 142 | ||
| 141 | __be32 root_server_addr = NONE; /* Address of NFS server */ | 143 | __be32 root_server_addr = NONE; /* Address of NFS server */ |
| @@ -558,6 +560,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
| 558 | if (ic_myaddr == NONE) | 560 | if (ic_myaddr == NONE) |
| 559 | ic_myaddr = tip; | 561 | ic_myaddr = tip; |
| 560 | ic_servaddr = sip; | 562 | ic_servaddr = sip; |
| 563 | ic_addrservaddr = sip; | ||
| 561 | ic_got_reply = IC_RARP; | 564 | ic_got_reply = IC_RARP; |
| 562 | 565 | ||
| 563 | drop_unlock: | 566 | drop_unlock: |
| @@ -1068,7 +1071,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str | |||
| 1068 | ic_servaddr = server_id; | 1071 | ic_servaddr = server_id; |
| 1069 | #ifdef IPCONFIG_DEBUG | 1072 | #ifdef IPCONFIG_DEBUG |
| 1070 | printk("DHCP: Offered address %pI4 by server %pI4\n", | 1073 | printk("DHCP: Offered address %pI4 by server %pI4\n", |
| 1071 | &ic_myaddr, &ic_servaddr); | 1074 | &ic_myaddr, &b->iph.saddr); |
| 1072 | #endif | 1075 | #endif |
| 1073 | /* The DHCP indicated server address takes | 1076 | /* The DHCP indicated server address takes |
| 1074 | * precedence over the bootp header one if | 1077 | * precedence over the bootp header one if |
| @@ -1113,6 +1116,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str | |||
| 1113 | ic_dev = dev; | 1116 | ic_dev = dev; |
| 1114 | ic_myaddr = b->your_ip; | 1117 | ic_myaddr = b->your_ip; |
| 1115 | ic_servaddr = b->server_ip; | 1118 | ic_servaddr = b->server_ip; |
| 1119 | ic_addrservaddr = b->iph.saddr; | ||
| 1116 | if (ic_gateway == NONE && b->relay_ip) | 1120 | if (ic_gateway == NONE && b->relay_ip) |
| 1117 | ic_gateway = b->relay_ip; | 1121 | ic_gateway = b->relay_ip; |
| 1118 | if (ic_nameservers[0] == NONE) | 1122 | if (ic_nameservers[0] == NONE) |
| @@ -1268,7 +1272,7 @@ static int __init ic_dynamic(void) | |||
| 1268 | printk("IP-Config: Got %s answer from %pI4, ", | 1272 | printk("IP-Config: Got %s answer from %pI4, ", |
| 1269 | ((ic_got_reply & IC_RARP) ? "RARP" | 1273 | ((ic_got_reply & IC_RARP) ? "RARP" |
| 1270 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), | 1274 | : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), |
| 1271 | &ic_servaddr); | 1275 | &ic_addrservaddr); |
| 1272 | pr_cont("my address is %pI4\n", &ic_myaddr); | 1276 | pr_cont("my address is %pI4\n", &ic_myaddr); |
| 1273 | 1277 | ||
| 1274 | return 0; | 1278 | return 0; |
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c index 51f13f8ec724..04b18c1ac345 100644 --- a/net/ipv4/netfilter/ipt_REJECT.c +++ b/net/ipv4/netfilter/ipt_REJECT.c | |||
| @@ -81,6 +81,7 @@ static void send_reset(struct sk_buff *oldskb, int hook) | |||
| 81 | niph->saddr = oiph->daddr; | 81 | niph->saddr = oiph->daddr; |
| 82 | niph->daddr = oiph->saddr; | 82 | niph->daddr = oiph->saddr; |
| 83 | 83 | ||
| 84 | skb_reset_transport_header(nskb); | ||
| 84 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 85 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
| 85 | memset(tcph, 0, sizeof(*tcph)); | 86 | memset(tcph, 0, sizeof(*tcph)); |
| 86 | tcph->source = oth->dest; | 87 | tcph->source = oth->dest; |
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c index da2c8a368f68..eeaff7e4acb5 100644 --- a/net/ipv4/netfilter/iptable_nat.c +++ b/net/ipv4/netfilter/iptable_nat.c | |||
| @@ -124,23 +124,28 @@ nf_nat_ipv4_fn(unsigned int hooknum, | |||
| 124 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); | 124 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); |
| 125 | if (ret != NF_ACCEPT) | 125 | if (ret != NF_ACCEPT) |
| 126 | return ret; | 126 | return ret; |
| 127 | } else | 127 | } else { |
| 128 | pr_debug("Already setup manip %s for ct %p\n", | 128 | pr_debug("Already setup manip %s for ct %p\n", |
| 129 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", | 129 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", |
| 130 | ct); | 130 | ct); |
| 131 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) | ||
| 132 | goto oif_changed; | ||
| 133 | } | ||
| 131 | break; | 134 | break; |
| 132 | 135 | ||
| 133 | default: | 136 | default: |
| 134 | /* ESTABLISHED */ | 137 | /* ESTABLISHED */ |
| 135 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || | 138 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || |
| 136 | ctinfo == IP_CT_ESTABLISHED_REPLY); | 139 | ctinfo == IP_CT_ESTABLISHED_REPLY); |
| 137 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { | 140 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) |
| 138 | nf_ct_kill_acct(ct, ctinfo, skb); | 141 | goto oif_changed; |
| 139 | return NF_DROP; | ||
| 140 | } | ||
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | return nf_nat_packet(ct, ctinfo, hooknum, skb); | 144 | return nf_nat_packet(ct, ctinfo, hooknum, skb); |
| 145 | |||
| 146 | oif_changed: | ||
| 147 | nf_ct_kill_acct(ct, ctinfo, skb); | ||
| 148 | return NF_DROP; | ||
| 144 | } | 149 | } |
| 145 | 150 | ||
| 146 | static unsigned int | 151 | static unsigned int |
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index e9486915eff6..7302b0b7b642 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c | |||
| @@ -14,42 +14,23 @@ | |||
| 14 | #include <linux/netfilter_ipv6/ip6t_NPT.h> | 14 | #include <linux/netfilter_ipv6/ip6t_NPT.h> |
| 15 | #include <linux/netfilter/x_tables.h> | 15 | #include <linux/netfilter/x_tables.h> |
| 16 | 16 | ||
| 17 | static __sum16 csum16_complement(__sum16 a) | ||
| 18 | { | ||
| 19 | return (__force __sum16)(0xffff - (__force u16)a); | ||
| 20 | } | ||
| 21 | |||
| 22 | static __sum16 csum16_add(__sum16 a, __sum16 b) | ||
| 23 | { | ||
| 24 | u16 sum; | ||
| 25 | |||
| 26 | sum = (__force u16)a + (__force u16)b; | ||
| 27 | sum += (__force u16)a < (__force u16)b; | ||
| 28 | return (__force __sum16)sum; | ||
| 29 | } | ||
| 30 | |||
| 31 | static __sum16 csum16_sub(__sum16 a, __sum16 b) | ||
| 32 | { | ||
| 33 | return csum16_add(a, csum16_complement(b)); | ||
| 34 | } | ||
| 35 | |||
| 36 | static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) | 17 | static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) |
| 37 | { | 18 | { |
| 38 | struct ip6t_npt_tginfo *npt = par->targinfo; | 19 | struct ip6t_npt_tginfo *npt = par->targinfo; |
| 39 | __sum16 src_sum = 0, dst_sum = 0; | 20 | __wsum src_sum = 0, dst_sum = 0; |
| 40 | unsigned int i; | 21 | unsigned int i; |
| 41 | 22 | ||
| 42 | if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) | 23 | if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) |
| 43 | return -EINVAL; | 24 | return -EINVAL; |
| 44 | 25 | ||
| 45 | for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { | 26 | for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { |
| 46 | src_sum = csum16_add(src_sum, | 27 | src_sum = csum_add(src_sum, |
| 47 | (__force __sum16)npt->src_pfx.in6.s6_addr16[i]); | 28 | (__force __wsum)npt->src_pfx.in6.s6_addr16[i]); |
| 48 | dst_sum = csum16_add(dst_sum, | 29 | dst_sum = csum_add(dst_sum, |
| 49 | (__force __sum16)npt->dst_pfx.in6.s6_addr16[i]); | 30 | (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]); |
| 50 | } | 31 | } |
| 51 | 32 | ||
| 52 | npt->adjustment = csum16_sub(src_sum, dst_sum); | 33 | npt->adjustment = (__force __sum16) csum_sub(src_sum, dst_sum); |
| 53 | return 0; | 34 | return 0; |
| 54 | } | 35 | } |
| 55 | 36 | ||
| @@ -85,7 +66,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt, | |||
| 85 | return false; | 66 | return false; |
| 86 | } | 67 | } |
| 87 | 68 | ||
| 88 | sum = csum16_add((__force __sum16)addr->s6_addr16[idx], | 69 | sum = (__force __sum16) csum_add((__force __wsum)addr->s6_addr16[idx], |
| 89 | npt->adjustment); | 70 | npt->adjustment); |
| 90 | if (sum == CSUM_MANGLED_0) | 71 | if (sum == CSUM_MANGLED_0) |
| 91 | sum = 0; | 72 | sum = 0; |
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index fd4fb34c51c7..029623dbd411 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
| @@ -132,6 +132,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb) | |||
| 132 | ip6h->saddr = oip6h->daddr; | 132 | ip6h->saddr = oip6h->daddr; |
| 133 | ip6h->daddr = oip6h->saddr; | 133 | ip6h->daddr = oip6h->saddr; |
| 134 | 134 | ||
| 135 | skb_reset_transport_header(nskb); | ||
| 135 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 136 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
| 136 | /* Truncate to length (no data) */ | 137 | /* Truncate to length (no data) */ |
| 137 | tcph->doff = sizeof(struct tcphdr)/4; | 138 | tcph->doff = sizeof(struct tcphdr)/4; |
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c index 6c8ae24b85eb..e0e788d25b14 100644 --- a/net/ipv6/netfilter/ip6table_nat.c +++ b/net/ipv6/netfilter/ip6table_nat.c | |||
| @@ -127,23 +127,28 @@ nf_nat_ipv6_fn(unsigned int hooknum, | |||
| 127 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); | 127 | ret = nf_nat_rule_find(skb, hooknum, in, out, ct); |
| 128 | if (ret != NF_ACCEPT) | 128 | if (ret != NF_ACCEPT) |
| 129 | return ret; | 129 | return ret; |
| 130 | } else | 130 | } else { |
| 131 | pr_debug("Already setup manip %s for ct %p\n", | 131 | pr_debug("Already setup manip %s for ct %p\n", |
| 132 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", | 132 | maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", |
| 133 | ct); | 133 | ct); |
| 134 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) | ||
| 135 | goto oif_changed; | ||
| 136 | } | ||
| 134 | break; | 137 | break; |
| 135 | 138 | ||
| 136 | default: | 139 | default: |
| 137 | /* ESTABLISHED */ | 140 | /* ESTABLISHED */ |
| 138 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || | 141 | NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || |
| 139 | ctinfo == IP_CT_ESTABLISHED_REPLY); | 142 | ctinfo == IP_CT_ESTABLISHED_REPLY); |
| 140 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { | 143 | if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) |
| 141 | nf_ct_kill_acct(ct, ctinfo, skb); | 144 | goto oif_changed; |
| 142 | return NF_DROP; | ||
| 143 | } | ||
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | return nf_nat_packet(ct, ctinfo, hooknum, skb); | 147 | return nf_nat_packet(ct, ctinfo, hooknum, skb); |
| 148 | |||
| 149 | oif_changed: | ||
| 150 | nf_ct_kill_acct(ct, ctinfo, skb); | ||
| 151 | return NF_DROP; | ||
| 147 | } | 152 | } |
| 148 | 153 | ||
| 149 | static unsigned int | 154 | static unsigned int |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 00ee17c3e893..137e245860ab 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
| @@ -81,8 +81,8 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, | |||
| 81 | } | 81 | } |
| 82 | protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off); | 82 | protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off); |
| 83 | /* | 83 | /* |
| 84 | * (protoff == skb->len) mean that the packet doesn't have no data | 84 | * (protoff == skb->len) means the packet has not data, just |
| 85 | * except of IPv6 & ext headers. but it's tracked anyway. - YK | 85 | * IPv6 and possibly extensions headers, but it is tracked anyway |
| 86 | */ | 86 | */ |
| 87 | if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { | 87 | if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { |
| 88 | pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); | 88 | pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 22c8ea951185..3dacecc99065 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
| @@ -311,7 +311,10 @@ found: | |||
| 311 | else | 311 | else |
| 312 | fq->q.fragments = skb; | 312 | fq->q.fragments = skb; |
| 313 | 313 | ||
| 314 | skb->dev = NULL; | 314 | if (skb->dev) { |
| 315 | fq->iif = skb->dev->ifindex; | ||
| 316 | skb->dev = NULL; | ||
| 317 | } | ||
| 315 | fq->q.stamp = skb->tstamp; | 318 | fq->q.stamp = skb->tstamp; |
| 316 | fq->q.meat += skb->len; | 319 | fq->q.meat += skb->len; |
| 317 | if (payload_len > fq->q.max_size) | 320 | if (payload_len > fq->q.max_size) |
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 1191039c2b1b..199b92261e94 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c | |||
| @@ -389,7 +389,7 @@ void mac802154_wpan_setup(struct net_device *dev) | |||
| 389 | 389 | ||
| 390 | static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) | 390 | static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) |
| 391 | { | 391 | { |
| 392 | return netif_rx(skb); | 392 | return netif_rx_ni(skb); |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | static int | 395 | static int |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index fefa514b9917..49e96df5fbc4 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
| @@ -680,6 +680,13 @@ config NETFILTER_XT_TARGET_NFQUEUE | |||
| 680 | 680 | ||
| 681 | To compile it as a module, choose M here. If unsure, say N. | 681 | To compile it as a module, choose M here. If unsure, say N. |
| 682 | 682 | ||
| 683 | config NETFILTER_XT_TARGET_NOTRACK | ||
| 684 | tristate '"NOTRACK" target support (DEPRECATED)' | ||
| 685 | depends on NF_CONNTRACK | ||
| 686 | depends on IP_NF_RAW || IP6_NF_RAW | ||
| 687 | depends on NETFILTER_ADVANCED | ||
| 688 | select NETFILTER_XT_TARGET_CT | ||
| 689 | |||
| 683 | config NETFILTER_XT_TARGET_RATEEST | 690 | config NETFILTER_XT_TARGET_RATEEST |
| 684 | tristate '"RATEEST" target support' | 691 | tristate '"RATEEST" target support' |
| 685 | depends on NETFILTER_ADVANCED | 692 | depends on NETFILTER_ADVANCED |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 08cdc71d8e87..016d95ead930 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -1526,6 +1526,7 @@ err_extend: | |||
| 1526 | */ | 1526 | */ |
| 1527 | #define UNCONFIRMED_NULLS_VAL ((1<<30)+0) | 1527 | #define UNCONFIRMED_NULLS_VAL ((1<<30)+0) |
| 1528 | #define DYING_NULLS_VAL ((1<<30)+1) | 1528 | #define DYING_NULLS_VAL ((1<<30)+1) |
| 1529 | #define TEMPLATE_NULLS_VAL ((1<<30)+2) | ||
| 1529 | 1530 | ||
| 1530 | static int nf_conntrack_init_net(struct net *net) | 1531 | static int nf_conntrack_init_net(struct net *net) |
| 1531 | { | 1532 | { |
| @@ -1534,6 +1535,7 @@ static int nf_conntrack_init_net(struct net *net) | |||
| 1534 | atomic_set(&net->ct.count, 0); | 1535 | atomic_set(&net->ct.count, 0); |
| 1535 | INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL); | 1536 | INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL); |
| 1536 | INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL); | 1537 | INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL); |
| 1538 | INIT_HLIST_NULLS_HEAD(&net->ct.tmpl, TEMPLATE_NULLS_VAL); | ||
| 1537 | net->ct.stat = alloc_percpu(struct ip_conntrack_stat); | 1539 | net->ct.stat = alloc_percpu(struct ip_conntrack_stat); |
| 1538 | if (!net->ct.stat) { | 1540 | if (!net->ct.stat) { |
| 1539 | ret = -ENOMEM; | 1541 | ret = -ENOMEM; |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 4e078cd84d83..627b0e50b238 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
| @@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone, | |||
| 2624 | if (!help) { | 2624 | if (!help) { |
| 2625 | if (!cda[CTA_EXPECT_TIMEOUT]) { | 2625 | if (!cda[CTA_EXPECT_TIMEOUT]) { |
| 2626 | err = -EINVAL; | 2626 | err = -EINVAL; |
| 2627 | goto out; | 2627 | goto err_out; |
| 2628 | } | 2628 | } |
| 2629 | exp->timeout.expires = | 2629 | exp->timeout.expires = |
| 2630 | jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ; | 2630 | jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ; |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 9f199f2e31fa..92fd8eca0d31 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | */ | 13 | */ |
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
| 16 | #include <linux/if_arp.h> | ||
| 16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
| 17 | #include <linux/ip.h> | 18 | #include <linux/ip.h> |
| 18 | #include <linux/ipv6.h> | 19 | #include <linux/ipv6.h> |
| @@ -384,6 +385,7 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
| 384 | struct nfgenmsg *nfmsg; | 385 | struct nfgenmsg *nfmsg; |
| 385 | sk_buff_data_t old_tail = inst->skb->tail; | 386 | sk_buff_data_t old_tail = inst->skb->tail; |
| 386 | struct sock *sk; | 387 | struct sock *sk; |
| 388 | const unsigned char *hwhdrp; | ||
| 387 | 389 | ||
| 388 | nlh = nlmsg_put(inst->skb, 0, 0, | 390 | nlh = nlmsg_put(inst->skb, 0, 0, |
| 389 | NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, | 391 | NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, |
| @@ -485,9 +487,17 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
| 485 | if (indev && skb_mac_header_was_set(skb)) { | 487 | if (indev && skb_mac_header_was_set(skb)) { |
| 486 | if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || | 488 | if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || |
| 487 | nla_put_be16(inst->skb, NFULA_HWLEN, | 489 | nla_put_be16(inst->skb, NFULA_HWLEN, |
| 488 | htons(skb->dev->hard_header_len)) || | 490 | htons(skb->dev->hard_header_len))) |
| 489 | nla_put(inst->skb, NFULA_HWHEADER, skb->dev->hard_header_len, | 491 | goto nla_put_failure; |
| 490 | skb_mac_header(skb))) | 492 | |
| 493 | hwhdrp = skb_mac_header(skb); | ||
| 494 | |||
| 495 | if (skb->dev->type == ARPHRD_SIT) | ||
| 496 | hwhdrp -= ETH_HLEN; | ||
| 497 | |||
| 498 | if (hwhdrp >= skb->head && | ||
| 499 | nla_put(inst->skb, NFULA_HWHEADER, | ||
| 500 | skb->dev->hard_header_len, hwhdrp)) | ||
| 491 | goto nla_put_failure; | 501 | goto nla_put_failure; |
| 492 | } | 502 | } |
| 493 | 503 | ||
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index ae7f5daeee43..2a0843081840 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
| @@ -149,6 +149,10 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par) | |||
| 149 | 149 | ||
| 150 | __set_bit(IPS_TEMPLATE_BIT, &ct->status); | 150 | __set_bit(IPS_TEMPLATE_BIT, &ct->status); |
| 151 | __set_bit(IPS_CONFIRMED_BIT, &ct->status); | 151 | __set_bit(IPS_CONFIRMED_BIT, &ct->status); |
| 152 | |||
| 153 | /* Overload tuple linked list to put us in template list. */ | ||
| 154 | hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, | ||
| 155 | &par->net->ct.tmpl); | ||
| 152 | out: | 156 | out: |
| 153 | info->ct = ct; | 157 | info->ct = ct; |
| 154 | return 0; | 158 | return 0; |
| @@ -289,6 +293,10 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) | |||
| 289 | 293 | ||
| 290 | __set_bit(IPS_TEMPLATE_BIT, &ct->status); | 294 | __set_bit(IPS_TEMPLATE_BIT, &ct->status); |
| 291 | __set_bit(IPS_CONFIRMED_BIT, &ct->status); | 295 | __set_bit(IPS_CONFIRMED_BIT, &ct->status); |
| 296 | |||
| 297 | /* Overload tuple linked list to put us in template list. */ | ||
| 298 | hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, | ||
| 299 | &par->net->ct.tmpl); | ||
| 292 | out: | 300 | out: |
| 293 | info->ct = ct; | 301 | info->ct = ct; |
| 294 | return 0; | 302 | return 0; |
| @@ -377,14 +385,60 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = { | |||
| 377 | }, | 385 | }, |
| 378 | }; | 386 | }; |
| 379 | 387 | ||
| 388 | static unsigned int | ||
| 389 | notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) | ||
| 390 | { | ||
| 391 | /* Previously seen (loopback)? Ignore. */ | ||
| 392 | if (skb->nfct != NULL) | ||
| 393 | return XT_CONTINUE; | ||
| 394 | |||
| 395 | skb->nfct = &nf_ct_untracked_get()->ct_general; | ||
| 396 | skb->nfctinfo = IP_CT_NEW; | ||
| 397 | nf_conntrack_get(skb->nfct); | ||
| 398 | |||
| 399 | return XT_CONTINUE; | ||
| 400 | } | ||
| 401 | |||
| 402 | static int notrack_chk(const struct xt_tgchk_param *par) | ||
| 403 | { | ||
| 404 | if (!par->net->xt.notrack_deprecated_warning) { | ||
| 405 | pr_info("netfilter: NOTRACK target is deprecated, " | ||
| 406 | "use CT instead or upgrade iptables\n"); | ||
| 407 | par->net->xt.notrack_deprecated_warning = true; | ||
| 408 | } | ||
| 409 | return 0; | ||
| 410 | } | ||
| 411 | |||
| 412 | static struct xt_target notrack_tg_reg __read_mostly = { | ||
| 413 | .name = "NOTRACK", | ||
| 414 | .revision = 0, | ||
| 415 | .family = NFPROTO_UNSPEC, | ||
| 416 | .checkentry = notrack_chk, | ||
| 417 | .target = notrack_tg, | ||
| 418 | .table = "raw", | ||
| 419 | .me = THIS_MODULE, | ||
| 420 | }; | ||
| 421 | |||
| 380 | static int __init xt_ct_tg_init(void) | 422 | static int __init xt_ct_tg_init(void) |
| 381 | { | 423 | { |
| 382 | return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | 424 | int ret; |
| 425 | |||
| 426 | ret = xt_register_target(¬rack_tg_reg); | ||
| 427 | if (ret < 0) | ||
| 428 | return ret; | ||
| 429 | |||
| 430 | ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | ||
| 431 | if (ret < 0) { | ||
| 432 | xt_unregister_target(¬rack_tg_reg); | ||
| 433 | return ret; | ||
| 434 | } | ||
| 435 | return 0; | ||
| 383 | } | 436 | } |
| 384 | 437 | ||
| 385 | static void __exit xt_ct_tg_exit(void) | 438 | static void __exit xt_ct_tg_exit(void) |
| 386 | { | 439 | { |
| 387 | xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); | 440 | xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); |
| 441 | xt_unregister_target(¬rack_tg_reg); | ||
| 388 | } | 442 | } |
| 389 | 443 | ||
| 390 | module_init(xt_ct_tg_init); | 444 | module_init(xt_ct_tg_init); |
| @@ -394,3 +448,5 @@ MODULE_LICENSE("GPL"); | |||
| 394 | MODULE_DESCRIPTION("Xtables: connection tracking target"); | 448 | MODULE_DESCRIPTION("Xtables: connection tracking target"); |
| 395 | MODULE_ALIAS("ipt_CT"); | 449 | MODULE_ALIAS("ipt_CT"); |
| 396 | MODULE_ALIAS("ip6t_CT"); | 450 | MODULE_ALIAS("ip6t_CT"); |
| 451 | MODULE_ALIAS("ipt_NOTRACK"); | ||
| 452 | MODULE_ALIAS("ip6t_NOTRACK"); | ||
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 26a668a84aa2..a9d7af953ceb 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
| @@ -157,11 +157,22 @@ dsthash_find(const struct xt_hashlimit_htable *ht, | |||
| 157 | /* allocate dsthash_ent, initialize dst, put in htable and lock it */ | 157 | /* allocate dsthash_ent, initialize dst, put in htable and lock it */ |
| 158 | static struct dsthash_ent * | 158 | static struct dsthash_ent * |
| 159 | dsthash_alloc_init(struct xt_hashlimit_htable *ht, | 159 | dsthash_alloc_init(struct xt_hashlimit_htable *ht, |
| 160 | const struct dsthash_dst *dst) | 160 | const struct dsthash_dst *dst, bool *race) |
| 161 | { | 161 | { |
| 162 | struct dsthash_ent *ent; | 162 | struct dsthash_ent *ent; |
| 163 | 163 | ||
| 164 | spin_lock(&ht->lock); | 164 | spin_lock(&ht->lock); |
| 165 | |||
| 166 | /* Two or more packets may race to create the same entry in the | ||
| 167 | * hashtable, double check if this packet lost race. | ||
| 168 | */ | ||
| 169 | ent = dsthash_find(ht, dst); | ||
| 170 | if (ent != NULL) { | ||
| 171 | spin_unlock(&ht->lock); | ||
| 172 | *race = true; | ||
| 173 | return ent; | ||
| 174 | } | ||
| 175 | |||
| 165 | /* initialize hash with random val at the time we allocate | 176 | /* initialize hash with random val at the time we allocate |
| 166 | * the first hashtable entry */ | 177 | * the first hashtable entry */ |
| 167 | if (unlikely(!ht->rnd_initialized)) { | 178 | if (unlikely(!ht->rnd_initialized)) { |
| @@ -318,7 +329,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo) | |||
| 318 | parent = hashlimit_net->ipt_hashlimit; | 329 | parent = hashlimit_net->ipt_hashlimit; |
| 319 | else | 330 | else |
| 320 | parent = hashlimit_net->ip6t_hashlimit; | 331 | parent = hashlimit_net->ip6t_hashlimit; |
| 321 | remove_proc_entry(hinfo->pde->name, parent); | 332 | |
| 333 | if(parent != NULL) | ||
| 334 | remove_proc_entry(hinfo->pde->name, parent); | ||
| 335 | |||
| 322 | htable_selective_cleanup(hinfo, select_all); | 336 | htable_selective_cleanup(hinfo, select_all); |
| 323 | vfree(hinfo); | 337 | vfree(hinfo); |
| 324 | } | 338 | } |
| @@ -585,6 +599,7 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
| 585 | unsigned long now = jiffies; | 599 | unsigned long now = jiffies; |
| 586 | struct dsthash_ent *dh; | 600 | struct dsthash_ent *dh; |
| 587 | struct dsthash_dst dst; | 601 | struct dsthash_dst dst; |
| 602 | bool race = false; | ||
| 588 | u32 cost; | 603 | u32 cost; |
| 589 | 604 | ||
| 590 | if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0) | 605 | if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0) |
| @@ -593,13 +608,18 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
| 593 | rcu_read_lock_bh(); | 608 | rcu_read_lock_bh(); |
| 594 | dh = dsthash_find(hinfo, &dst); | 609 | dh = dsthash_find(hinfo, &dst); |
| 595 | if (dh == NULL) { | 610 | if (dh == NULL) { |
| 596 | dh = dsthash_alloc_init(hinfo, &dst); | 611 | dh = dsthash_alloc_init(hinfo, &dst, &race); |
| 597 | if (dh == NULL) { | 612 | if (dh == NULL) { |
| 598 | rcu_read_unlock_bh(); | 613 | rcu_read_unlock_bh(); |
| 599 | goto hotdrop; | 614 | goto hotdrop; |
| 615 | } else if (race) { | ||
| 616 | /* Already got an entry, update expiration timeout */ | ||
| 617 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); | ||
| 618 | rateinfo_recalc(dh, now, hinfo->cfg.mode); | ||
| 619 | } else { | ||
| 620 | dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); | ||
| 621 | rateinfo_init(dh, hinfo); | ||
| 600 | } | 622 | } |
| 601 | dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); | ||
| 602 | rateinfo_init(dh, hinfo); | ||
| 603 | } else { | 623 | } else { |
| 604 | /* update expiration timeout */ | 624 | /* update expiration timeout */ |
| 605 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); | 625 | dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); |
| @@ -856,6 +876,27 @@ static int __net_init hashlimit_proc_net_init(struct net *net) | |||
| 856 | 876 | ||
| 857 | static void __net_exit hashlimit_proc_net_exit(struct net *net) | 877 | static void __net_exit hashlimit_proc_net_exit(struct net *net) |
| 858 | { | 878 | { |
| 879 | struct xt_hashlimit_htable *hinfo; | ||
| 880 | struct hlist_node *pos; | ||
| 881 | struct proc_dir_entry *pde; | ||
| 882 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); | ||
| 883 | |||
| 884 | /* recent_net_exit() is called before recent_mt_destroy(). Make sure | ||
| 885 | * that the parent xt_recent proc entry is is empty before trying to | ||
| 886 | * remove it. | ||
| 887 | */ | ||
| 888 | mutex_lock(&hashlimit_mutex); | ||
| 889 | pde = hashlimit_net->ipt_hashlimit; | ||
| 890 | if (pde == NULL) | ||
| 891 | pde = hashlimit_net->ip6t_hashlimit; | ||
| 892 | |||
| 893 | hlist_for_each_entry(hinfo, pos, &hashlimit_net->htables, node) | ||
| 894 | remove_proc_entry(hinfo->pde->name, pde); | ||
| 895 | |||
| 896 | hashlimit_net->ipt_hashlimit = NULL; | ||
| 897 | hashlimit_net->ip6t_hashlimit = NULL; | ||
| 898 | mutex_unlock(&hashlimit_mutex); | ||
| 899 | |||
| 859 | proc_net_remove(net, "ipt_hashlimit"); | 900 | proc_net_remove(net, "ipt_hashlimit"); |
| 860 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) | 901 | #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) |
| 861 | proc_net_remove(net, "ip6t_hashlimit"); | 902 | proc_net_remove(net, "ip6t_hashlimit"); |
| @@ -872,9 +913,6 @@ static int __net_init hashlimit_net_init(struct net *net) | |||
| 872 | 913 | ||
| 873 | static void __net_exit hashlimit_net_exit(struct net *net) | 914 | static void __net_exit hashlimit_net_exit(struct net *net) |
| 874 | { | 915 | { |
| 875 | struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); | ||
| 876 | |||
| 877 | BUG_ON(!hlist_empty(&hashlimit_net->htables)); | ||
| 878 | hashlimit_proc_net_exit(net); | 916 | hashlimit_proc_net_exit(net); |
| 879 | } | 917 | } |
| 880 | 918 | ||
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index 4635c9b00459..978efc9b555a 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
| 30 | #include <linux/inet.h> | 30 | #include <linux/inet.h> |
| 31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
| 32 | #include <linux/vmalloc.h> | ||
| 32 | #include <net/net_namespace.h> | 33 | #include <net/net_namespace.h> |
| 33 | #include <net/netns/generic.h> | 34 | #include <net/netns/generic.h> |
| 34 | 35 | ||
| @@ -310,6 +311,14 @@ out: | |||
| 310 | return ret; | 311 | return ret; |
| 311 | } | 312 | } |
| 312 | 313 | ||
| 314 | static void recent_table_free(void *addr) | ||
| 315 | { | ||
| 316 | if (is_vmalloc_addr(addr)) | ||
| 317 | vfree(addr); | ||
| 318 | else | ||
| 319 | kfree(addr); | ||
| 320 | } | ||
| 321 | |||
| 313 | static int recent_mt_check(const struct xt_mtchk_param *par, | 322 | static int recent_mt_check(const struct xt_mtchk_param *par, |
| 314 | const struct xt_recent_mtinfo_v1 *info) | 323 | const struct xt_recent_mtinfo_v1 *info) |
| 315 | { | 324 | { |
| @@ -322,6 +331,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
| 322 | #endif | 331 | #endif |
| 323 | unsigned int i; | 332 | unsigned int i; |
| 324 | int ret = -EINVAL; | 333 | int ret = -EINVAL; |
| 334 | size_t sz; | ||
| 325 | 335 | ||
| 326 | if (unlikely(!hash_rnd_inited)) { | 336 | if (unlikely(!hash_rnd_inited)) { |
| 327 | get_random_bytes(&hash_rnd, sizeof(hash_rnd)); | 337 | get_random_bytes(&hash_rnd, sizeof(hash_rnd)); |
| @@ -360,8 +370,11 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
| 360 | goto out; | 370 | goto out; |
| 361 | } | 371 | } |
| 362 | 372 | ||
| 363 | t = kzalloc(sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size, | 373 | sz = sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size; |
| 364 | GFP_KERNEL); | 374 | if (sz <= PAGE_SIZE) |
| 375 | t = kzalloc(sz, GFP_KERNEL); | ||
| 376 | else | ||
| 377 | t = vzalloc(sz); | ||
| 365 | if (t == NULL) { | 378 | if (t == NULL) { |
| 366 | ret = -ENOMEM; | 379 | ret = -ENOMEM; |
| 367 | goto out; | 380 | goto out; |
| @@ -377,14 +390,14 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
| 377 | uid = make_kuid(&init_user_ns, ip_list_uid); | 390 | uid = make_kuid(&init_user_ns, ip_list_uid); |
| 378 | gid = make_kgid(&init_user_ns, ip_list_gid); | 391 | gid = make_kgid(&init_user_ns, ip_list_gid); |
| 379 | if (!uid_valid(uid) || !gid_valid(gid)) { | 392 | if (!uid_valid(uid) || !gid_valid(gid)) { |
| 380 | kfree(t); | 393 | recent_table_free(t); |
| 381 | ret = -EINVAL; | 394 | ret = -EINVAL; |
| 382 | goto out; | 395 | goto out; |
| 383 | } | 396 | } |
| 384 | pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, | 397 | pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, |
| 385 | &recent_mt_fops, t); | 398 | &recent_mt_fops, t); |
| 386 | if (pde == NULL) { | 399 | if (pde == NULL) { |
| 387 | kfree(t); | 400 | recent_table_free(t); |
| 388 | ret = -ENOMEM; | 401 | ret = -ENOMEM; |
| 389 | goto out; | 402 | goto out; |
| 390 | } | 403 | } |
| @@ -431,10 +444,11 @@ static void recent_mt_destroy(const struct xt_mtdtor_param *par) | |||
| 431 | list_del(&t->list); | 444 | list_del(&t->list); |
| 432 | spin_unlock_bh(&recent_lock); | 445 | spin_unlock_bh(&recent_lock); |
| 433 | #ifdef CONFIG_PROC_FS | 446 | #ifdef CONFIG_PROC_FS |
| 434 | remove_proc_entry(t->name, recent_net->xt_recent); | 447 | if (recent_net->xt_recent != NULL) |
| 448 | remove_proc_entry(t->name, recent_net->xt_recent); | ||
| 435 | #endif | 449 | #endif |
| 436 | recent_table_flush(t); | 450 | recent_table_flush(t); |
| 437 | kfree(t); | 451 | recent_table_free(t); |
| 438 | } | 452 | } |
| 439 | mutex_unlock(&recent_mutex); | 453 | mutex_unlock(&recent_mutex); |
| 440 | } | 454 | } |
| @@ -615,6 +629,20 @@ static int __net_init recent_proc_net_init(struct net *net) | |||
| 615 | 629 | ||
| 616 | static void __net_exit recent_proc_net_exit(struct net *net) | 630 | static void __net_exit recent_proc_net_exit(struct net *net) |
| 617 | { | 631 | { |
| 632 | struct recent_net *recent_net = recent_pernet(net); | ||
| 633 | struct recent_table *t; | ||
| 634 | |||
| 635 | /* recent_net_exit() is called before recent_mt_destroy(). Make sure | ||
| 636 | * that the parent xt_recent proc entry is is empty before trying to | ||
| 637 | * remove it. | ||
| 638 | */ | ||
| 639 | spin_lock_bh(&recent_lock); | ||
| 640 | list_for_each_entry(t, &recent_net->tables, list) | ||
| 641 | remove_proc_entry(t->name, recent_net->xt_recent); | ||
| 642 | |||
| 643 | recent_net->xt_recent = NULL; | ||
| 644 | spin_unlock_bh(&recent_lock); | ||
| 645 | |||
| 618 | proc_net_remove(net, "xt_recent"); | 646 | proc_net_remove(net, "xt_recent"); |
| 619 | } | 647 | } |
| 620 | #else | 648 | #else |
| @@ -638,9 +666,6 @@ static int __net_init recent_net_init(struct net *net) | |||
| 638 | 666 | ||
| 639 | static void __net_exit recent_net_exit(struct net *net) | 667 | static void __net_exit recent_net_exit(struct net *net) |
| 640 | { | 668 | { |
| 641 | struct recent_net *recent_net = recent_pernet(net); | ||
| 642 | |||
| 643 | BUG_ON(!list_empty(&recent_net->tables)); | ||
| 644 | recent_proc_net_exit(net); | 669 | recent_proc_net_exit(net); |
| 645 | } | 670 | } |
| 646 | 671 | ||
