Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) New sysctl ndisc_notify needs some documentation, from Hanns
Frederic Sowa.

2) Netfilter REJECT target doesn't set transport header of SKB
correctly, from Mukund Jampala.

3) Forcedeth driver needs to check for DMA mapping failures, from Larry
Finger.

4) brcmsmac driver can't use usleep_range while holding locks, use
udelay instead. From Niels Ole Salscheider.

5) Fix unregister of netlink bridge multicast database handlers, from
Vlad Yasevich and Rami Rosen.

6) Fix checksum calculations in netfilter's ipv6 network prefix
translation module.

7) Fix high order page allocation failures in netfilter xt_recent, from
Eric Dumazet.

8) mac802154 needs to use netif_rx_ni() instead of netif_rx() because
mac802154_process_data() can execute in process rather than
interrupt context. From Alexander Aring.

9) Fix splice handling of MSG_SENDPAGE_NOTLAST, otherwise we elide one
tcp_push() too many. From Eric Dumazet and Willy Tarreau.

10) Fix skb->truesize tracking in XEN netfront driver, from Ian
Campbell.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (46 commits)
xen/netfront: improve truesize tracking
ipv4: fix NULL checking in devinet_ioctl()
tcp: fix MSG_SENDPAGE_NOTLAST logic
net/ipv4/ipconfig: really display the BOOTP/DHCP server's address.
ip-sysctl: fix spelling errors
mac802154: fix NOHZ local_softirq_pending 08 warning
ipv6: document ndisc_notify in networking/ip-sysctl.txt
ath9k: Fix Kconfig for ATH9K_HTC
netfilter: xt_recent: avoid high order page allocations
netfilter: fix missing dependencies for the NOTRACK target
netfilter: ip6t_NPT: fix IPv6 NTP checksum calculation
bridge: add empty br_mdb_init() and br_mdb_uninit() definitions.
vxlan: allow live mac address change
bridge: Correctly unregister MDB rtnetlink handlers
brcmfmac: fix parsing rsn ie for ap mode.
brcmsmac: add copyright information for Canonical
rtlwifi: rtl8723ae: Fix warning for unchecked pci_map_single() call
rtlwifi: rtl8192se: Fix warning for unchecked pci_map_single() call
rtlwifi: rtl8192de: Fix warning for unchecked pci_map_single() call
rtlwifi: rtl8192ce: Fix warning for unchecked pci_map_single() call
...

+353 -115
+11 -5
Documentation/networking/ip-sysctl.txt
··· 36 36 The maximum number of bytes which may be used by packets 37 37 queued for each unresolved address by other network layers. 38 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 40 Default: 65536 Bytes(64KB) 41 41 42 42 neigh/default/unres_qlen - INTEGER ··· 215 215 Possible values are: 216 216 0 Disable ECN. Neither initiate nor accept ECN. 217 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 219 but do not request ECN on outgoing connections. 220 220 Default: 2 221 221 ··· 503 503 tcp_syn_retries - INTEGER 504 504 Number of times initial SYNs for an active TCP connection attempt 505 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 507 with the current initial RTO of 1second. With this the final timeout 508 508 for an active TCP connection attempt will happen after 127seconds. 509 509 ··· 1331 1331 race condition where the sender deletes the cached link-layer address 1332 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 1340 icmp/*: 1335 1341 ratelimit - INTEGER 1336 1342 Limit the maximal rates for sending ICMPv6 packets. ··· 1536 1530 * sha1 1537 1531 * none 1538 1532 Ability to assign md5 or sha1 as the selected alg is predicated on the 1539 - configuarion of those algorithms at build time (CONFIG_CRYPTO_MD5 and 1533 + configuration of those algorithms at build time (CONFIG_CRYPTO_MD5 and 1540 1534 CONFIG_CRYPTO_SHA1). 1541 1535 1542 1536 Default: Dependent on configuration. MD5 if available, else SHA1 if ··· 1554 1548 blocking. 1555 1549 1556 1550 1: rcvbuf space is per association 1557 - 0: recbuf space is per socket 1551 + 0: rcvbuf space is per socket 1558 1552 1559 1553 Default: 0 1560 1554
+1 -2
drivers/bcma/Kconfig
··· 67 67 68 68 config BCMA_DRIVER_GPIO 69 69 bool "BCMA GPIO driver" 70 - depends on BCMA 71 - select GPIOLIB 70 + depends on BCMA && GPIOLIB 72 71 help 73 72 Driver to provide access to the GPIO pins of the bcma bus. 74 73
+1 -1
drivers/bcma/driver_chipcommon_sflash.c
··· 35 35 { "M25P40", 0x12, 0x10000, 8, }, 36 36 37 37 { "M25P16", 0x14, 0x10000, 32, }, 38 - { "M25P32", 0x14, 0x10000, 64, }, 38 + { "M25P32", 0x15, 0x10000, 64, }, 39 39 { "M25P64", 0x16, 0x10000, 128, }, 40 40 { "M25FL128", 0x17, 0x10000, 256, }, 41 41 { 0 },
+35
drivers/net/ethernet/nvidia/forcedeth.c
··· 1821 1821 skb->data, 1822 1822 skb_tailroom(skb), 1823 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 1829 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1825 1830 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); 1826 1831 wmb(); ··· 1835 1830 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1836 1831 np->put_rx_ctx = np->first_rx_ctx; 1837 1832 } else { 1833 + packet_dropped: 1838 1834 u64_stats_update_begin(&np->swstats_rx_syncp); 1839 1835 np->stat_rx_dropped++; 1840 1836 u64_stats_update_end(&np->swstats_rx_syncp); ··· 1862 1856 skb->data, 1863 1857 skb_tailroom(skb), 1864 1858 PCI_DMA_FROMDEVICE); 1859 + if (pci_dma_mapping_error(np->pci_dev, 1860 + np->put_rx_ctx->dma)) { 1861 + kfree_skb(skb); 1862 + goto packet_dropped; 1863 + } 1865 1864 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1866 1865 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); 1867 1866 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); ··· 1877 1866 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1878 1867 np->put_rx_ctx = np->first_rx_ctx; 1879 1868 } else { 1869 + packet_dropped: 1880 1870 u64_stats_update_begin(&np->swstats_rx_syncp); 1881 1871 np->stat_rx_dropped++; 1882 1872 u64_stats_update_end(&np->swstats_rx_syncp); ··· 2229 2217 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2230 2218 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2231 2219 PCI_DMA_TODEVICE); 2220 + if (pci_dma_mapping_error(np->pci_dev, 2221 + np->put_tx_ctx->dma)) { 2222 + /* on DMA mapping error - drop the packet */ 2223 + kfree_skb(skb); 2224 + u64_stats_update_begin(&np->swstats_tx_syncp); 2225 + np->stat_tx_dropped++; 2226 + u64_stats_update_end(&np->swstats_tx_syncp); 2227 + return NETDEV_TX_OK; 2228 + } 2232 2229 np->put_tx_ctx->dma_len = bcnt; 2233 2230 np->put_tx_ctx->dma_single = 1; 2234 2231 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); ··· 2358 2337 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2359 2338 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2360 2339 PCI_DMA_TODEVICE); 2340 + if (pci_dma_mapping_error(np->pci_dev, 2341 + np->put_tx_ctx->dma)) { 2342 + /* on DMA mapping error - drop the packet */ 2343 + kfree_skb(skb); 2344 + u64_stats_update_begin(&np->swstats_tx_syncp); 2345 + np->stat_tx_dropped++; 2346 + u64_stats_update_end(&np->swstats_tx_syncp); 2347 + return NETDEV_TX_OK; 2348 + } 2361 2349 np->put_tx_ctx->dma_len = bcnt; 2362 2350 np->put_tx_ctx->dma_single = 1; 2363 2351 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); ··· 5033 5003 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, 5034 5004 skb_tailroom(tx_skb), 5035 5005 PCI_DMA_FROMDEVICE); 5006 + if (pci_dma_mapping_error(np->pci_dev, 5007 + test_dma_addr)) { 5008 + dev_kfree_skb_any(tx_skb); 5009 + goto out; 5010 + } 5036 5011 pkt_data = skb_put(tx_skb, pkt_len); 5037 5012 for (i = 0; i < pkt_len; i++) 5038 5013 pkt_data[i] = (u8)(i & 0xff);
+1
drivers/net/usb/qmi_wwan.c
··· 458 458 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 459 459 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ 460 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 463 /* 4. Gobi 1000 devices */ 463 464 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+1
drivers/net/vxlan.c
··· 1191 1191 1192 1192 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 1193 1193 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1194 + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 1194 1195 1195 1196 spin_lock_init(&vxlan->hash_lock); 1196 1197
+3 -2
drivers/net/wireless/ath/ath9k/Kconfig
··· 2 2 tristate 3 3 config ATH9K_COMMON 4 4 tristate 5 + select ATH_COMMON 5 6 config ATH9K_DFS_DEBUGFS 6 7 def_bool y 7 8 depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED ··· 18 17 config ATH9K 19 18 tristate "Atheros 802.11n wireless cards support" 20 19 depends on MAC80211 21 - select ATH_COMMON 22 20 select ATH9K_HW 23 21 select MAC80211_LEDS 24 22 select LEDS_CLASS ··· 56 56 57 57 config ATH9K_DEBUGFS 58 58 bool "Atheros ath9k debugging" 59 - depends on ATH9K && DEBUG_FS 59 + depends on ATH9K 60 + select MAC80211_DEBUGFS 60 61 ---help--- 61 62 Say Y, if you need access to ath9k's statistics for 62 63 interrupts, rate control, etc.
+1 -1
drivers/net/wireless/ath/ath9k/ar9003_hw.c
··· 544 544 ar9340Common_rx_gain_table_1p0); 545 545 else if (AR_SREV_9485_11(ah)) 546 546 INIT_INI_ARRAY(&ah->iniModesRxGain, 547 - ar9485Common_wo_xlna_rx_gain_1_1); 547 + ar9485_common_rx_gain_1_1); 548 548 else if (AR_SREV_9550(ah)) { 549 549 INIT_INI_ARRAY(&ah->iniModesRxGain, 550 550 ar955x_1p0_common_rx_gain_table);
+5 -1
drivers/net/wireless/ath/carl9170/fw.c
··· 336 336 if (SUPP(CARL9170FW_WLANTX_CAB)) { 337 337 if_comb_types |= 338 338 BIT(NL80211_IFTYPE_AP) | 339 - BIT(NL80211_IFTYPE_MESH_POINT) | 340 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
+3 -2
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 3091 3091 3092 3092 len = wpa_ie->len + TLV_HDR_LEN; 3093 3093 data = (u8 *)wpa_ie; 3094 - offset = 0; 3094 + offset = TLV_HDR_LEN; 3095 3095 if (!is_rsn_ie) 3096 3096 offset += VS_IE_FIXED_HDR_LEN; 3097 - offset += WPA_IE_VERSION_LEN; 3097 + else 3098 + offset += WPA_IE_VERSION_LEN; 3098 3099 3099 3100 /* check for multicast cipher suite */ 3100 3101 if (offset + WPA_IE_MIN_OUI_LEN > len) {
+1
drivers/net/wireless/brcm80211/brcmsmac/debug.h
··· 1 1 /* 2 2 * Copyright (c) 2012 Broadcom Corporation 3 + * Copyright (c) 2012 Canonical Ltd. 3 4 * 4 5 * Permission to use, copy, modify, and/or distribute this software for any 5 6 * purpose with or without fee is hereby granted, provided that the above
+2 -2
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
··· 1343 1343 1344 1344 wlc_lcnphy_rx_gain_override_enable(pi, true); 1345 1345 wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); 1346 - usleep_range(500, 500); 1346 + udelay(500); 1347 1347 write_radio_reg(pi, RADIO_2064_REG112, 0); 1348 1348 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) 1349 1349 return false; 1350 1350 1351 1351 wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); 1352 - usleep_range(500, 500); 1352 + udelay(500); 1353 1353 write_radio_reg(pi, RADIO_2064_REG112, 0); 1354 1354 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) 1355 1355 return false;
+4
drivers/net/wireless/p54/p54usb.c
··· 47 47 {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ 48 48 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ 49 49 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ 50 + {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */ 50 51 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ 51 52 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ 52 53 {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ ··· 83 82 {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ 84 83 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ 85 84 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 85 + {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ 86 + {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */ 86 87 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 87 88 {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ 88 89 {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ ··· 104 101 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 105 102 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ 106 103 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 104 + /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */ 107 105 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ 108 106 {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ 109 107 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
+6
drivers/net/wireless/rtlwifi/pci.c
··· 743 743 744 744 done: 745 745 bufferaddress = (*((dma_addr_t *)skb->cb)); 746 + if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) 747 + return; 746 748 tmp_one = 1; 747 749 rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, 748 750 HW_DESC_RXBUFF_ADDR, ··· 1117 1115 PCI_DMA_FROMDEVICE); 1118 1116 1119 1117 bufferaddress = (*((dma_addr_t *)skb->cb)); 1118 + if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) { 1119 + dev_kfree_skb_any(skb); 1120 + return 1; 1121 + } 1120 1122 rtlpriv->cfg->ops->set_desc((u8 *)entry, false, 1121 1123 HW_DESC_RXBUFF_ADDR, 1122 1124 (u8 *)&bufferaddress);
+11
drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
··· 611 611 dma_addr_t mapping = pci_map_single(rtlpci->pdev, 612 612 skb->data, skb->len, 613 613 PCI_DMA_TODEVICE); 614 + 614 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 622 rcu_read_lock(); 617 623 sta = get_sta(hw, mac->vif, mac->bssid); 618 624 if (mac->opmode == NL80211_IFTYPE_STATION) { ··· 780 774 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 781 775 __le16 fc = hdr->frame_control; 782 776 777 + if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { 778 + RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 779 + "DMA mapping error"); 780 + return; 781 + } 783 782 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 784 783 785 784 if (firstseg)
+10
drivers/net/wireless/rtlwifi/rtl8192de/trx.c
··· 587 587 buf_len = skb->len; 588 588 mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, 589 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 595 CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); 591 596 if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { 592 597 firstseg = true; ··· 745 740 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 746 741 __le16 fc = hdr->frame_control; 747 742 743 + if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { 744 + RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 745 + "DMA mapping error"); 746 + return; 747 + } 748 748 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 749 749 if (firstseg) 750 750 SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
+12 -1
drivers/net/wireless/rtlwifi/rtl8192se/trx.c
··· 611 611 PCI_DMA_TODEVICE); 612 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 619 if (mac->opmode == NL80211_IFTYPE_STATION) { 615 620 bw_40 = mac->bw_40; 616 621 } else if (mac->opmode == NL80211_IFTYPE_AP || ··· 768 763 void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, 769 764 bool firstseg, bool lastseg, struct sk_buff *skb) 770 765 { 766 + struct rtl_priv *rtlpriv = rtl_priv(hw); 771 767 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 772 768 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 773 769 struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); ··· 776 770 dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, 777 771 PCI_DMA_TODEVICE); 778 772 779 - /* Clear all status */ 773 + if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { 774 + RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 775 + "DMA mapping error"); 776 + return; 777 + } 778 + /* Clear all status */ 780 779 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); 781 780 782 781 /* This bit indicate this packet is used for FW download. */
+10
drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
··· 387 387 PCI_DMA_TODEVICE); 388 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 395 if (mac->opmode == NL80211_IFTYPE_STATION) { 391 396 bw_40 = mac->bw_40; 392 397 } else if (mac->opmode == NL80211_IFTYPE_AP || ··· 547 542 PCI_DMA_TODEVICE); 548 543 __le16 fc = hdr->frame_control; 549 544 545 + if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { 546 + RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, 547 + "DMA mapping error"); 548 + return; 549 + } 550 550 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 551 551 552 552 if (firstseg)
+4 -4
drivers/net/wireless/rtlwifi/usb.c
··· 210 210 u16 index = REALTEK_USB_VENQT_CMD_IDX; 211 211 int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ 212 212 u8 *buffer; 213 - dma_addr_t dma_addr; 214 213 215 - wvalue = (u16)(addr&0x0000ffff); 216 - buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); 214 + wvalue = (u16)(addr & 0x0000ffff); 215 + buffer = kmalloc(len, GFP_ATOMIC); 217 216 if (!buffer) 218 217 return; 219 218 memcpy(buffer, data, len); 220 219 usb_control_msg(udev, pipe, request, reqtype, wvalue, 221 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 225 static void _rtl_usb_io_handler_init(struct device *dev, ··· 639 640 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 640 641 "Failed to prep_rx_urb!!\n"); 641 642 err = PTR_ERR(skb); 643 + usb_free_urb(urb); 642 644 goto err_out; 643 645 } 644 646
+4 -23
drivers/net/xen-netfront.c
··· 1015 1015 i = xennet_fill_frags(np, skb, &tmpq); 1016 1016 1017 1017 /* 1018 - * Truesize approximates the size of true data plus 1019 - * any supervisor overheads. Adding hypervisor 1020 - * overheads has been shown to significantly reduce 1021 - * achievable bandwidth with the default receive 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; 1018 + * Truesize is the actual allocation size, even if the 1019 + * allocation is only partially used. 1020 + */ 1021 + skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; 1041 1022 skb->len += skb->data_len; 1042 1023 1043 1024 if (rx->flags & XEN_NETRXF_csum_blank)
+1 -2
drivers/ssb/Kconfig
··· 162 162 163 163 config SSB_DRIVER_GPIO 164 164 bool "SSB GPIO driver" 165 - depends on SSB 166 - select GPIOLIB 165 + depends on SSB && GPIOLIB 167 166 help 168 167 Driver to provide access to the GPIO pins on the bus. 169 168
+3 -1
fs/splice.c
··· 696 696 return -EINVAL; 697 697 698 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 701 more |= MSG_SENDPAGE_NOTLAST; 702 + 701 703 return file->f_op->sendpage(file, buf->page, buf->offset, 702 704 sd->len, &pos, more); 703 705 }
+1
include/net/netns/conntrack.h
··· 71 71 struct hlist_head *expect_hash; 72 72 struct hlist_nulls_head unconfirmed; 73 73 struct hlist_nulls_head dying; 74 + struct hlist_nulls_head tmpl; 74 75 struct ip_conntrack_stat __percpu *stat; 75 76 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 76 77 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
+1
include/net/netns/x_tables.h
··· 8 8 9 9 struct netns_xt { 10 10 struct list_head tables[NFPROTO_NUMPROTO]; 11 + bool notrack_deprecated_warning; 11 12 #if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ 12 13 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) 13 14 struct ebt_table *broute_table;
-2
net/bridge/br_multicast.c
··· 1608 1608 br_multicast_querier_expired, (unsigned long)br); 1609 1609 setup_timer(&br->multicast_query_timer, br_multicast_query_expired, 1610 1610 (unsigned long)br); 1611 - br_mdb_init(); 1612 1611 } 1613 1612 1614 1613 void br_multicast_open(struct net_bridge *br) ··· 1632 1633 del_timer_sync(&br->multicast_querier_timer); 1633 1634 del_timer_sync(&br->multicast_query_timer); 1634 1635 1635 - br_mdb_uninit(); 1636 1636 spin_lock_bh(&br->multicast_lock); 1637 1637 mdb = mlock_dereference(br->mdb, br); 1638 1638 if (!mdb)
+12 -1
net/bridge/br_netlink.c
··· 299 299 300 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 315 void __exit br_netlink_fini(void) 306 316 { 317 + br_mdb_uninit(); 307 318 rtnl_link_unregister(&br_link_ops); 308 319 }
+6
net/bridge/br_private.h
··· 526 526 { 527 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 535 #endif 530 536 531 537 /* br_netfilter.c */
+1 -1
net/ipv4/devinet.c
··· 823 823 if (!ifa) { 824 824 ret = -ENOBUFS; 825 825 ifa = inet_alloc_ifa(); 826 - INIT_HLIST_NODE(&ifa->hash); 827 826 if (!ifa) 828 827 break; 828 + INIT_HLIST_NODE(&ifa->hash); 829 829 if (colon) 830 830 memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); 831 831 else
+6 -2
net/ipv4/ipconfig.c
··· 136 136 static __be32 ic_netmask = NONE; /* Netmask for local subnet */ 137 137 __be32 ic_gateway = NONE; /* Gateway IP address */ 138 138 139 + __be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */ 140 + 139 141 __be32 ic_servaddr = NONE; /* Boot server IP address */ 140 142 141 143 __be32 root_server_addr = NONE; /* Address of NFS server */ ··· 560 558 if (ic_myaddr == NONE) 561 559 ic_myaddr = tip; 562 560 ic_servaddr = sip; 561 + ic_addrservaddr = sip; 563 562 ic_got_reply = IC_RARP; 564 563 565 564 drop_unlock: ··· 1071 1068 ic_servaddr = server_id; 1072 1069 #ifdef IPCONFIG_DEBUG 1073 1070 printk("DHCP: Offered address %pI4 by server %pI4\n", 1074 - &ic_myaddr, &ic_servaddr); 1071 + &ic_myaddr, &b->iph.saddr); 1075 1072 #endif 1076 1073 /* The DHCP indicated server address takes 1077 1074 * precedence over the bootp header one if ··· 1116 1113 ic_dev = dev; 1117 1114 ic_myaddr = b->your_ip; 1118 1115 ic_servaddr = b->server_ip; 1116 + ic_addrservaddr = b->iph.saddr; 1119 1117 if (ic_gateway == NONE && b->relay_ip) 1120 1118 ic_gateway = b->relay_ip; 1121 1119 if (ic_nameservers[0] == NONE) ··· 1272 1268 printk("IP-Config: Got %s answer from %pI4, ", 1273 1269 ((ic_got_reply & IC_RARP) ? "RARP" 1274 1270 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), 1275 - &ic_servaddr); 1271 + &ic_addrservaddr); 1276 1272 pr_cont("my address is %pI4\n", &ic_myaddr); 1277 1273 1278 1274 return 0;
+1
net/ipv4/netfilter/ipt_REJECT.c
··· 81 81 niph->saddr = oiph->daddr; 82 82 niph->daddr = oiph->saddr; 83 83 84 + skb_reset_transport_header(nskb); 84 85 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); 85 86 memset(tcph, 0, sizeof(*tcph)); 86 87 tcph->source = oth->dest;
+10 -5
net/ipv4/netfilter/iptable_nat.c
··· 124 124 ret = nf_nat_rule_find(skb, hooknum, in, out, ct); 125 125 if (ret != NF_ACCEPT) 126 126 return ret; 127 - } else 127 + } else { 128 128 pr_debug("Already setup manip %s for ct %p\n", 129 129 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", 130 130 ct); 131 + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) 132 + goto oif_changed; 133 + } 131 134 break; 132 135 133 136 default: 134 137 /* ESTABLISHED */ 135 138 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || 136 139 ctinfo == IP_CT_ESTABLISHED_REPLY); 137 - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { 138 - nf_ct_kill_acct(ct, ctinfo, skb); 139 - return NF_DROP; 140 - } 140 + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) 141 + goto oif_changed; 141 142 } 142 143 143 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 151 static unsigned int
+7 -26
net/ipv6/netfilter/ip6t_NPT.c
··· 14 14 #include <linux/netfilter_ipv6/ip6t_NPT.h> 15 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 17 static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) 37 18 { 38 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 21 unsigned int i; 41 22 42 23 if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) 43 24 return -EINVAL; 44 25 45 26 for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { 46 - src_sum = csum16_add(src_sum, 47 - (__force __sum16)npt->src_pfx.in6.s6_addr16[i]); 48 - dst_sum = csum16_add(dst_sum, 49 - (__force __sum16)npt->dst_pfx.in6.s6_addr16[i]); 27 + src_sum = csum_add(src_sum, 28 + (__force __wsum)npt->src_pfx.in6.s6_addr16[i]); 29 + dst_sum = csum_add(dst_sum, 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 34 return 0; 54 35 } 55 36 ··· 66 85 return false; 67 86 } 68 87 69 - sum = csum16_add((__force __sum16)addr->s6_addr16[idx], 88 + sum = (__force __sum16) csum_add((__force __wsum)addr->s6_addr16[idx], 70 89 npt->adjustment); 71 90 if (sum == CSUM_MANGLED_0) 72 91 sum = 0;
+1
net/ipv6/netfilter/ip6t_REJECT.c
··· 132 132 ip6h->saddr = oip6h->daddr; 133 133 ip6h->daddr = oip6h->saddr; 134 134 135 + skb_reset_transport_header(nskb); 135 136 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); 136 137 /* Truncate to length (no data) */ 137 138 tcph->doff = sizeof(struct tcphdr)/4;
+10 -5
net/ipv6/netfilter/ip6table_nat.c
··· 127 127 ret = nf_nat_rule_find(skb, hooknum, in, out, ct); 128 128 if (ret != NF_ACCEPT) 129 129 return ret; 130 - } else 130 + } else { 131 131 pr_debug("Already setup manip %s for ct %p\n", 132 132 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", 133 133 ct); 134 + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) 135 + goto oif_changed; 136 + } 134 137 break; 135 138 136 139 default: 137 140 /* ESTABLISHED */ 138 141 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || 139 142 ctinfo == IP_CT_ESTABLISHED_REPLY); 140 - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { 141 - nf_ct_kill_acct(ct, ctinfo, skb); 142 - return NF_DROP; 143 - } 143 + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) 144 + goto oif_changed; 144 145 } 145 146 146 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 154 static unsigned int
+2 -2
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
··· 81 81 } 82 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 85 - * except of IPv6 & ext headers. but it's tracked anyway. - YK 84 + * (protoff == skb->len) means the packet has not data, just 85 + * IPv6 and possibly extensions headers, but it is tracked anyway 86 86 */ 87 87 if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { 88 88 pr_debug("ip6_conntrack_core: can't find proto in pkt\n");
+4 -1
net/ipv6/netfilter/nf_conntrack_reasm.c
··· 311 311 else 312 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 318 fq->q.stamp = skb->tstamp; 316 319 fq->q.meat += skb->len; 317 320 if (payload_len > fq->q.max_size)
+1 -1
net/mac802154/wpan.c
··· 389 389 390 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 395 static int
+7
net/netfilter/Kconfig
··· 680 680 681 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 690 config NETFILTER_XT_TARGET_RATEEST 684 691 tristate '"RATEEST" target support' 685 692 depends on NETFILTER_ADVANCED
+2
net/netfilter/nf_conntrack_core.c
··· 1526 1526 */ 1527 1527 #define UNCONFIRMED_NULLS_VAL ((1<<30)+0) 1528 1528 #define DYING_NULLS_VAL ((1<<30)+1) 1529 + #define TEMPLATE_NULLS_VAL ((1<<30)+2) 1529 1530 1530 1531 static int nf_conntrack_init_net(struct net *net) 1531 1532 { ··· 1535 1534 atomic_set(&net->ct.count, 0); 1536 1535 INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL); 1537 1536 INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL); 1537 + INIT_HLIST_NULLS_HEAD(&net->ct.tmpl, TEMPLATE_NULLS_VAL); 1538 1538 net->ct.stat = alloc_percpu(struct ip_conntrack_stat); 1539 1539 if (!net->ct.stat) { 1540 1540 ret = -ENOMEM;
+1 -1
net/netfilter/nf_conntrack_netlink.c
··· 2624 2624 if (!help) { 2625 2625 if (!cda[CTA_EXPECT_TIMEOUT]) { 2626 2626 err = -EINVAL; 2627 - goto out; 2627 + goto err_out; 2628 2628 } 2629 2629 exp->timeout.expires = 2630 2630 jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ;
+57 -1
net/netfilter/xt_CT.c
··· 149 149 150 150 __set_bit(IPS_TEMPLATE_BIT, &ct->status); 151 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 156 out: 153 157 info->ct = ct; 154 158 return 0; ··· 293 289 294 290 __set_bit(IPS_TEMPLATE_BIT, &ct->status); 295 291 __set_bit(IPS_CONFIRMED_BIT, &ct->status); 292 + 293 + /* Overload tuple linked list to put us in template list. */ 294 + hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, 295 + &par->net->ct.tmpl); 296 296 out: 297 297 info->ct = ct; 298 298 return 0; ··· 385 377 }, 386 378 }; 387 379 380 + static unsigned int 381 + notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) 382 + { 383 + /* Previously seen (loopback)? Ignore. */ 384 + if (skb->nfct != NULL) 385 + return XT_CONTINUE; 386 + 387 + skb->nfct = &nf_ct_untracked_get()->ct_general; 388 + skb->nfctinfo = IP_CT_NEW; 389 + nf_conntrack_get(skb->nfct); 390 + 391 + return XT_CONTINUE; 392 + } 393 + 394 + static int notrack_chk(const struct xt_tgchk_param *par) 395 + { 396 + if (!par->net->xt.notrack_deprecated_warning) { 397 + pr_info("netfilter: NOTRACK target is deprecated, " 398 + "use CT instead or upgrade iptables\n"); 399 + par->net->xt.notrack_deprecated_warning = true; 400 + } 401 + return 0; 402 + } 403 + 404 + static struct xt_target notrack_tg_reg __read_mostly = { 405 + .name = "NOTRACK", 406 + .revision = 0, 407 + .family = NFPROTO_UNSPEC, 408 + .checkentry = notrack_chk, 409 + .target = notrack_tg, 410 + .table = "raw", 411 + .me = THIS_MODULE, 412 + }; 413 + 388 414 static int __init xt_ct_tg_init(void) 389 415 { 390 - return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 416 + int ret; 417 + 418 + ret = xt_register_target(&notrack_tg_reg); 419 + if (ret < 0) 420 + return ret; 421 + 422 + ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 423 + if (ret < 0) { 424 + xt_unregister_target(&notrack_tg_reg); 425 + return ret; 426 + } 427 + return 0; 391 428 } 392 429 393 430 static void __exit xt_ct_tg_exit(void) 394 431 { 395 432 xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 433 + xt_unregister_target(&notrack_tg_reg); 396 434 } 397 435 398 436 module_init(xt_ct_tg_init); ··· 448 394 MODULE_DESCRIPTION("Xtables: connection tracking target"); 449 395 MODULE_ALIAS("ipt_CT"); 450 396 MODULE_ALIAS("ip6t_CT"); 397 + MODULE_ALIAS("ipt_NOTRACK"); 398 + MODULE_ALIAS("ip6t_NOTRACK");
+46 -8
net/netfilter/xt_hashlimit.c
··· 157 157 /* allocate dsthash_ent, initialize dst, put in htable and lock it */ 158 158 static struct dsthash_ent * 159 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 162 struct dsthash_ent *ent; 163 163 164 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 176 /* initialize hash with random val at the time we allocate 166 177 * the first hashtable entry */ 167 178 if (unlikely(!ht->rnd_initialized)) { ··· 329 318 parent = hashlimit_net->ipt_hashlimit; 330 319 else 331 320 parent = hashlimit_net->ip6t_hashlimit; 332 - remove_proc_entry(hinfo->pde->name, parent); 321 + 322 + if(parent != NULL) 323 + remove_proc_entry(hinfo->pde->name, parent); 324 + 333 325 htable_selective_cleanup(hinfo, select_all); 334 326 vfree(hinfo); 335 327 } ··· 599 585 unsigned long now = jiffies; 600 586 struct dsthash_ent *dh; 601 587 struct dsthash_dst dst; 588 + bool race = false; 602 589 u32 cost; 603 590 604 591 if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0) ··· 608 593 rcu_read_lock_bh(); 609 594 dh = dsthash_find(hinfo, &dst); 610 595 if (dh == NULL) { 611 - dh = dsthash_alloc_init(hinfo, &dst); 596 + dh = dsthash_alloc_init(hinfo, &dst, &race); 612 597 if (dh == NULL) { 613 598 rcu_read_unlock_bh(); 614 599 goto hotdrop; 600 + } else if (race) { 601 + /* Already got an entry, update expiration timeout */ 602 + dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); 603 + rateinfo_recalc(dh, now, hinfo->cfg.mode); 604 + } else { 605 + dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); 606 + rateinfo_init(dh, hinfo); 615 607 } 616 - dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); 617 - rateinfo_init(dh, hinfo); 618 608 } else { 619 609 /* update expiration timeout */ 620 610 dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); ··· 876 856 877 857 static void __net_exit hashlimit_proc_net_exit(struct net *net) 878 858 { 859 + struct xt_hashlimit_htable *hinfo; 860 + struct hlist_node *pos; 861 + struct proc_dir_entry *pde; 862 + struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); 863 + 864 + /* recent_net_exit() is called before recent_mt_destroy(). Make sure 865 + * that the parent xt_recent proc entry is is empty before trying to 866 + * remove it. 867 + */ 868 + mutex_lock(&hashlimit_mutex); 869 + pde = hashlimit_net->ipt_hashlimit; 870 + if (pde == NULL) 871 + pde = hashlimit_net->ip6t_hashlimit; 872 + 873 + hlist_for_each_entry(hinfo, pos, &hashlimit_net->htables, node) 874 + remove_proc_entry(hinfo->pde->name, pde); 875 + 876 + hashlimit_net->ipt_hashlimit = NULL; 877 + hashlimit_net->ip6t_hashlimit = NULL; 878 + mutex_unlock(&hashlimit_mutex); 879 + 879 880 proc_net_remove(net, "ipt_hashlimit"); 880 881 #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 881 882 proc_net_remove(net, "ip6t_hashlimit"); ··· 913 872 914 873 static void __net_exit hashlimit_net_exit(struct net *net) 915 874 { 916 - struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); 917 - 918 - BUG_ON(!hlist_empty(&hashlimit_net->htables)); 919 875 hashlimit_proc_net_exit(net); 920 876 } 921 877
+34 -9
net/netfilter/xt_recent.c
··· 29 29 #include <linux/skbuff.h> 30 30 #include <linux/inet.h> 31 31 #include <linux/slab.h> 32 + #include <linux/vmalloc.h> 32 33 #include <net/net_namespace.h> 33 34 #include <net/netns/generic.h> 34 35 ··· 311 310 return ret; 312 311 } 313 312 313 + static void recent_table_free(void *addr) 314 + { 315 + if (is_vmalloc_addr(addr)) 316 + vfree(addr); 317 + else 318 + kfree(addr); 319 + } 320 + 314 321 static int recent_mt_check(const struct xt_mtchk_param *par, 315 322 const struct xt_recent_mtinfo_v1 *info) 316 323 { ··· 331 322 #endif 332 323 unsigned int i; 333 324 int ret = -EINVAL; 325 + size_t sz; 334 326 335 327 if (unlikely(!hash_rnd_inited)) { 336 328 get_random_bytes(&hash_rnd, sizeof(hash_rnd)); ··· 370 360 goto out; 371 361 } 372 362 373 - t = kzalloc(sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size, 374 - GFP_KERNEL); 363 + sz = sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size; 364 + if (sz <= PAGE_SIZE) 365 + t = kzalloc(sz, GFP_KERNEL); 366 + else 367 + t = vzalloc(sz); 375 368 if (t == NULL) { 376 369 ret = -ENOMEM; 377 370 goto out; ··· 390 377 uid = make_kuid(&init_user_ns, ip_list_uid); 391 378 gid = make_kgid(&init_user_ns, ip_list_gid); 392 379 if (!uid_valid(uid) || !gid_valid(gid)) { 393 - kfree(t); 380 + recent_table_free(t); 394 381 ret = -EINVAL; 395 382 goto out; 396 383 } 397 384 pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, 398 385 &recent_mt_fops, t); 399 386 if (pde == NULL) { 400 - kfree(t); 387 + recent_table_free(t); 401 388 ret = -ENOMEM; 402 389 goto out; 403 390 } ··· 444 431 list_del(&t->list); 445 432 spin_unlock_bh(&recent_lock); 446 433 #ifdef CONFIG_PROC_FS 447 - remove_proc_entry(t->name, recent_net->xt_recent); 434 + if (recent_net->xt_recent != NULL) 435 + remove_proc_entry(t->name, recent_net->xt_recent); 448 436 #endif 449 437 recent_table_flush(t); 450 - kfree(t); 438 + recent_table_free(t); 451 439 } 452 440 mutex_unlock(&recent_mutex); 453 441 } ··· 629 615 630 616 static void __net_exit recent_proc_net_exit(struct net *net) 631 617 { 618 + struct recent_net *recent_net = recent_pernet(net); 619 + struct recent_table *t; 620 + 621 + /* recent_net_exit() is called before recent_mt_destroy(). Make sure 622 + * that the parent xt_recent proc entry is is empty before trying to 623 + * remove it. 624 + */ 625 + spin_lock_bh(&recent_lock); 626 + list_for_each_entry(t, &recent_net->tables, list) 627 + remove_proc_entry(t->name, recent_net->xt_recent); 628 + 629 + recent_net->xt_recent = NULL; 630 + spin_unlock_bh(&recent_lock); 631 + 632 632 proc_net_remove(net, "xt_recent"); 633 633 } 634 634 #else ··· 666 638 667 639 static void __net_exit recent_net_exit(struct net *net) 668 640 { 669 - struct recent_net *recent_net = recent_pernet(net); 670 - 671 - BUG_ON(!list_empty(&recent_net->tables)); 672 641 recent_proc_net_exit(net); 673 642 } 674 643