diff options
69 files changed, 540 insertions, 459 deletions
diff --git a/Documentation/networking/ipvs-sysctl.txt b/Documentation/networking/ipvs-sysctl.txt index f2a2488f1bf3..9573d0c48c6e 100644 --- a/Documentation/networking/ipvs-sysctl.txt +++ b/Documentation/networking/ipvs-sysctl.txt | |||
@@ -15,6 +15,13 @@ amemthresh - INTEGER | |||
15 | enabled and the variable is automatically set to 2, otherwise | 15 | enabled and the variable is automatically set to 2, otherwise |
16 | the strategy is disabled and the variable is set to 1. | 16 | the strategy is disabled and the variable is set to 1. |
17 | 17 | ||
18 | backup_only - BOOLEAN | ||
19 | 0 - disabled (default) | ||
20 | not 0 - enabled | ||
21 | |||
22 | If set, disable the director function while the server is | ||
23 | in backup mode to avoid packet loops for DR/TUN methods. | ||
24 | |||
18 | conntrack - BOOLEAN | 25 | conntrack - BOOLEAN |
19 | 0 - disabled (default) | 26 | 0 - disabled (default) |
20 | not 0 - enabled | 27 | not 0 - enabled |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index b282af181b44..6aab00ef4379 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -73,9 +73,11 @@ static struct usb_device_id ath3k_table[] = { | |||
73 | { USB_DEVICE(0x03F0, 0x311D) }, | 73 | { USB_DEVICE(0x03F0, 0x311D) }, |
74 | 74 | ||
75 | /* Atheros AR3012 with sflash firmware*/ | 75 | /* Atheros AR3012 with sflash firmware*/ |
76 | { USB_DEVICE(0x0CF3, 0x0036) }, | ||
76 | { USB_DEVICE(0x0CF3, 0x3004) }, | 77 | { USB_DEVICE(0x0CF3, 0x3004) }, |
77 | { USB_DEVICE(0x0CF3, 0x3008) }, | 78 | { USB_DEVICE(0x0CF3, 0x3008) }, |
78 | { USB_DEVICE(0x0CF3, 0x311D) }, | 79 | { USB_DEVICE(0x0CF3, 0x311D) }, |
80 | { USB_DEVICE(0x0CF3, 0x817a) }, | ||
79 | { USB_DEVICE(0x13d3, 0x3375) }, | 81 | { USB_DEVICE(0x13d3, 0x3375) }, |
80 | { USB_DEVICE(0x04CA, 0x3004) }, | 82 | { USB_DEVICE(0x04CA, 0x3004) }, |
81 | { USB_DEVICE(0x04CA, 0x3005) }, | 83 | { USB_DEVICE(0x04CA, 0x3005) }, |
@@ -107,9 +109,11 @@ MODULE_DEVICE_TABLE(usb, ath3k_table); | |||
107 | static struct usb_device_id ath3k_blist_tbl[] = { | 109 | static struct usb_device_id ath3k_blist_tbl[] = { |
108 | 110 | ||
109 | /* Atheros AR3012 with sflash firmware*/ | 111 | /* Atheros AR3012 with sflash firmware*/ |
112 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, | ||
110 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 113 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
111 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 114 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
112 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 115 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
116 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, | ||
113 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 117 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
114 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | 118 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
115 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 119 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index e547851870e7..2cc5f774a29c 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -131,9 +131,11 @@ static struct usb_device_id blacklist_table[] = { | |||
131 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 131 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
132 | 132 | ||
133 | /* Atheros 3012 with sflash firmware */ | 133 | /* Atheros 3012 with sflash firmware */ |
134 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, | ||
134 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 135 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 136 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
136 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, | ||
137 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
138 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, |
139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 1c9e09fbdff8..db103e03ba05 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -183,6 +183,11 @@ int bond_create_slave_symlinks(struct net_device *master, | |||
183 | sprintf(linkname, "slave_%s", slave->name); | 183 | sprintf(linkname, "slave_%s", slave->name); |
184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), | 184 | ret = sysfs_create_link(&(master->dev.kobj), &(slave->dev.kobj), |
185 | linkname); | 185 | linkname); |
186 | |||
187 | /* free the master link created earlier in case of error */ | ||
188 | if (ret) | ||
189 | sysfs_remove_link(&(slave->dev.kobj), "master"); | ||
190 | |||
186 | return ret; | 191 | return ret; |
187 | 192 | ||
188 | } | 193 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 568205436a15..91ecd6a00d05 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | |||
@@ -2139,12 +2139,12 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap) | |||
2139 | break; | 2139 | break; |
2140 | default: | 2140 | default: |
2141 | BNX2X_ERR("Non valid capability ID\n"); | 2141 | BNX2X_ERR("Non valid capability ID\n"); |
2142 | rval = -EINVAL; | 2142 | rval = 1; |
2143 | break; | 2143 | break; |
2144 | } | 2144 | } |
2145 | } else { | 2145 | } else { |
2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2146 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2147 | rval = -EINVAL; | 2147 | rval = 1; |
2148 | } | 2148 | } |
2149 | 2149 | ||
2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); | 2150 | DP(BNX2X_MSG_DCB, "capid %d:%x\n", capid, *cap); |
@@ -2170,12 +2170,12 @@ static int bnx2x_dcbnl_get_numtcs(struct net_device *netdev, int tcid, u8 *num) | |||
2170 | break; | 2170 | break; |
2171 | default: | 2171 | default: |
2172 | BNX2X_ERR("Non valid TC-ID\n"); | 2172 | BNX2X_ERR("Non valid TC-ID\n"); |
2173 | rval = -EINVAL; | 2173 | rval = 1; |
2174 | break; | 2174 | break; |
2175 | } | 2175 | } |
2176 | } else { | 2176 | } else { |
2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2177 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2178 | rval = -EINVAL; | 2178 | rval = 1; |
2179 | } | 2179 | } |
2180 | 2180 | ||
2181 | return rval; | 2181 | return rval; |
@@ -2188,7 +2188,7 @@ static int bnx2x_dcbnl_set_numtcs(struct net_device *netdev, int tcid, u8 num) | |||
2188 | return -EINVAL; | 2188 | return -EINVAL; |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) | 2191 | static u8 bnx2x_dcbnl_get_pfc_state(struct net_device *netdev) |
2192 | { | 2192 | { |
2193 | struct bnx2x *bp = netdev_priv(netdev); | 2193 | struct bnx2x *bp = netdev_priv(netdev); |
2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); | 2194 | DP(BNX2X_MSG_DCB, "state = %d\n", bp->dcbx_local_feat.pfc.enabled); |
@@ -2390,12 +2390,12 @@ static u8 bnx2x_dcbnl_get_featcfg(struct net_device *netdev, int featid, | |||
2390 | break; | 2390 | break; |
2391 | default: | 2391 | default: |
2392 | BNX2X_ERR("Non valid featrue-ID\n"); | 2392 | BNX2X_ERR("Non valid featrue-ID\n"); |
2393 | rval = -EINVAL; | 2393 | rval = 1; |
2394 | break; | 2394 | break; |
2395 | } | 2395 | } |
2396 | } else { | 2396 | } else { |
2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); | 2397 | DP(BNX2X_MSG_DCB, "DCB disabled\n"); |
2398 | rval = -EINVAL; | 2398 | rval = 1; |
2399 | } | 2399 | } |
2400 | 2400 | ||
2401 | return rval; | 2401 | return rval; |
@@ -2431,12 +2431,12 @@ static u8 bnx2x_dcbnl_set_featcfg(struct net_device *netdev, int featid, | |||
2431 | break; | 2431 | break; |
2432 | default: | 2432 | default: |
2433 | BNX2X_ERR("Non valid featrue-ID\n"); | 2433 | BNX2X_ERR("Non valid featrue-ID\n"); |
2434 | rval = -EINVAL; | 2434 | rval = 1; |
2435 | break; | 2435 | break; |
2436 | } | 2436 | } |
2437 | } else { | 2437 | } else { |
2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); | 2438 | DP(BNX2X_MSG_DCB, "dcbnl call not valid\n"); |
2439 | rval = -EINVAL; | 2439 | rval = 1; |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | return rval; | 2442 | return rval; |
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index e3f39372ce25..911d0253dbb2 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -1332,7 +1332,7 @@ static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | |||
1332 | static void fec_enet_free_buffers(struct net_device *ndev) | 1332 | static void fec_enet_free_buffers(struct net_device *ndev) |
1333 | { | 1333 | { |
1334 | struct fec_enet_private *fep = netdev_priv(ndev); | 1334 | struct fec_enet_private *fep = netdev_priv(ndev); |
1335 | int i; | 1335 | unsigned int i; |
1336 | struct sk_buff *skb; | 1336 | struct sk_buff *skb; |
1337 | struct bufdesc *bdp; | 1337 | struct bufdesc *bdp; |
1338 | 1338 | ||
@@ -1356,7 +1356,7 @@ static void fec_enet_free_buffers(struct net_device *ndev) | |||
1356 | static int fec_enet_alloc_buffers(struct net_device *ndev) | 1356 | static int fec_enet_alloc_buffers(struct net_device *ndev) |
1357 | { | 1357 | { |
1358 | struct fec_enet_private *fep = netdev_priv(ndev); | 1358 | struct fec_enet_private *fep = netdev_priv(ndev); |
1359 | int i; | 1359 | unsigned int i; |
1360 | struct sk_buff *skb; | 1360 | struct sk_buff *skb; |
1361 | struct bufdesc *bdp; | 1361 | struct bufdesc *bdp; |
1362 | 1362 | ||
@@ -1598,7 +1598,7 @@ static int fec_enet_init(struct net_device *ndev) | |||
1598 | struct fec_enet_private *fep = netdev_priv(ndev); | 1598 | struct fec_enet_private *fep = netdev_priv(ndev); |
1599 | struct bufdesc *cbd_base; | 1599 | struct bufdesc *cbd_base; |
1600 | struct bufdesc *bdp; | 1600 | struct bufdesc *bdp; |
1601 | int i; | 1601 | unsigned int i; |
1602 | 1602 | ||
1603 | /* Allocate memory for buffer descriptors. */ | 1603 | /* Allocate memory for buffer descriptors. */ |
1604 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, | 1604 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, |
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index 1f17ca0f2201..0d8df400a479 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -128,6 +128,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev) | |||
128 | 128 | ||
129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); | 129 | spin_unlock_irqrestore(&fep->tmreg_lock, flags); |
130 | } | 130 | } |
131 | EXPORT_SYMBOL(fec_ptp_start_cyclecounter); | ||
131 | 132 | ||
132 | /** | 133 | /** |
133 | * fec_ptp_adjfreq - adjust ptp cycle frequency | 134 | * fec_ptp_adjfreq - adjust ptp cycle frequency |
@@ -318,6 +319,7 @@ int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) | |||
318 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? | 319 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? |
319 | -EFAULT : 0; | 320 | -EFAULT : 0; |
320 | } | 321 | } |
322 | EXPORT_SYMBOL(fec_ptp_ioctl); | ||
321 | 323 | ||
322 | /** | 324 | /** |
323 | * fec_time_keep - call timecounter_read every second to avoid timer overrun | 325 | * fec_time_keep - call timecounter_read every second to avoid timer overrun |
@@ -383,3 +385,4 @@ void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev) | |||
383 | pr_info("registered PHC device on %s\n", ndev->name); | 385 | pr_info("registered PHC device on %s\n", ndev->name); |
384 | } | 386 | } |
385 | } | 387 | } |
388 | EXPORT_SYMBOL(fec_ptp_init); | ||
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index b64542acfa34..12b1d8480808 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -1818,27 +1818,32 @@ out: | |||
1818 | **/ | 1818 | **/ |
1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) | 1819 | void igb_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf) |
1820 | { | 1820 | { |
1821 | u32 dtxswc; | 1821 | u32 reg_val, reg_offset; |
1822 | 1822 | ||
1823 | switch (hw->mac.type) { | 1823 | switch (hw->mac.type) { |
1824 | case e1000_82576: | 1824 | case e1000_82576: |
1825 | reg_offset = E1000_DTXSWC; | ||
1826 | break; | ||
1825 | case e1000_i350: | 1827 | case e1000_i350: |
1826 | dtxswc = rd32(E1000_DTXSWC); | 1828 | reg_offset = E1000_TXSWC; |
1827 | if (enable) { | ||
1828 | dtxswc |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1829 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1830 | /* The PF can spoof - it has to in order to | ||
1831 | * support emulation mode NICs */ | ||
1832 | dtxswc ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1833 | } else { | ||
1834 | dtxswc &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1835 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1836 | } | ||
1837 | wr32(E1000_DTXSWC, dtxswc); | ||
1838 | break; | 1829 | break; |
1839 | default: | 1830 | default: |
1840 | break; | 1831 | return; |
1832 | } | ||
1833 | |||
1834 | reg_val = rd32(reg_offset); | ||
1835 | if (enable) { | ||
1836 | reg_val |= (E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1837 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1838 | /* The PF can spoof - it has to in order to | ||
1839 | * support emulation mode NICs | ||
1840 | */ | ||
1841 | reg_val ^= (1 << pf | 1 << (pf + MAX_NUM_VFS)); | ||
1842 | } else { | ||
1843 | reg_val &= ~(E1000_DTXSWC_MAC_SPOOF_MASK | | ||
1844 | E1000_DTXSWC_VLAN_SPOOF_MASK); | ||
1841 | } | 1845 | } |
1846 | wr32(reg_offset, reg_val); | ||
1842 | } | 1847 | } |
1843 | 1848 | ||
1844 | /** | 1849 | /** |
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c index 4623502054d5..0478a1abe541 100644 --- a/drivers/net/ethernet/intel/igb/igb_hwmon.c +++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
40 | 40 | ||
41 | #ifdef CONFIG_IGB_HWMON | 41 | #ifdef CONFIG_IGB_HWMON |
42 | struct i2c_board_info i350_sensor_info = { | 42 | static struct i2c_board_info i350_sensor_info = { |
43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), | 43 | I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)), |
44 | }; | 44 | }; |
45 | 45 | ||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 4dbd62968c7a..8496adfc6a68 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -2542,8 +2542,8 @@ static void igb_probe_vfs(struct igb_adapter *adapter) | |||
2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) | 2542 | if ((hw->mac.type == e1000_i210) || (hw->mac.type == e1000_i211)) |
2543 | return; | 2543 | return; |
2544 | 2544 | ||
2545 | igb_enable_sriov(pdev, max_vfs); | ||
2546 | pci_sriov_set_totalvfs(pdev, 7); | 2545 | pci_sriov_set_totalvfs(pdev, 7); |
2546 | igb_enable_sriov(pdev, max_vfs); | ||
2547 | 2547 | ||
2548 | #endif /* CONFIG_PCI_IOV */ | 2548 | #endif /* CONFIG_PCI_IOV */ |
2549 | } | 2549 | } |
@@ -2652,7 +2652,7 @@ static int igb_sw_init(struct igb_adapter *adapter) | |||
2652 | if (max_vfs > 7) { | 2652 | if (max_vfs > 7) { |
2653 | dev_warn(&pdev->dev, | 2653 | dev_warn(&pdev->dev, |
2654 | "Maximum of 7 VFs per PF, using max\n"); | 2654 | "Maximum of 7 VFs per PF, using max\n"); |
2655 | adapter->vfs_allocated_count = 7; | 2655 | max_vfs = adapter->vfs_allocated_count = 7; |
2656 | } else | 2656 | } else |
2657 | adapter->vfs_allocated_count = max_vfs; | 2657 | adapter->vfs_allocated_count = max_vfs; |
2658 | if (adapter->vfs_allocated_count) | 2658 | if (adapter->vfs_allocated_count) |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 0987822359f0..0a237507ee85 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter) | |||
740 | case e1000_82576: | 740 | case e1000_82576: |
741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); | 741 | snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); |
742 | adapter->ptp_caps.owner = THIS_MODULE; | 742 | adapter->ptp_caps.owner = THIS_MODULE; |
743 | adapter->ptp_caps.max_adj = 1000000000; | 743 | adapter->ptp_caps.max_adj = 999999881; |
744 | adapter->ptp_caps.n_ext_ts = 0; | 744 | adapter->ptp_caps.n_ext_ts = 0; |
745 | adapter->ptp_caps.pps = 0; | 745 | adapter->ptp_caps.pps = 0; |
746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; | 746 | adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576; |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index c3db6cd69b68..2b6cb5ca48ee 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -944,9 +944,17 @@ free_queue_irqs: | |||
944 | free_irq(adapter->msix_entries[vector].vector, | 944 | free_irq(adapter->msix_entries[vector].vector, |
945 | adapter->q_vector[vector]); | 945 | adapter->q_vector[vector]); |
946 | } | 946 | } |
947 | pci_disable_msix(adapter->pdev); | 947 | /* This failure is non-recoverable - it indicates the system is |
948 | kfree(adapter->msix_entries); | 948 | * out of MSIX vector resources and the VF driver cannot run |
949 | adapter->msix_entries = NULL; | 949 | * without them. Set the number of msix vectors to zero |
950 | * indicating that not enough can be allocated. The error | ||
951 | * will be returned to the user indicating device open failed. | ||
952 | * Any further attempts to force the driver to open will also | ||
953 | * fail. The only way to recover is to unload the driver and | ||
954 | * reload it again. If the system has recovered some MSIX | ||
955 | * vectors then it may succeed. | ||
956 | */ | ||
957 | adapter->num_msix_vectors = 0; | ||
950 | return err; | 958 | return err; |
951 | } | 959 | } |
952 | 960 | ||
@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2572 | struct ixgbe_hw *hw = &adapter->hw; | 2580 | struct ixgbe_hw *hw = &adapter->hw; |
2573 | int err; | 2581 | int err; |
2574 | 2582 | ||
2583 | /* A previous failure to open the device because of a lack of | ||
2584 | * available MSIX vector resources may have reset the number | ||
2585 | * of msix vectors variable to zero. The only way to recover | ||
2586 | * is to unload/reload the driver and hope that the system has | ||
2587 | * been able to recover some MSIX vector resources. | ||
2588 | */ | ||
2589 | if (!adapter->num_msix_vectors) | ||
2590 | return -ENOMEM; | ||
2591 | |||
2575 | /* disallow open during test */ | 2592 | /* disallow open during test */ |
2576 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) | 2593 | if (test_bit(__IXGBEVF_TESTING, &adapter->state)) |
2577 | return -EBUSY; | 2594 | return -EBUSY; |
@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2628 | 2645 | ||
2629 | err_req_irq: | 2646 | err_req_irq: |
2630 | ixgbevf_down(adapter); | 2647 | ixgbevf_down(adapter); |
2631 | ixgbevf_free_irq(adapter); | ||
2632 | err_setup_rx: | 2648 | err_setup_rx: |
2633 | ixgbevf_free_all_rx_resources(adapter); | 2649 | ixgbevf_free_all_rx_resources(adapter); |
2634 | err_setup_tx: | 2650 | err_setup_tx: |
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 6a2127489af7..bfdb06860397 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c | |||
@@ -769,7 +769,7 @@ ltq_etop_probe(struct platform_device *pdev) | |||
769 | return 0; | 769 | return 0; |
770 | 770 | ||
771 | err_free: | 771 | err_free: |
772 | kfree(dev); | 772 | free_netdev(dev); |
773 | err_out: | 773 | err_out: |
774 | return err; | 774 | return err; |
775 | } | 775 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 995d4b6d5c1e..f278b10ef714 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -1637,6 +1637,17 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1637 | /* Flush multicast filter */ | 1637 | /* Flush multicast filter */ |
1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); | 1638 | mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 1, MLX4_MCAST_CONFIG); |
1639 | 1639 | ||
1640 | /* Remove flow steering rules for the port*/ | ||
1641 | if (mdev->dev->caps.steering_mode == | ||
1642 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1643 | ASSERT_RTNL(); | ||
1644 | list_for_each_entry_safe(flow, tmp_flow, | ||
1645 | &priv->ethtool_list, list) { | ||
1646 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1647 | list_del(&flow->list); | ||
1648 | } | ||
1649 | } | ||
1650 | |||
1640 | mlx4_en_destroy_drop_qp(priv); | 1651 | mlx4_en_destroy_drop_qp(priv); |
1641 | 1652 | ||
1642 | /* Free TX Rings */ | 1653 | /* Free TX Rings */ |
@@ -1657,17 +1668,6 @@ void mlx4_en_stop_port(struct net_device *dev, int detach) | |||
1657 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) | 1668 | if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN)) |
1658 | mdev->mac_removed[priv->port] = 1; | 1669 | mdev->mac_removed[priv->port] = 1; |
1659 | 1670 | ||
1660 | /* Remove flow steering rules for the port*/ | ||
1661 | if (mdev->dev->caps.steering_mode == | ||
1662 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1663 | ASSERT_RTNL(); | ||
1664 | list_for_each_entry_safe(flow, tmp_flow, | ||
1665 | &priv->ethtool_list, list) { | ||
1666 | mlx4_flow_detach(mdev->dev, flow->id); | ||
1667 | list_del(&flow->list); | ||
1668 | } | ||
1669 | } | ||
1670 | |||
1671 | /* Free RX Rings */ | 1671 | /* Free RX Rings */ |
1672 | for (i = 0; i < priv->rx_ring_num; i++) { | 1672 | for (i = 0; i < priv->rx_ring_num; i++) { |
1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); | 1673 | mlx4_en_deactivate_rx_ring(priv, &priv->rx_ring[i]); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index 251ae2f93116..8e3123a1df88 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -771,7 +771,7 @@ int mlx4_MAP_EQ_wrapper(struct mlx4_dev *dev, int slave, | |||
771 | struct mlx4_slave_event_eq_info *event_eq = | 771 | struct mlx4_slave_event_eq_info *event_eq = |
772 | priv->mfunc.master.slave_state[slave].event_eq; | 772 | priv->mfunc.master.slave_state[slave].event_eq; |
773 | u32 in_modifier = vhcr->in_modifier; | 773 | u32 in_modifier = vhcr->in_modifier; |
774 | u32 eqn = in_modifier & 0x1FF; | 774 | u32 eqn = in_modifier & 0x3FF; |
775 | u64 in_param = vhcr->in_param; | 775 | u64 in_param = vhcr->in_param; |
776 | int err = 0; | 776 | int err = 0; |
777 | int i; | 777 | int i; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 2995687f1aee..1391b52f443a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -99,6 +99,7 @@ struct res_qp { | |||
99 | struct list_head mcg_list; | 99 | struct list_head mcg_list; |
100 | spinlock_t mcg_spl; | 100 | spinlock_t mcg_spl; |
101 | int local_qpn; | 101 | int local_qpn; |
102 | atomic_t ref_count; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | enum res_mtt_states { | 105 | enum res_mtt_states { |
@@ -197,6 +198,7 @@ enum res_fs_rule_states { | |||
197 | 198 | ||
198 | struct res_fs_rule { | 199 | struct res_fs_rule { |
199 | struct res_common com; | 200 | struct res_common com; |
201 | int qpn; | ||
200 | }; | 202 | }; |
201 | 203 | ||
202 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) | 204 | static void *res_tracker_lookup(struct rb_root *root, u64 res_id) |
@@ -355,7 +357,7 @@ static int mpt_mask(struct mlx4_dev *dev) | |||
355 | return dev->caps.num_mpts - 1; | 357 | return dev->caps.num_mpts - 1; |
356 | } | 358 | } |
357 | 359 | ||
358 | static void *find_res(struct mlx4_dev *dev, int res_id, | 360 | static void *find_res(struct mlx4_dev *dev, u64 res_id, |
359 | enum mlx4_resource type) | 361 | enum mlx4_resource type) |
360 | { | 362 | { |
361 | struct mlx4_priv *priv = mlx4_priv(dev); | 363 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -447,6 +449,7 @@ static struct res_common *alloc_qp_tr(int id) | |||
447 | ret->local_qpn = id; | 449 | ret->local_qpn = id; |
448 | INIT_LIST_HEAD(&ret->mcg_list); | 450 | INIT_LIST_HEAD(&ret->mcg_list); |
449 | spin_lock_init(&ret->mcg_spl); | 451 | spin_lock_init(&ret->mcg_spl); |
452 | atomic_set(&ret->ref_count, 0); | ||
450 | 453 | ||
451 | return &ret->com; | 454 | return &ret->com; |
452 | } | 455 | } |
@@ -554,7 +557,7 @@ static struct res_common *alloc_xrcdn_tr(int id) | |||
554 | return &ret->com; | 557 | return &ret->com; |
555 | } | 558 | } |
556 | 559 | ||
557 | static struct res_common *alloc_fs_rule_tr(u64 id) | 560 | static struct res_common *alloc_fs_rule_tr(u64 id, int qpn) |
558 | { | 561 | { |
559 | struct res_fs_rule *ret; | 562 | struct res_fs_rule *ret; |
560 | 563 | ||
@@ -564,7 +567,7 @@ static struct res_common *alloc_fs_rule_tr(u64 id) | |||
564 | 567 | ||
565 | ret->com.res_id = id; | 568 | ret->com.res_id = id; |
566 | ret->com.state = RES_FS_RULE_ALLOCATED; | 569 | ret->com.state = RES_FS_RULE_ALLOCATED; |
567 | 570 | ret->qpn = qpn; | |
568 | return &ret->com; | 571 | return &ret->com; |
569 | } | 572 | } |
570 | 573 | ||
@@ -602,7 +605,7 @@ static struct res_common *alloc_tr(u64 id, enum mlx4_resource type, int slave, | |||
602 | ret = alloc_xrcdn_tr(id); | 605 | ret = alloc_xrcdn_tr(id); |
603 | break; | 606 | break; |
604 | case RES_FS_RULE: | 607 | case RES_FS_RULE: |
605 | ret = alloc_fs_rule_tr(id); | 608 | ret = alloc_fs_rule_tr(id, extra); |
606 | break; | 609 | break; |
607 | default: | 610 | default: |
608 | return NULL; | 611 | return NULL; |
@@ -671,10 +674,14 @@ undo: | |||
671 | 674 | ||
672 | static int remove_qp_ok(struct res_qp *res) | 675 | static int remove_qp_ok(struct res_qp *res) |
673 | { | 676 | { |
674 | if (res->com.state == RES_QP_BUSY) | 677 | if (res->com.state == RES_QP_BUSY || atomic_read(&res->ref_count) || |
678 | !list_empty(&res->mcg_list)) { | ||
679 | pr_err("resource tracker: fail to remove qp, state %d, ref_count %d\n", | ||
680 | res->com.state, atomic_read(&res->ref_count)); | ||
675 | return -EBUSY; | 681 | return -EBUSY; |
676 | else if (res->com.state != RES_QP_RESERVED) | 682 | } else if (res->com.state != RES_QP_RESERVED) { |
677 | return -EPERM; | 683 | return -EPERM; |
684 | } | ||
678 | 685 | ||
679 | return 0; | 686 | return 0; |
680 | } | 687 | } |
@@ -3124,6 +3131,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3124 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; | 3131 | struct list_head *rlist = &tracker->slave_list[slave].res_list[RES_MAC]; |
3125 | int err; | 3132 | int err; |
3126 | int qpn; | 3133 | int qpn; |
3134 | struct res_qp *rqp; | ||
3127 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; | 3135 | struct mlx4_net_trans_rule_hw_ctrl *ctrl; |
3128 | struct _rule_hw *rule_header; | 3136 | struct _rule_hw *rule_header; |
3129 | int header_id; | 3137 | int header_id; |
@@ -3134,7 +3142,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3134 | 3142 | ||
3135 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; | 3143 | ctrl = (struct mlx4_net_trans_rule_hw_ctrl *)inbox->buf; |
3136 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; | 3144 | qpn = be32_to_cpu(ctrl->qpn) & 0xffffff; |
3137 | err = get_res(dev, slave, qpn, RES_QP, NULL); | 3145 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
3138 | if (err) { | 3146 | if (err) { |
3139 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); | 3147 | pr_err("Steering rule with qpn 0x%x rejected.\n", qpn); |
3140 | return err; | 3148 | return err; |
@@ -3175,14 +3183,16 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3175 | if (err) | 3183 | if (err) |
3176 | goto err_put; | 3184 | goto err_put; |
3177 | 3185 | ||
3178 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, 0); | 3186 | err = add_res_range(dev, slave, vhcr->out_param, 1, RES_FS_RULE, qpn); |
3179 | if (err) { | 3187 | if (err) { |
3180 | mlx4_err(dev, "Fail to add flow steering resources.\n "); | 3188 | mlx4_err(dev, "Fail to add flow steering resources.\n "); |
3181 | /* detach rule*/ | 3189 | /* detach rule*/ |
3182 | mlx4_cmd(dev, vhcr->out_param, 0, 0, | 3190 | mlx4_cmd(dev, vhcr->out_param, 0, 0, |
3183 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3191 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3184 | MLX4_CMD_NATIVE); | 3192 | MLX4_CMD_NATIVE); |
3193 | goto err_put; | ||
3185 | } | 3194 | } |
3195 | atomic_inc(&rqp->ref_count); | ||
3186 | err_put: | 3196 | err_put: |
3187 | put_res(dev, slave, qpn, RES_QP); | 3197 | put_res(dev, slave, qpn, RES_QP); |
3188 | return err; | 3198 | return err; |
@@ -3195,20 +3205,35 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave, | |||
3195 | struct mlx4_cmd_info *cmd) | 3205 | struct mlx4_cmd_info *cmd) |
3196 | { | 3206 | { |
3197 | int err; | 3207 | int err; |
3208 | struct res_qp *rqp; | ||
3209 | struct res_fs_rule *rrule; | ||
3198 | 3210 | ||
3199 | if (dev->caps.steering_mode != | 3211 | if (dev->caps.steering_mode != |
3200 | MLX4_STEERING_MODE_DEVICE_MANAGED) | 3212 | MLX4_STEERING_MODE_DEVICE_MANAGED) |
3201 | return -EOPNOTSUPP; | 3213 | return -EOPNOTSUPP; |
3202 | 3214 | ||
3215 | err = get_res(dev, slave, vhcr->in_param, RES_FS_RULE, &rrule); | ||
3216 | if (err) | ||
3217 | return err; | ||
3218 | /* Release the rule form busy state before removal */ | ||
3219 | put_res(dev, slave, vhcr->in_param, RES_FS_RULE); | ||
3220 | err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); | ||
3221 | if (err) | ||
3222 | return err; | ||
3223 | |||
3203 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); | 3224 | err = rem_res_range(dev, slave, vhcr->in_param, 1, RES_FS_RULE, 0); |
3204 | if (err) { | 3225 | if (err) { |
3205 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); | 3226 | mlx4_err(dev, "Fail to remove flow steering resources.\n "); |
3206 | return err; | 3227 | goto out; |
3207 | } | 3228 | } |
3208 | 3229 | ||
3209 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, | 3230 | err = mlx4_cmd(dev, vhcr->in_param, 0, 0, |
3210 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, | 3231 | MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, |
3211 | MLX4_CMD_NATIVE); | 3232 | MLX4_CMD_NATIVE); |
3233 | if (!err) | ||
3234 | atomic_dec(&rqp->ref_count); | ||
3235 | out: | ||
3236 | put_res(dev, slave, rrule->qpn, RES_QP); | ||
3212 | return err; | 3237 | return err; |
3213 | } | 3238 | } |
3214 | 3239 | ||
@@ -3806,6 +3831,7 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3806 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3831 | mutex_lock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3807 | /*VLAN*/ | 3832 | /*VLAN*/ |
3808 | rem_slave_macs(dev, slave); | 3833 | rem_slave_macs(dev, slave); |
3834 | rem_slave_fs_rule(dev, slave); | ||
3809 | rem_slave_qps(dev, slave); | 3835 | rem_slave_qps(dev, slave); |
3810 | rem_slave_srqs(dev, slave); | 3836 | rem_slave_srqs(dev, slave); |
3811 | rem_slave_cqs(dev, slave); | 3837 | rem_slave_cqs(dev, slave); |
@@ -3814,6 +3840,5 @@ void mlx4_delete_all_resources_for_slave(struct mlx4_dev *dev, int slave) | |||
3814 | rem_slave_mtts(dev, slave); | 3840 | rem_slave_mtts(dev, slave); |
3815 | rem_slave_counters(dev, slave); | 3841 | rem_slave_counters(dev, slave); |
3816 | rem_slave_xrcdns(dev, slave); | 3842 | rem_slave_xrcdns(dev, slave); |
3817 | rem_slave_fs_rule(dev, slave); | ||
3818 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); | 3843 | mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); |
3819 | } | 3844 | } |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index c4122c86f829..efa29b712d5f 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1472,7 +1472,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) | |||
1472 | } | 1472 | } |
1473 | platform_set_drvdata(pdev, ndev); | 1473 | platform_set_drvdata(pdev, ndev); |
1474 | 1474 | ||
1475 | if (lpc_mii_init(pldat) != 0) | 1475 | ret = lpc_mii_init(pldat); |
1476 | if (ret) | ||
1476 | goto err_out_unregister_netdev; | 1477 | goto err_out_unregister_netdev; |
1477 | 1478 | ||
1478 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", | 1479 | netdev_info(ndev, "LPC mac at 0x%08x irq %d\n", |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index 39ab4d09faaa..73ce7dd6b954 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -1726,9 +1726,9 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter, | |||
1726 | 1726 | ||
1727 | skb->protocol = eth_type_trans(skb, netdev); | 1727 | skb->protocol = eth_type_trans(skb, netdev); |
1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) | 1728 | if (tcp_ip_status & PCH_GBE_RXD_ACC_STAT_TCPIPOK) |
1729 | skb->ip_summed = CHECKSUM_NONE; | ||
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1729 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1730 | else | ||
1731 | skb->ip_summed = CHECKSUM_NONE; | ||
1732 | 1732 | ||
1733 | napi_gro_receive(&adapter->napi, skb); | 1733 | napi_gro_receive(&adapter->napi, skb); |
1734 | (*work_done)++; | 1734 | (*work_done)++; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 33e96176e4d8..bf5e3cf97c4d 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -2220,6 +2220,7 @@ static void sh_eth_tsu_init(struct sh_eth_private *mdp) | |||
2220 | /* MDIO bus release function */ | 2220 | /* MDIO bus release function */ |
2221 | static int sh_mdio_release(struct net_device *ndev) | 2221 | static int sh_mdio_release(struct net_device *ndev) |
2222 | { | 2222 | { |
2223 | struct sh_eth_private *mdp = netdev_priv(ndev); | ||
2223 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); | 2224 | struct mii_bus *bus = dev_get_drvdata(&ndev->dev); |
2224 | 2225 | ||
2225 | /* unregister mdio bus */ | 2226 | /* unregister mdio bus */ |
@@ -2234,6 +2235,9 @@ static int sh_mdio_release(struct net_device *ndev) | |||
2234 | /* free bitbang info */ | 2235 | /* free bitbang info */ |
2235 | free_mdio_bitbang(bus); | 2236 | free_mdio_bitbang(bus); |
2236 | 2237 | ||
2238 | /* free bitbang memory */ | ||
2239 | kfree(mdp->bitbang); | ||
2240 | |||
2237 | return 0; | 2241 | return 0; |
2238 | } | 2242 | } |
2239 | 2243 | ||
@@ -2262,6 +2266,7 @@ static int sh_mdio_init(struct net_device *ndev, int id, | |||
2262 | bitbang->ctrl.ops = &bb_ops; | 2266 | bitbang->ctrl.ops = &bb_ops; |
2263 | 2267 | ||
2264 | /* MII controller setting */ | 2268 | /* MII controller setting */ |
2269 | mdp->bitbang = bitbang; | ||
2265 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); | 2270 | mdp->mii_bus = alloc_mdio_bitbang(&bitbang->ctrl); |
2266 | if (!mdp->mii_bus) { | 2271 | if (!mdp->mii_bus) { |
2267 | ret = -ENOMEM; | 2272 | ret = -ENOMEM; |
@@ -2441,6 +2446,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
2441 | } | 2446 | } |
2442 | mdp->tsu_addr = ioremap(rtsu->start, | 2447 | mdp->tsu_addr = ioremap(rtsu->start, |
2443 | resource_size(rtsu)); | 2448 | resource_size(rtsu)); |
2449 | if (mdp->tsu_addr == NULL) { | ||
2450 | ret = -ENOMEM; | ||
2451 | dev_err(&pdev->dev, "TSU ioremap failed.\n"); | ||
2452 | goto out_release; | ||
2453 | } | ||
2444 | mdp->port = devno % 2; | 2454 | mdp->port = devno % 2; |
2445 | ndev->features = NETIF_F_HW_VLAN_FILTER; | 2455 | ndev->features = NETIF_F_HW_VLAN_FILTER; |
2446 | } | 2456 | } |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index bae84fd2e73a..e6655678458e 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -705,6 +705,7 @@ struct sh_eth_private { | |||
705 | const u16 *reg_offset; | 705 | const u16 *reg_offset; |
706 | void __iomem *addr; | 706 | void __iomem *addr; |
707 | void __iomem *tsu_addr; | 707 | void __iomem *tsu_addr; |
708 | struct bb_info *bitbang; | ||
708 | u32 num_rx_ring; | 709 | u32 num_rx_ring; |
709 | u32 num_tx_ring; | 710 | u32 num_tx_ring; |
710 | dma_addr_t rx_desc_dma; | 711 | dma_addr_t rx_desc_dma; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 75c48558e6fd..df32a090d08e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1364,7 +1364,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
1364 | struct platform_device *mdio; | 1364 | struct platform_device *mdio; |
1365 | 1365 | ||
1366 | parp = of_get_property(slave_node, "phy_id", &lenp); | 1366 | parp = of_get_property(slave_node, "phy_id", &lenp); |
1367 | if ((parp == NULL) && (lenp != (sizeof(void *) * 2))) { | 1367 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
1368 | pr_err("Missing slave[%d] phy_id property\n", i); | 1368 | pr_err("Missing slave[%d] phy_id property\n", i); |
1369 | ret = -EINVAL; | 1369 | ret = -EINVAL; |
1370 | goto error_ret; | 1370 | goto error_ret; |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 4cc13940c895..f76c3ca07a45 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c | |||
@@ -1023,6 +1023,7 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, | |||
1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | | 1023 | AR_PHY_AGC_CONTROL_FLTR_CAL | |
1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; | 1024 | AR_PHY_AGC_CONTROL_PKDET_CAL; |
1025 | 1025 | ||
1026 | /* Use chip chainmask only for calibration */ | ||
1026 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); | 1027 | ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); |
1027 | 1028 | ||
1028 | if (rtt) { | 1029 | if (rtt) { |
@@ -1150,6 +1151,9 @@ skip_tx_iqcal: | |||
1150 | ar9003_hw_rtt_disable(ah); | 1151 | ar9003_hw_rtt_disable(ah); |
1151 | } | 1152 | } |
1152 | 1153 | ||
1154 | /* Revert chainmask to runtime parameters */ | ||
1155 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | ||
1156 | |||
1153 | /* Initialize list pointers */ | 1157 | /* Initialize list pointers */ |
1154 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; | 1158 | ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL; |
1155 | 1159 | ||
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index ade3afb21f91..39c84ecf6a42 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -28,21 +28,21 @@ void ath_tx_complete_poll_work(struct work_struct *work) | |||
28 | int i; | 28 | int i; |
29 | bool needreset = false; | 29 | bool needreset = false; |
30 | 30 | ||
31 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) | 31 | for (i = 0; i < IEEE80211_NUM_ACS; i++) { |
32 | if (ATH_TXQ_SETUP(sc, i)) { | 32 | txq = sc->tx.txq_map[i]; |
33 | txq = &sc->tx.txq[i]; | 33 | |
34 | ath_txq_lock(sc, txq); | 34 | ath_txq_lock(sc, txq); |
35 | if (txq->axq_depth) { | 35 | if (txq->axq_depth) { |
36 | if (txq->axq_tx_inprogress) { | 36 | if (txq->axq_tx_inprogress) { |
37 | needreset = true; | 37 | needreset = true; |
38 | ath_txq_unlock(sc, txq); | 38 | ath_txq_unlock(sc, txq); |
39 | break; | 39 | break; |
40 | } else { | 40 | } else { |
41 | txq->axq_tx_inprogress = true; | 41 | txq->axq_tx_inprogress = true; |
42 | } | ||
43 | } | 42 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | 43 | } |
44 | ath_txq_unlock_complete(sc, txq); | ||
45 | } | ||
46 | 46 | ||
47 | if (needreset) { | 47 | if (needreset) { |
48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, | 48 | ath_dbg(ath9k_hw_common(sc->sc_ah), RESET, |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 3630a41df50d..c353b5f19c8c 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il, | |||
475 | dma_addr_t txcmd_phys; | 475 | dma_addr_t txcmd_phys; |
476 | int txq_id = skb_get_queue_mapping(skb); | 476 | int txq_id = skb_get_queue_mapping(skb); |
477 | u16 len, idx, hdr_len; | 477 | u16 len, idx, hdr_len; |
478 | u16 firstlen, secondlen; | ||
478 | u8 id; | 479 | u8 id; |
479 | u8 unicast; | 480 | u8 unicast; |
480 | u8 sta_id; | 481 | u8 sta_id; |
@@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il, | |||
589 | len = | 590 | len = |
590 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + | 591 | sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) + |
591 | hdr_len; | 592 | hdr_len; |
592 | len = (len + 3) & ~3; | 593 | firstlen = (len + 3) & ~3; |
593 | 594 | ||
594 | /* Physical address of this Tx command's header (not MAC header!), | 595 | /* Physical address of this Tx command's header (not MAC header!), |
595 | * within command buffer array. */ | 596 | * within command buffer array. */ |
596 | txcmd_phys = | 597 | txcmd_phys = |
597 | pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE); | 598 | pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen, |
599 | PCI_DMA_TODEVICE); | ||
598 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) | 600 | if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys))) |
599 | goto drop_unlock; | 601 | goto drop_unlock; |
600 | 602 | ||
601 | /* Set up TFD's 2nd entry to point directly to remainder of skb, | 603 | /* Set up TFD's 2nd entry to point directly to remainder of skb, |
602 | * if any (802.11 null frames have no payload). */ | 604 | * if any (802.11 null frames have no payload). */ |
603 | len = skb->len - hdr_len; | 605 | secondlen = skb->len - hdr_len; |
604 | if (len) { | 606 | if (secondlen > 0) { |
605 | phys_addr = | 607 | phys_addr = |
606 | pci_map_single(il->pci_dev, skb->data + hdr_len, len, | 608 | pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen, |
607 | PCI_DMA_TODEVICE); | 609 | PCI_DMA_TODEVICE); |
608 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) | 610 | if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr))) |
609 | goto drop_unlock; | 611 | goto drop_unlock; |
@@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il, | |||
611 | 613 | ||
612 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 614 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
613 | * first entry */ | 615 | * first entry */ |
614 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0); | 616 | il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0); |
615 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); | 617 | dma_unmap_addr_set(out_meta, mapping, txcmd_phys); |
616 | dma_unmap_len_set(out_meta, len, len); | 618 | dma_unmap_len_set(out_meta, len, firstlen); |
617 | if (len) | 619 | if (secondlen > 0) |
618 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0, | 620 | il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0, |
619 | U32_PAD(len)); | 621 | U32_PAD(secondlen)); |
620 | 622 | ||
621 | if (!ieee80211_has_morefrags(hdr->frame_control)) { | 623 | if (!ieee80211_has_morefrags(hdr->frame_control)) { |
622 | txq->need_update = 1; | 624 | txq->need_update = 1; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 20a6c5555873..b5c8b962ce12 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -157,6 +157,20 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
157 | return -1; | 157 | return -1; |
158 | } | 158 | } |
159 | 159 | ||
160 | cmd_code = le16_to_cpu(host_cmd->command); | ||
161 | cmd_size = le16_to_cpu(host_cmd->size); | ||
162 | |||
163 | if (adapter->hw_status == MWIFIEX_HW_STATUS_RESET && | ||
164 | cmd_code != HostCmd_CMD_FUNC_SHUTDOWN && | ||
165 | cmd_code != HostCmd_CMD_FUNC_INIT) { | ||
166 | dev_err(adapter->dev, | ||
167 | "DNLD_CMD: FW in reset state, ignore cmd %#x\n", | ||
168 | cmd_code); | ||
169 | mwifiex_complete_cmd(adapter, cmd_node); | ||
170 | mwifiex_insert_cmd_to_free_q(adapter, cmd_node); | ||
171 | return -1; | ||
172 | } | ||
173 | |||
160 | /* Set command sequence number */ | 174 | /* Set command sequence number */ |
161 | adapter->seq_num++; | 175 | adapter->seq_num++; |
162 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO | 176 | host_cmd->seq_num = cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO |
@@ -168,9 +182,6 @@ static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv, | |||
168 | adapter->curr_cmd = cmd_node; | 182 | adapter->curr_cmd = cmd_node; |
169 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); | 183 | spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags); |
170 | 184 | ||
171 | cmd_code = le16_to_cpu(host_cmd->command); | ||
172 | cmd_size = le16_to_cpu(host_cmd->size); | ||
173 | |||
174 | /* Adjust skb length */ | 185 | /* Adjust skb length */ |
175 | if (cmd_node->cmd_skb->len > cmd_size) | 186 | if (cmd_node->cmd_skb->len > cmd_size) |
176 | /* | 187 | /* |
@@ -484,8 +495,6 @@ int mwifiex_send_cmd_sync(struct mwifiex_private *priv, uint16_t cmd_no, | |||
484 | 495 | ||
485 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, | 496 | ret = mwifiex_send_cmd_async(priv, cmd_no, cmd_action, cmd_oid, |
486 | data_buf); | 497 | data_buf); |
487 | if (!ret) | ||
488 | ret = mwifiex_wait_queue_complete(adapter); | ||
489 | 498 | ||
490 | return ret; | 499 | return ret; |
491 | } | 500 | } |
@@ -588,9 +597,10 @@ int mwifiex_send_cmd_async(struct mwifiex_private *priv, uint16_t cmd_no, | |||
588 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { | 597 | if (cmd_no == HostCmd_CMD_802_11_SCAN) { |
589 | mwifiex_queue_scan_cmd(priv, cmd_node); | 598 | mwifiex_queue_scan_cmd(priv, cmd_node); |
590 | } else { | 599 | } else { |
591 | adapter->cmd_queued = cmd_node; | ||
592 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); | 600 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, true); |
593 | queue_work(adapter->workqueue, &adapter->main_work); | 601 | queue_work(adapter->workqueue, &adapter->main_work); |
602 | if (cmd_node->wait_q_enabled) | ||
603 | ret = mwifiex_wait_queue_complete(adapter, cmd_node); | ||
594 | } | 604 | } |
595 | 605 | ||
596 | return ret; | 606 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index e38aa9b3663d..0ff4c37ab42a 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -709,6 +709,14 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter) | |||
709 | return ret; | 709 | return ret; |
710 | } | 710 | } |
711 | 711 | ||
712 | /* cancel current command */ | ||
713 | if (adapter->curr_cmd) { | ||
714 | dev_warn(adapter->dev, "curr_cmd is still in processing\n"); | ||
715 | del_timer(&adapter->cmd_timer); | ||
716 | mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd); | ||
717 | adapter->curr_cmd = NULL; | ||
718 | } | ||
719 | |||
712 | /* shut down mwifiex */ | 720 | /* shut down mwifiex */ |
713 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); | 721 | dev_dbg(adapter->dev, "info: shutdown mwifiex...\n"); |
714 | 722 | ||
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 553adfb0aa81..7035ade9af74 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -723,7 +723,6 @@ struct mwifiex_adapter { | |||
723 | u16 cmd_wait_q_required; | 723 | u16 cmd_wait_q_required; |
724 | struct mwifiex_wait_queue cmd_wait_q; | 724 | struct mwifiex_wait_queue cmd_wait_q; |
725 | u8 scan_wait_q_woken; | 725 | u8 scan_wait_q_woken; |
726 | struct cmd_ctrl_node *cmd_queued; | ||
727 | spinlock_t queue_lock; /* lock for tx queues */ | 726 | spinlock_t queue_lock; /* lock for tx queues */ |
728 | struct completion fw_load; | 727 | struct completion fw_load; |
729 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; | 728 | u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; |
@@ -1018,7 +1017,8 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, | |||
1018 | struct mwifiex_multicast_list *mcast_list); | 1017 | struct mwifiex_multicast_list *mcast_list); |
1019 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | 1018 | int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, |
1020 | struct net_device *dev); | 1019 | struct net_device *dev); |
1021 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter); | 1020 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
1021 | struct cmd_ctrl_node *cmd_queued); | ||
1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | 1022 | int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
1023 | struct cfg80211_ssid *req_ssid); | 1023 | struct cfg80211_ssid *req_ssid); |
1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); | 1024 | int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type); |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index bb60c2754a97..d215b4d3c51b 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1388,10 +1388,13 @@ int mwifiex_scan_networks(struct mwifiex_private *priv, | |||
1388 | list_del(&cmd_node->list); | 1388 | list_del(&cmd_node->list); |
1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1389 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1390 | flags); | 1390 | flags); |
1391 | adapter->cmd_queued = cmd_node; | ||
1392 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, | 1391 | mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, |
1393 | true); | 1392 | true); |
1394 | queue_work(adapter->workqueue, &adapter->main_work); | 1393 | queue_work(adapter->workqueue, &adapter->main_work); |
1394 | |||
1395 | /* Perform internal scan synchronously */ | ||
1396 | if (!priv->scan_request) | ||
1397 | mwifiex_wait_queue_complete(adapter, cmd_node); | ||
1395 | } else { | 1398 | } else { |
1396 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, | 1399 | spin_unlock_irqrestore(&adapter->scan_pending_q_lock, |
1397 | flags); | 1400 | flags); |
@@ -1946,9 +1949,6 @@ int mwifiex_request_scan(struct mwifiex_private *priv, | |||
1946 | /* Normal scan */ | 1949 | /* Normal scan */ |
1947 | ret = mwifiex_scan_networks(priv, NULL); | 1950 | ret = mwifiex_scan_networks(priv, NULL); |
1948 | 1951 | ||
1949 | if (!ret) | ||
1950 | ret = mwifiex_wait_queue_complete(priv->adapter); | ||
1951 | |||
1952 | up(&priv->async_sem); | 1952 | up(&priv->async_sem); |
1953 | 1953 | ||
1954 | return ret; | 1954 | return ret; |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 9f33c92c90f5..13100f8de3db 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -54,16 +54,10 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | |||
54 | * This function waits on a cmd wait queue. It also cancels the pending | 54 | * This function waits on a cmd wait queue. It also cancels the pending |
55 | * request after waking up, in case of errors. | 55 | * request after waking up, in case of errors. |
56 | */ | 56 | */ |
57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | 57 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, |
58 | struct cmd_ctrl_node *cmd_queued) | ||
58 | { | 59 | { |
59 | int status; | 60 | int status; |
60 | struct cmd_ctrl_node *cmd_queued; | ||
61 | |||
62 | if (!adapter->cmd_queued) | ||
63 | return 0; | ||
64 | |||
65 | cmd_queued = adapter->cmd_queued; | ||
66 | adapter->cmd_queued = NULL; | ||
67 | 61 | ||
68 | dev_dbg(adapter->dev, "cmd pending\n"); | 62 | dev_dbg(adapter->dev, "cmd pending\n"); |
69 | atomic_inc(&adapter->cmd_pending); | 63 | atomic_inc(&adapter->cmd_pending); |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 156b52732f3d..5847d6d0881e 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -851,6 +851,7 @@ static void _rtl_usb_transmit(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
851 | if (unlikely(!_urb)) { | 851 | if (unlikely(!_urb)) { |
852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 852 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
853 | "Can't allocate urb. Drop skb!\n"); | 853 | "Can't allocate urb. Drop skb!\n"); |
854 | kfree_skb(skb); | ||
854 | return; | 855 | return; |
855 | } | 856 | } |
856 | _rtl_submit_tx_urb(hw, _urb); | 857 | _rtl_submit_tx_urb(hw, _urb); |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f0bd7f90a90d..e3c0ae9bb1fa 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -44,7 +44,7 @@ | |||
44 | /* Adding event notification support elements */ | 44 | /* Adding event notification support elements */ |
45 | #define THERMAL_GENL_FAMILY_NAME "thermal_event" | 45 | #define THERMAL_GENL_FAMILY_NAME "thermal_event" |
46 | #define THERMAL_GENL_VERSION 0x01 | 46 | #define THERMAL_GENL_VERSION 0x01 |
47 | #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_group" | 47 | #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp" |
48 | 48 | ||
49 | /* Default Thermal Governor */ | 49 | /* Default Thermal Governor */ |
50 | #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) | 50 | #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) |
diff --git a/include/linux/udp.h b/include/linux/udp.h index 9d81de123c90..42278bbf7a88 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -68,6 +68,7 @@ struct udp_sock { | |||
68 | * For encapsulation sockets. | 68 | * For encapsulation sockets. |
69 | */ | 69 | */ |
70 | int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); | 70 | int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); |
71 | void (*encap_destroy)(struct sock *sk); | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | static inline struct udp_sock *udp_sk(const struct sock *sk) | 74 | static inline struct udp_sock *udp_sk(const struct sock *sk) |
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h index 80461c1ae9ef..bb8271d487b7 100644 --- a/include/net/flow_keys.h +++ b/include/net/flow_keys.h | |||
@@ -9,6 +9,7 @@ struct flow_keys { | |||
9 | __be32 ports; | 9 | __be32 ports; |
10 | __be16 port16[2]; | 10 | __be16 port16[2]; |
11 | }; | 11 | }; |
12 | u16 thoff; | ||
12 | u8 ip_proto; | 13 | u8 ip_proto; |
13 | }; | 14 | }; |
14 | 15 | ||
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 68c69d54d392..fce8e6b66d55 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -976,6 +976,7 @@ struct netns_ipvs { | |||
976 | int sysctl_sync_retries; | 976 | int sysctl_sync_retries; |
977 | int sysctl_nat_icmp_send; | 977 | int sysctl_nat_icmp_send; |
978 | int sysctl_pmtu_disc; | 978 | int sysctl_pmtu_disc; |
979 | int sysctl_backup_only; | ||
979 | 980 | ||
980 | /* ip_vs_lblc */ | 981 | /* ip_vs_lblc */ |
981 | int sysctl_lblc_expiration; | 982 | int sysctl_lblc_expiration; |
@@ -1067,6 +1068,12 @@ static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs) | |||
1067 | return ipvs->sysctl_pmtu_disc; | 1068 | return ipvs->sysctl_pmtu_disc; |
1068 | } | 1069 | } |
1069 | 1070 | ||
1071 | static inline int sysctl_backup_only(struct netns_ipvs *ipvs) | ||
1072 | { | ||
1073 | return ipvs->sync_state & IP_VS_STATE_BACKUP && | ||
1074 | ipvs->sysctl_backup_only; | ||
1075 | } | ||
1076 | |||
1070 | #else | 1077 | #else |
1071 | 1078 | ||
1072 | static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) | 1079 | static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) |
@@ -1114,6 +1121,11 @@ static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs) | |||
1114 | return 1; | 1121 | return 1; |
1115 | } | 1122 | } |
1116 | 1123 | ||
1124 | static inline int sysctl_backup_only(struct netns_ipvs *ipvs) | ||
1125 | { | ||
1126 | return 0; | ||
1127 | } | ||
1128 | |||
1117 | #endif | 1129 | #endif |
1118 | 1130 | ||
1119 | /* | 1131 | /* |
diff --git a/include/net/ipip.h b/include/net/ipip.h index fd19625ff99d..982141c15200 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
@@ -77,15 +77,11 @@ static inline void tunnel_ip_select_ident(struct sk_buff *skb, | |||
77 | { | 77 | { |
78 | struct iphdr *iph = ip_hdr(skb); | 78 | struct iphdr *iph = ip_hdr(skb); |
79 | 79 | ||
80 | if (iph->frag_off & htons(IP_DF)) | 80 | /* Use inner packet iph-id if possible. */ |
81 | iph->id = 0; | 81 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) |
82 | else { | 82 | iph->id = old_iph->id; |
83 | /* Use inner packet iph-id if possible. */ | 83 | else |
84 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) | 84 | __ip_select_ident(iph, dst, |
85 | iph->id = old_iph->id; | 85 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
86 | else | ||
87 | __ip_select_ident(iph, dst, | ||
88 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | ||
89 | } | ||
90 | } | 86 | } |
91 | #endif | 87 | #endif |
diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h index 93f5fa94a431..afafd703ad92 100644 --- a/include/uapi/linux/packet_diag.h +++ b/include/uapi/linux/packet_diag.h | |||
@@ -33,9 +33,11 @@ enum { | |||
33 | PACKET_DIAG_TX_RING, | 33 | PACKET_DIAG_TX_RING, |
34 | PACKET_DIAG_FANOUT, | 34 | PACKET_DIAG_FANOUT, |
35 | 35 | ||
36 | PACKET_DIAG_MAX, | 36 | __PACKET_DIAG_MAX, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | #define PACKET_DIAG_MAX (__PACKET_DIAG_MAX - 1) | ||
40 | |||
39 | struct packet_diag_info { | 41 | struct packet_diag_info { |
40 | __u32 pdi_index; | 42 | __u32 pdi_index; |
41 | __u32 pdi_version; | 43 | __u32 pdi_version; |
diff --git a/include/uapi/linux/unix_diag.h b/include/uapi/linux/unix_diag.h index b8a24941db21..b9e2a6a7446f 100644 --- a/include/uapi/linux/unix_diag.h +++ b/include/uapi/linux/unix_diag.h | |||
@@ -39,9 +39,11 @@ enum { | |||
39 | UNIX_DIAG_MEMINFO, | 39 | UNIX_DIAG_MEMINFO, |
40 | UNIX_DIAG_SHUTDOWN, | 40 | UNIX_DIAG_SHUTDOWN, |
41 | 41 | ||
42 | UNIX_DIAG_MAX, | 42 | __UNIX_DIAG_MAX, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | #define UNIX_DIAG_MAX (__UNIX_DIAG_MAX - 1) | ||
46 | |||
45 | struct unix_diag_vfs { | 47 | struct unix_diag_vfs { |
46 | __u32 udiag_vfs_ino; | 48 | __u32 udiag_vfs_ino; |
47 | __u32 udiag_vfs_dev; | 49 | __u32 udiag_vfs_dev; |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index a18714469bf7..85addcd9372b 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -86,13 +86,6 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) | |||
86 | 86 | ||
87 | grp = &vlan_info->grp; | 87 | grp = &vlan_info->grp; |
88 | 88 | ||
89 | /* Take it out of our own structures, but be sure to interlock with | ||
90 | * HW accelerating devices or SW vlan input packet processing if | ||
91 | * VLAN is not 0 (leave it there for 802.1p). | ||
92 | */ | ||
93 | if (vlan_id) | ||
94 | vlan_vid_del(real_dev, vlan_id); | ||
95 | |||
96 | grp->nr_vlan_devs--; | 89 | grp->nr_vlan_devs--; |
97 | 90 | ||
98 | if (vlan->flags & VLAN_FLAG_MVRP) | 91 | if (vlan->flags & VLAN_FLAG_MVRP) |
@@ -114,6 +107,13 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head) | |||
114 | vlan_gvrp_uninit_applicant(real_dev); | 107 | vlan_gvrp_uninit_applicant(real_dev); |
115 | } | 108 | } |
116 | 109 | ||
110 | /* Take it out of our own structures, but be sure to interlock with | ||
111 | * HW accelerating devices or SW vlan input packet processing if | ||
112 | * VLAN is not 0 (leave it there for 802.1p). | ||
113 | */ | ||
114 | if (vlan_id) | ||
115 | vlan_vid_del(real_dev, vlan_id); | ||
116 | |||
117 | /* Get rid of the vlan's reference to real_dev */ | 117 | /* Get rid of the vlan's reference to real_dev */ |
118 | dev_put(real_dev); | 118 | dev_put(real_dev); |
119 | } | 119 | } |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 79d87d8d4f51..fad0302bdb32 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -359,6 +359,7 @@ static void __sco_sock_close(struct sock *sk) | |||
359 | sco_chan_del(sk, ECONNRESET); | 359 | sco_chan_del(sk, ECONNRESET); |
360 | break; | 360 | break; |
361 | 361 | ||
362 | case BT_CONNECT2: | ||
362 | case BT_CONNECT: | 363 | case BT_CONNECT: |
363 | case BT_DISCONN: | 364 | case BT_DISCONN: |
364 | sco_chan_del(sk, ECONNRESET); | 365 | sco_chan_del(sk, ECONNRESET); |
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index b0812c91c0f0..bab338e6270d 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c | |||
@@ -423,7 +423,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source, | |||
423 | return 0; | 423 | return 0; |
424 | br_warn(br, "adding interface %s with same address " | 424 | br_warn(br, "adding interface %s with same address " |
425 | "as a received packet\n", | 425 | "as a received packet\n", |
426 | source->dev->name); | 426 | source ? source->dev->name : br->dev->name); |
427 | fdb_delete(br, fdb); | 427 | fdb_delete(br, fdb); |
428 | } | 428 | } |
429 | 429 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index d540ced1f6c6..b13e5c766c11 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1545,7 +1545,6 @@ void net_enable_timestamp(void) | |||
1545 | return; | 1545 | return; |
1546 | } | 1546 | } |
1547 | #endif | 1547 | #endif |
1548 | WARN_ON(in_interrupt()); | ||
1549 | static_key_slow_inc(&netstamp_needed); | 1548 | static_key_slow_inc(&netstamp_needed); |
1550 | } | 1549 | } |
1551 | EXPORT_SYMBOL(net_enable_timestamp); | 1550 | EXPORT_SYMBOL(net_enable_timestamp); |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 9d4c7201400d..e187bf06d673 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -140,6 +140,8 @@ ipv6: | |||
140 | flow->ports = *ports; | 140 | flow->ports = *ports; |
141 | } | 141 | } |
142 | 142 | ||
143 | flow->thoff = (u16) nhoff; | ||
144 | |||
143 | return true; | 145 | return true; |
144 | } | 146 | } |
145 | EXPORT_SYMBOL(skb_flow_dissect); | 147 | EXPORT_SYMBOL(skb_flow_dissect); |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 68f6a94f7661..c929d9c1c4b6 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1333,8 +1333,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1333 | iph->frag_off |= htons(IP_MF); | 1333 | iph->frag_off |= htons(IP_MF); |
1334 | offset += (skb->len - skb->mac_len - iph->ihl * 4); | 1334 | offset += (skb->len - skb->mac_len - iph->ihl * 4); |
1335 | } else { | 1335 | } else { |
1336 | if (!(iph->frag_off & htons(IP_DF))) | 1336 | iph->id = htons(id++); |
1337 | iph->id = htons(id++); | ||
1338 | } | 1337 | } |
1339 | iph->tot_len = htons(skb->len - skb->mac_len); | 1338 | iph->tot_len = htons(skb->len - skb->mac_len); |
1340 | iph->check = 0; | 1339 | iph->check = 0; |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 98cbc6877019..bf6c5cf31aed 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1522,7 +1522,8 @@ static int __init ip_auto_config(void) | |||
1522 | } | 1522 | } |
1523 | for (i++; i < CONF_NAMESERVERS_MAX; i++) | 1523 | for (i++; i < CONF_NAMESERVERS_MAX; i++) |
1524 | if (ic_nameservers[i] != NONE) | 1524 | if (ic_nameservers[i] != NONE) |
1525 | pr_cont(", nameserver%u=%pI4\n", i, &ic_nameservers[i]); | 1525 | pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]); |
1526 | pr_cont("\n"); | ||
1526 | #endif /* !SILENT */ | 1527 | #endif /* !SILENT */ |
1527 | 1528 | ||
1528 | return 0; | 1529 | return 0; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index ce2d43e1f09f..0d755c50994b 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -36,19 +36,6 @@ config NF_CONNTRACK_PROC_COMPAT | |||
36 | 36 | ||
37 | If unsure, say Y. | 37 | If unsure, say Y. |
38 | 38 | ||
39 | config IP_NF_QUEUE | ||
40 | tristate "IP Userspace queueing via NETLINK (OBSOLETE)" | ||
41 | depends on NETFILTER_ADVANCED | ||
42 | help | ||
43 | Netfilter has the ability to queue packets to user space: the | ||
44 | netlink device can be used to access them using this driver. | ||
45 | |||
46 | This option enables the old IPv4-only "ip_queue" implementation | ||
47 | which has been obsoleted by the new "nfnetlink_queue" code (see | ||
48 | CONFIG_NETFILTER_NETLINK_QUEUE). | ||
49 | |||
50 | To compile it as a module, choose M here. If unsure, say N. | ||
51 | |||
52 | config IP_NF_IPTABLES | 39 | config IP_NF_IPTABLES |
53 | tristate "IP tables support (required for filtering/masq/NAT)" | 40 | tristate "IP tables support (required for filtering/masq/NAT)" |
54 | default m if NETFILTER_ADVANCED=n | 41 | default m if NETFILTER_ADVANCED=n |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0d9bdacce99f..3bd55bad230a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2059,11 +2059,8 @@ void tcp_enter_loss(struct sock *sk, int how) | |||
2059 | if (tcp_is_reno(tp)) | 2059 | if (tcp_is_reno(tp)) |
2060 | tcp_reset_reno_sack(tp); | 2060 | tcp_reset_reno_sack(tp); |
2061 | 2061 | ||
2062 | if (!how) { | 2062 | tp->undo_marker = tp->snd_una; |
2063 | /* Push undo marker, if it was plain RTO and nothing | 2063 | if (how) { |
2064 | * was retransmitted. */ | ||
2065 | tp->undo_marker = tp->snd_una; | ||
2066 | } else { | ||
2067 | tp->sacked_out = 0; | 2064 | tp->sacked_out = 0; |
2068 | tp->fackets_out = 0; | 2065 | tp->fackets_out = 0; |
2069 | } | 2066 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 817fbb396bc8..5d0b4387cba6 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1809,8 +1809,11 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) | |||
1809 | goto send_now; | 1809 | goto send_now; |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | /* Ok, it looks like it is advisable to defer. */ | 1812 | /* Ok, it looks like it is advisable to defer. |
1813 | tp->tso_deferred = 1 | (jiffies << 1); | 1813 | * Do not rearm the timer if already set to not break TCP ACK clocking. |
1814 | */ | ||
1815 | if (!tp->tso_deferred) | ||
1816 | tp->tso_deferred = 1 | (jiffies << 1); | ||
1814 | 1817 | ||
1815 | return true; | 1818 | return true; |
1816 | 1819 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 265c42cf963c..0a073a263720 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1762,9 +1762,16 @@ int udp_rcv(struct sk_buff *skb) | |||
1762 | 1762 | ||
1763 | void udp_destroy_sock(struct sock *sk) | 1763 | void udp_destroy_sock(struct sock *sk) |
1764 | { | 1764 | { |
1765 | struct udp_sock *up = udp_sk(sk); | ||
1765 | bool slow = lock_sock_fast(sk); | 1766 | bool slow = lock_sock_fast(sk); |
1766 | udp_flush_pending_frames(sk); | 1767 | udp_flush_pending_frames(sk); |
1767 | unlock_sock_fast(sk, slow); | 1768 | unlock_sock_fast(sk, slow); |
1769 | if (static_key_false(&udp_encap_needed) && up->encap_type) { | ||
1770 | void (*encap_destroy)(struct sock *sk); | ||
1771 | encap_destroy = ACCESS_ONCE(up->encap_destroy); | ||
1772 | if (encap_destroy) | ||
1773 | encap_destroy(sk); | ||
1774 | } | ||
1768 | } | 1775 | } |
1769 | 1776 | ||
1770 | /* | 1777 | /* |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f2c7e615f902..26512250e095 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4784,26 +4784,20 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev) | |||
4784 | 4784 | ||
4785 | static int __net_init addrconf_init_net(struct net *net) | 4785 | static int __net_init addrconf_init_net(struct net *net) |
4786 | { | 4786 | { |
4787 | int err; | 4787 | int err = -ENOMEM; |
4788 | struct ipv6_devconf *all, *dflt; | 4788 | struct ipv6_devconf *all, *dflt; |
4789 | 4789 | ||
4790 | err = -ENOMEM; | 4790 | all = kmemdup(&ipv6_devconf, sizeof(ipv6_devconf), GFP_KERNEL); |
4791 | all = &ipv6_devconf; | 4791 | if (all == NULL) |
4792 | dflt = &ipv6_devconf_dflt; | 4792 | goto err_alloc_all; |
4793 | 4793 | ||
4794 | if (!net_eq(net, &init_net)) { | 4794 | dflt = kmemdup(&ipv6_devconf_dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL); |
4795 | all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL); | 4795 | if (dflt == NULL) |
4796 | if (all == NULL) | 4796 | goto err_alloc_dflt; |
4797 | goto err_alloc_all; | ||
4798 | 4797 | ||
4799 | dflt = kmemdup(dflt, sizeof(ipv6_devconf_dflt), GFP_KERNEL); | 4798 | /* these will be inherited by all namespaces */ |
4800 | if (dflt == NULL) | 4799 | dflt->autoconf = ipv6_defaults.autoconf; |
4801 | goto err_alloc_dflt; | 4800 | dflt->disable_ipv6 = ipv6_defaults.disable_ipv6; |
4802 | } else { | ||
4803 | /* these will be inherited by all namespaces */ | ||
4804 | dflt->autoconf = ipv6_defaults.autoconf; | ||
4805 | dflt->disable_ipv6 = ipv6_defaults.disable_ipv6; | ||
4806 | } | ||
4807 | 4801 | ||
4808 | net->ipv6.devconf_all = all; | 4802 | net->ipv6.devconf_all = all; |
4809 | net->ipv6.devconf_dflt = dflt; | 4803 | net->ipv6.devconf_dflt = dflt; |
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index 83acc1405a18..33608c610276 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c | |||
@@ -114,6 +114,7 @@ ip6t_dnpt_tg(struct sk_buff *skb, const struct xt_action_param *par) | |||
114 | static struct xt_target ip6t_npt_target_reg[] __read_mostly = { | 114 | static struct xt_target ip6t_npt_target_reg[] __read_mostly = { |
115 | { | 115 | { |
116 | .name = "SNPT", | 116 | .name = "SNPT", |
117 | .table = "mangle", | ||
117 | .target = ip6t_snpt_tg, | 118 | .target = ip6t_snpt_tg, |
118 | .targetsize = sizeof(struct ip6t_npt_tginfo), | 119 | .targetsize = sizeof(struct ip6t_npt_tginfo), |
119 | .checkentry = ip6t_npt_checkentry, | 120 | .checkentry = ip6t_npt_checkentry, |
@@ -124,6 +125,7 @@ static struct xt_target ip6t_npt_target_reg[] __read_mostly = { | |||
124 | }, | 125 | }, |
125 | { | 126 | { |
126 | .name = "DNPT", | 127 | .name = "DNPT", |
128 | .table = "mangle", | ||
127 | .target = ip6t_dnpt_tg, | 129 | .target = ip6t_dnpt_tg, |
128 | .targetsize = sizeof(struct ip6t_npt_tginfo), | 130 | .targetsize = sizeof(struct ip6t_npt_tginfo), |
129 | .checkentry = ip6t_npt_checkentry, | 131 | .checkentry = ip6t_npt_checkentry, |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 599e1ba6d1ce..d8e5e852fc7a 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -1285,10 +1285,18 @@ do_confirm: | |||
1285 | 1285 | ||
1286 | void udpv6_destroy_sock(struct sock *sk) | 1286 | void udpv6_destroy_sock(struct sock *sk) |
1287 | { | 1287 | { |
1288 | struct udp_sock *up = udp_sk(sk); | ||
1288 | lock_sock(sk); | 1289 | lock_sock(sk); |
1289 | udp_v6_flush_pending_frames(sk); | 1290 | udp_v6_flush_pending_frames(sk); |
1290 | release_sock(sk); | 1291 | release_sock(sk); |
1291 | 1292 | ||
1293 | if (static_key_false(&udpv6_encap_needed) && up->encap_type) { | ||
1294 | void (*encap_destroy)(struct sock *sk); | ||
1295 | encap_destroy = ACCESS_ONCE(up->encap_destroy); | ||
1296 | if (encap_destroy) | ||
1297 | encap_destroy(sk); | ||
1298 | } | ||
1299 | |||
1292 | inet6_destroy_sock(sk); | 1300 | inet6_destroy_sock(sk); |
1293 | } | 1301 | } |
1294 | 1302 | ||
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index d07e3a626446..d28e7f014cc6 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -2583,8 +2583,10 @@ bed: | |||
2583 | NULL, NULL, NULL); | 2583 | NULL, NULL, NULL); |
2584 | 2584 | ||
2585 | /* Check if the we got some results */ | 2585 | /* Check if the we got some results */ |
2586 | if (!self->cachedaddr) | 2586 | if (!self->cachedaddr) { |
2587 | return -EAGAIN; /* Didn't find any devices */ | 2587 | err = -EAGAIN; /* Didn't find any devices */ |
2588 | goto out; | ||
2589 | } | ||
2588 | daddr = self->cachedaddr; | 2590 | daddr = self->cachedaddr; |
2589 | /* Cleanup */ | 2591 | /* Cleanup */ |
2590 | self->cachedaddr = 0; | 2592 | self->cachedaddr = 0; |
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index d36875f3427e..8aecf5df6656 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -114,7 +114,6 @@ struct l2tp_net { | |||
114 | 114 | ||
115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); | 115 | static void l2tp_session_set_header_len(struct l2tp_session *session, int version); |
116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); | 116 | static void l2tp_tunnel_free(struct l2tp_tunnel *tunnel); |
117 | static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); | ||
118 | 117 | ||
119 | static inline struct l2tp_net *l2tp_pernet(struct net *net) | 118 | static inline struct l2tp_net *l2tp_pernet(struct net *net) |
120 | { | 119 | { |
@@ -192,6 +191,7 @@ struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel) | |||
192 | } else { | 191 | } else { |
193 | /* Socket is owned by kernelspace */ | 192 | /* Socket is owned by kernelspace */ |
194 | sk = tunnel->sock; | 193 | sk = tunnel->sock; |
194 | sock_hold(sk); | ||
195 | } | 195 | } |
196 | 196 | ||
197 | out: | 197 | out: |
@@ -210,6 +210,7 @@ void l2tp_tunnel_sock_put(struct sock *sk) | |||
210 | } | 210 | } |
211 | sock_put(sk); | 211 | sock_put(sk); |
212 | } | 212 | } |
213 | sock_put(sk); | ||
213 | } | 214 | } |
214 | EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put); | 215 | EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put); |
215 | 216 | ||
@@ -373,10 +374,8 @@ static void l2tp_recv_queue_skb(struct l2tp_session *session, struct sk_buff *sk | |||
373 | struct sk_buff *skbp; | 374 | struct sk_buff *skbp; |
374 | struct sk_buff *tmp; | 375 | struct sk_buff *tmp; |
375 | u32 ns = L2TP_SKB_CB(skb)->ns; | 376 | u32 ns = L2TP_SKB_CB(skb)->ns; |
376 | struct l2tp_stats *sstats; | ||
377 | 377 | ||
378 | spin_lock_bh(&session->reorder_q.lock); | 378 | spin_lock_bh(&session->reorder_q.lock); |
379 | sstats = &session->stats; | ||
380 | skb_queue_walk_safe(&session->reorder_q, skbp, tmp) { | 379 | skb_queue_walk_safe(&session->reorder_q, skbp, tmp) { |
381 | if (L2TP_SKB_CB(skbp)->ns > ns) { | 380 | if (L2TP_SKB_CB(skbp)->ns > ns) { |
382 | __skb_queue_before(&session->reorder_q, skbp, skb); | 381 | __skb_queue_before(&session->reorder_q, skbp, skb); |
@@ -384,9 +383,7 @@ static void l2tp_recv_queue_skb(struct l2tp_session *session, struct sk_buff *sk | |||
384 | "%s: pkt %hu, inserted before %hu, reorder_q len=%d\n", | 383 | "%s: pkt %hu, inserted before %hu, reorder_q len=%d\n", |
385 | session->name, ns, L2TP_SKB_CB(skbp)->ns, | 384 | session->name, ns, L2TP_SKB_CB(skbp)->ns, |
386 | skb_queue_len(&session->reorder_q)); | 385 | skb_queue_len(&session->reorder_q)); |
387 | u64_stats_update_begin(&sstats->syncp); | 386 | atomic_long_inc(&session->stats.rx_oos_packets); |
388 | sstats->rx_oos_packets++; | ||
389 | u64_stats_update_end(&sstats->syncp); | ||
390 | goto out; | 387 | goto out; |
391 | } | 388 | } |
392 | } | 389 | } |
@@ -403,23 +400,16 @@ static void l2tp_recv_dequeue_skb(struct l2tp_session *session, struct sk_buff * | |||
403 | { | 400 | { |
404 | struct l2tp_tunnel *tunnel = session->tunnel; | 401 | struct l2tp_tunnel *tunnel = session->tunnel; |
405 | int length = L2TP_SKB_CB(skb)->length; | 402 | int length = L2TP_SKB_CB(skb)->length; |
406 | struct l2tp_stats *tstats, *sstats; | ||
407 | 403 | ||
408 | /* We're about to requeue the skb, so return resources | 404 | /* We're about to requeue the skb, so return resources |
409 | * to its current owner (a socket receive buffer). | 405 | * to its current owner (a socket receive buffer). |
410 | */ | 406 | */ |
411 | skb_orphan(skb); | 407 | skb_orphan(skb); |
412 | 408 | ||
413 | tstats = &tunnel->stats; | 409 | atomic_long_inc(&tunnel->stats.rx_packets); |
414 | u64_stats_update_begin(&tstats->syncp); | 410 | atomic_long_add(length, &tunnel->stats.rx_bytes); |
415 | sstats = &session->stats; | 411 | atomic_long_inc(&session->stats.rx_packets); |
416 | u64_stats_update_begin(&sstats->syncp); | 412 | atomic_long_add(length, &session->stats.rx_bytes); |
417 | tstats->rx_packets++; | ||
418 | tstats->rx_bytes += length; | ||
419 | sstats->rx_packets++; | ||
420 | sstats->rx_bytes += length; | ||
421 | u64_stats_update_end(&tstats->syncp); | ||
422 | u64_stats_update_end(&sstats->syncp); | ||
423 | 413 | ||
424 | if (L2TP_SKB_CB(skb)->has_seq) { | 414 | if (L2TP_SKB_CB(skb)->has_seq) { |
425 | /* Bump our Nr */ | 415 | /* Bump our Nr */ |
@@ -450,7 +440,6 @@ static void l2tp_recv_dequeue(struct l2tp_session *session) | |||
450 | { | 440 | { |
451 | struct sk_buff *skb; | 441 | struct sk_buff *skb; |
452 | struct sk_buff *tmp; | 442 | struct sk_buff *tmp; |
453 | struct l2tp_stats *sstats; | ||
454 | 443 | ||
455 | /* If the pkt at the head of the queue has the nr that we | 444 | /* If the pkt at the head of the queue has the nr that we |
456 | * expect to send up next, dequeue it and any other | 445 | * expect to send up next, dequeue it and any other |
@@ -458,13 +447,10 @@ static void l2tp_recv_dequeue(struct l2tp_session *session) | |||
458 | */ | 447 | */ |
459 | start: | 448 | start: |
460 | spin_lock_bh(&session->reorder_q.lock); | 449 | spin_lock_bh(&session->reorder_q.lock); |
461 | sstats = &session->stats; | ||
462 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { | 450 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { |
463 | if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) { | 451 | if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) { |
464 | u64_stats_update_begin(&sstats->syncp); | 452 | atomic_long_inc(&session->stats.rx_seq_discards); |
465 | sstats->rx_seq_discards++; | 453 | atomic_long_inc(&session->stats.rx_errors); |
466 | sstats->rx_errors++; | ||
467 | u64_stats_update_end(&sstats->syncp); | ||
468 | l2tp_dbg(session, L2TP_MSG_SEQ, | 454 | l2tp_dbg(session, L2TP_MSG_SEQ, |
469 | "%s: oos pkt %u len %d discarded (too old), waiting for %u, reorder_q_len=%d\n", | 455 | "%s: oos pkt %u len %d discarded (too old), waiting for %u, reorder_q_len=%d\n", |
470 | session->name, L2TP_SKB_CB(skb)->ns, | 456 | session->name, L2TP_SKB_CB(skb)->ns, |
@@ -623,7 +609,6 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
623 | struct l2tp_tunnel *tunnel = session->tunnel; | 609 | struct l2tp_tunnel *tunnel = session->tunnel; |
624 | int offset; | 610 | int offset; |
625 | u32 ns, nr; | 611 | u32 ns, nr; |
626 | struct l2tp_stats *sstats = &session->stats; | ||
627 | 612 | ||
628 | /* The ref count is increased since we now hold a pointer to | 613 | /* The ref count is increased since we now hold a pointer to |
629 | * the session. Take care to decrement the refcnt when exiting | 614 | * the session. Take care to decrement the refcnt when exiting |
@@ -640,9 +625,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
640 | "%s: cookie mismatch (%u/%u). Discarding.\n", | 625 | "%s: cookie mismatch (%u/%u). Discarding.\n", |
641 | tunnel->name, tunnel->tunnel_id, | 626 | tunnel->name, tunnel->tunnel_id, |
642 | session->session_id); | 627 | session->session_id); |
643 | u64_stats_update_begin(&sstats->syncp); | 628 | atomic_long_inc(&session->stats.rx_cookie_discards); |
644 | sstats->rx_cookie_discards++; | ||
645 | u64_stats_update_end(&sstats->syncp); | ||
646 | goto discard; | 629 | goto discard; |
647 | } | 630 | } |
648 | ptr += session->peer_cookie_len; | 631 | ptr += session->peer_cookie_len; |
@@ -711,9 +694,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
711 | l2tp_warn(session, L2TP_MSG_SEQ, | 694 | l2tp_warn(session, L2TP_MSG_SEQ, |
712 | "%s: recv data has no seq numbers when required. Discarding.\n", | 695 | "%s: recv data has no seq numbers when required. Discarding.\n", |
713 | session->name); | 696 | session->name); |
714 | u64_stats_update_begin(&sstats->syncp); | 697 | atomic_long_inc(&session->stats.rx_seq_discards); |
715 | sstats->rx_seq_discards++; | ||
716 | u64_stats_update_end(&sstats->syncp); | ||
717 | goto discard; | 698 | goto discard; |
718 | } | 699 | } |
719 | 700 | ||
@@ -732,9 +713,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
732 | l2tp_warn(session, L2TP_MSG_SEQ, | 713 | l2tp_warn(session, L2TP_MSG_SEQ, |
733 | "%s: recv data has no seq numbers when required. Discarding.\n", | 714 | "%s: recv data has no seq numbers when required. Discarding.\n", |
734 | session->name); | 715 | session->name); |
735 | u64_stats_update_begin(&sstats->syncp); | 716 | atomic_long_inc(&session->stats.rx_seq_discards); |
736 | sstats->rx_seq_discards++; | ||
737 | u64_stats_update_end(&sstats->syncp); | ||
738 | goto discard; | 717 | goto discard; |
739 | } | 718 | } |
740 | } | 719 | } |
@@ -788,9 +767,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
788 | * packets | 767 | * packets |
789 | */ | 768 | */ |
790 | if (L2TP_SKB_CB(skb)->ns != session->nr) { | 769 | if (L2TP_SKB_CB(skb)->ns != session->nr) { |
791 | u64_stats_update_begin(&sstats->syncp); | 770 | atomic_long_inc(&session->stats.rx_seq_discards); |
792 | sstats->rx_seq_discards++; | ||
793 | u64_stats_update_end(&sstats->syncp); | ||
794 | l2tp_dbg(session, L2TP_MSG_SEQ, | 771 | l2tp_dbg(session, L2TP_MSG_SEQ, |
795 | "%s: oos pkt %u len %d discarded, waiting for %u, reorder_q_len=%d\n", | 772 | "%s: oos pkt %u len %d discarded, waiting for %u, reorder_q_len=%d\n", |
796 | session->name, L2TP_SKB_CB(skb)->ns, | 773 | session->name, L2TP_SKB_CB(skb)->ns, |
@@ -816,9 +793,7 @@ void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, | |||
816 | return; | 793 | return; |
817 | 794 | ||
818 | discard: | 795 | discard: |
819 | u64_stats_update_begin(&sstats->syncp); | 796 | atomic_long_inc(&session->stats.rx_errors); |
820 | sstats->rx_errors++; | ||
821 | u64_stats_update_end(&sstats->syncp); | ||
822 | kfree_skb(skb); | 797 | kfree_skb(skb); |
823 | 798 | ||
824 | if (session->deref) | 799 | if (session->deref) |
@@ -828,6 +803,23 @@ discard: | |||
828 | } | 803 | } |
829 | EXPORT_SYMBOL(l2tp_recv_common); | 804 | EXPORT_SYMBOL(l2tp_recv_common); |
830 | 805 | ||
806 | /* Drop skbs from the session's reorder_q | ||
807 | */ | ||
808 | int l2tp_session_queue_purge(struct l2tp_session *session) | ||
809 | { | ||
810 | struct sk_buff *skb = NULL; | ||
811 | BUG_ON(!session); | ||
812 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); | ||
813 | while ((skb = skb_dequeue(&session->reorder_q))) { | ||
814 | atomic_long_inc(&session->stats.rx_errors); | ||
815 | kfree_skb(skb); | ||
816 | if (session->deref) | ||
817 | (*session->deref)(session); | ||
818 | } | ||
819 | return 0; | ||
820 | } | ||
821 | EXPORT_SYMBOL_GPL(l2tp_session_queue_purge); | ||
822 | |||
831 | /* Internal UDP receive frame. Do the real work of receiving an L2TP data frame | 823 | /* Internal UDP receive frame. Do the real work of receiving an L2TP data frame |
832 | * here. The skb is not on a list when we get here. | 824 | * here. The skb is not on a list when we get here. |
833 | * Returns 0 if the packet was a data packet and was successfully passed on. | 825 | * Returns 0 if the packet was a data packet and was successfully passed on. |
@@ -843,7 +835,6 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
843 | u32 tunnel_id, session_id; | 835 | u32 tunnel_id, session_id; |
844 | u16 version; | 836 | u16 version; |
845 | int length; | 837 | int length; |
846 | struct l2tp_stats *tstats; | ||
847 | 838 | ||
848 | if (tunnel->sock && l2tp_verify_udp_checksum(tunnel->sock, skb)) | 839 | if (tunnel->sock && l2tp_verify_udp_checksum(tunnel->sock, skb)) |
849 | goto discard_bad_csum; | 840 | goto discard_bad_csum; |
@@ -932,10 +923,7 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, | |||
932 | discard_bad_csum: | 923 | discard_bad_csum: |
933 | LIMIT_NETDEBUG("%s: UDP: bad checksum\n", tunnel->name); | 924 | LIMIT_NETDEBUG("%s: UDP: bad checksum\n", tunnel->name); |
934 | UDP_INC_STATS_USER(tunnel->l2tp_net, UDP_MIB_INERRORS, 0); | 925 | UDP_INC_STATS_USER(tunnel->l2tp_net, UDP_MIB_INERRORS, 0); |
935 | tstats = &tunnel->stats; | 926 | atomic_long_inc(&tunnel->stats.rx_errors); |
936 | u64_stats_update_begin(&tstats->syncp); | ||
937 | tstats->rx_errors++; | ||
938 | u64_stats_update_end(&tstats->syncp); | ||
939 | kfree_skb(skb); | 927 | kfree_skb(skb); |
940 | 928 | ||
941 | return 0; | 929 | return 0; |
@@ -1062,7 +1050,6 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, | |||
1062 | struct l2tp_tunnel *tunnel = session->tunnel; | 1050 | struct l2tp_tunnel *tunnel = session->tunnel; |
1063 | unsigned int len = skb->len; | 1051 | unsigned int len = skb->len; |
1064 | int error; | 1052 | int error; |
1065 | struct l2tp_stats *tstats, *sstats; | ||
1066 | 1053 | ||
1067 | /* Debug */ | 1054 | /* Debug */ |
1068 | if (session->send_seq) | 1055 | if (session->send_seq) |
@@ -1091,21 +1078,15 @@ static int l2tp_xmit_core(struct l2tp_session *session, struct sk_buff *skb, | |||
1091 | error = ip_queue_xmit(skb, fl); | 1078 | error = ip_queue_xmit(skb, fl); |
1092 | 1079 | ||
1093 | /* Update stats */ | 1080 | /* Update stats */ |
1094 | tstats = &tunnel->stats; | ||
1095 | u64_stats_update_begin(&tstats->syncp); | ||
1096 | sstats = &session->stats; | ||
1097 | u64_stats_update_begin(&sstats->syncp); | ||
1098 | if (error >= 0) { | 1081 | if (error >= 0) { |
1099 | tstats->tx_packets++; | 1082 | atomic_long_inc(&tunnel->stats.tx_packets); |
1100 | tstats->tx_bytes += len; | 1083 | atomic_long_add(len, &tunnel->stats.tx_bytes); |
1101 | sstats->tx_packets++; | 1084 | atomic_long_inc(&session->stats.tx_packets); |
1102 | sstats->tx_bytes += len; | 1085 | atomic_long_add(len, &session->stats.tx_bytes); |
1103 | } else { | 1086 | } else { |
1104 | tstats->tx_errors++; | 1087 | atomic_long_inc(&tunnel->stats.tx_errors); |
1105 | sstats->tx_errors++; | 1088 | atomic_long_inc(&session->stats.tx_errors); |
1106 | } | 1089 | } |
1107 | u64_stats_update_end(&tstats->syncp); | ||
1108 | u64_stats_update_end(&sstats->syncp); | ||
1109 | 1090 | ||
1110 | return 0; | 1091 | return 0; |
1111 | } | 1092 | } |
@@ -1282,6 +1263,7 @@ static void l2tp_tunnel_destruct(struct sock *sk) | |||
1282 | /* No longer an encapsulation socket. See net/ipv4/udp.c */ | 1263 | /* No longer an encapsulation socket. See net/ipv4/udp.c */ |
1283 | (udp_sk(sk))->encap_type = 0; | 1264 | (udp_sk(sk))->encap_type = 0; |
1284 | (udp_sk(sk))->encap_rcv = NULL; | 1265 | (udp_sk(sk))->encap_rcv = NULL; |
1266 | (udp_sk(sk))->encap_destroy = NULL; | ||
1285 | break; | 1267 | break; |
1286 | case L2TP_ENCAPTYPE_IP: | 1268 | case L2TP_ENCAPTYPE_IP: |
1287 | break; | 1269 | break; |
@@ -1311,7 +1293,7 @@ end: | |||
1311 | 1293 | ||
1312 | /* When the tunnel is closed, all the attached sessions need to go too. | 1294 | /* When the tunnel is closed, all the attached sessions need to go too. |
1313 | */ | 1295 | */ |
1314 | static void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) | 1296 | void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel) |
1315 | { | 1297 | { |
1316 | int hash; | 1298 | int hash; |
1317 | struct hlist_node *walk; | 1299 | struct hlist_node *walk; |
@@ -1334,25 +1316,13 @@ again: | |||
1334 | 1316 | ||
1335 | hlist_del_init(&session->hlist); | 1317 | hlist_del_init(&session->hlist); |
1336 | 1318 | ||
1337 | /* Since we should hold the sock lock while | ||
1338 | * doing any unbinding, we need to release the | ||
1339 | * lock we're holding before taking that lock. | ||
1340 | * Hold a reference to the sock so it doesn't | ||
1341 | * disappear as we're jumping between locks. | ||
1342 | */ | ||
1343 | if (session->ref != NULL) | 1319 | if (session->ref != NULL) |
1344 | (*session->ref)(session); | 1320 | (*session->ref)(session); |
1345 | 1321 | ||
1346 | write_unlock_bh(&tunnel->hlist_lock); | 1322 | write_unlock_bh(&tunnel->hlist_lock); |
1347 | 1323 | ||
1348 | if (tunnel->version != L2TP_HDR_VER_2) { | 1324 | __l2tp_session_unhash(session); |
1349 | struct l2tp_net *pn = l2tp_pernet(tunnel->l2tp_net); | 1325 | l2tp_session_queue_purge(session); |
1350 | |||
1351 | spin_lock_bh(&pn->l2tp_session_hlist_lock); | ||
1352 | hlist_del_init_rcu(&session->global_hlist); | ||
1353 | spin_unlock_bh(&pn->l2tp_session_hlist_lock); | ||
1354 | synchronize_rcu(); | ||
1355 | } | ||
1356 | 1326 | ||
1357 | if (session->session_close != NULL) | 1327 | if (session->session_close != NULL) |
1358 | (*session->session_close)(session); | 1328 | (*session->session_close)(session); |
@@ -1360,6 +1330,8 @@ again: | |||
1360 | if (session->deref != NULL) | 1330 | if (session->deref != NULL) |
1361 | (*session->deref)(session); | 1331 | (*session->deref)(session); |
1362 | 1332 | ||
1333 | l2tp_session_dec_refcount(session); | ||
1334 | |||
1363 | write_lock_bh(&tunnel->hlist_lock); | 1335 | write_lock_bh(&tunnel->hlist_lock); |
1364 | 1336 | ||
1365 | /* Now restart from the beginning of this hash | 1337 | /* Now restart from the beginning of this hash |
@@ -1372,6 +1344,17 @@ again: | |||
1372 | } | 1344 | } |
1373 | write_unlock_bh(&tunnel->hlist_lock); | 1345 | write_unlock_bh(&tunnel->hlist_lock); |
1374 | } | 1346 | } |
1347 | EXPORT_SYMBOL_GPL(l2tp_tunnel_closeall); | ||
1348 | |||
1349 | /* Tunnel socket destroy hook for UDP encapsulation */ | ||
1350 | static void l2tp_udp_encap_destroy(struct sock *sk) | ||
1351 | { | ||
1352 | struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); | ||
1353 | if (tunnel) { | ||
1354 | l2tp_tunnel_closeall(tunnel); | ||
1355 | sock_put(sk); | ||
1356 | } | ||
1357 | } | ||
1375 | 1358 | ||
1376 | /* Really kill the tunnel. | 1359 | /* Really kill the tunnel. |
1377 | * Come here only when all sessions have been cleared from the tunnel. | 1360 | * Come here only when all sessions have been cleared from the tunnel. |
@@ -1397,19 +1380,21 @@ static void l2tp_tunnel_del_work(struct work_struct *work) | |||
1397 | return; | 1380 | return; |
1398 | 1381 | ||
1399 | sock = sk->sk_socket; | 1382 | sock = sk->sk_socket; |
1400 | BUG_ON(!sock); | ||
1401 | 1383 | ||
1402 | /* If the tunnel socket was created directly by the kernel, use the | 1384 | /* If the tunnel socket was created by userspace, then go through the |
1403 | * sk_* API to release the socket now. Otherwise go through the | 1385 | * inet layer to shut the socket down, and let userspace close it. |
1404 | * inet_* layer to shut the socket down, and let userspace close it. | 1386 | * Otherwise, if we created the socket directly within the kernel, use |
1387 | * the sk API to release it here. | ||
1405 | * In either case the tunnel resources are freed in the socket | 1388 | * In either case the tunnel resources are freed in the socket |
1406 | * destructor when the tunnel socket goes away. | 1389 | * destructor when the tunnel socket goes away. |
1407 | */ | 1390 | */ |
1408 | if (sock->file == NULL) { | 1391 | if (tunnel->fd >= 0) { |
1409 | kernel_sock_shutdown(sock, SHUT_RDWR); | 1392 | if (sock) |
1410 | sk_release_kernel(sk); | 1393 | inet_shutdown(sock, 2); |
1411 | } else { | 1394 | } else { |
1412 | inet_shutdown(sock, 2); | 1395 | if (sock) |
1396 | kernel_sock_shutdown(sock, SHUT_RDWR); | ||
1397 | sk_release_kernel(sk); | ||
1413 | } | 1398 | } |
1414 | 1399 | ||
1415 | l2tp_tunnel_sock_put(sk); | 1400 | l2tp_tunnel_sock_put(sk); |
@@ -1668,6 +1653,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 | |||
1668 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ | 1653 | /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ |
1669 | udp_sk(sk)->encap_type = UDP_ENCAP_L2TPINUDP; | 1654 | udp_sk(sk)->encap_type = UDP_ENCAP_L2TPINUDP; |
1670 | udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; | 1655 | udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv; |
1656 | udp_sk(sk)->encap_destroy = l2tp_udp_encap_destroy; | ||
1671 | #if IS_ENABLED(CONFIG_IPV6) | 1657 | #if IS_ENABLED(CONFIG_IPV6) |
1672 | if (sk->sk_family == PF_INET6) | 1658 | if (sk->sk_family == PF_INET6) |
1673 | udpv6_encap_enable(); | 1659 | udpv6_encap_enable(); |
@@ -1723,6 +1709,7 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create); | |||
1723 | */ | 1709 | */ |
1724 | int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) | 1710 | int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) |
1725 | { | 1711 | { |
1712 | l2tp_tunnel_closeall(tunnel); | ||
1726 | return (false == queue_work(l2tp_wq, &tunnel->del_work)); | 1713 | return (false == queue_work(l2tp_wq, &tunnel->del_work)); |
1727 | } | 1714 | } |
1728 | EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); | 1715 | EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); |
@@ -1731,62 +1718,71 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); | |||
1731 | */ | 1718 | */ |
1732 | void l2tp_session_free(struct l2tp_session *session) | 1719 | void l2tp_session_free(struct l2tp_session *session) |
1733 | { | 1720 | { |
1734 | struct l2tp_tunnel *tunnel; | 1721 | struct l2tp_tunnel *tunnel = session->tunnel; |
1735 | 1722 | ||
1736 | BUG_ON(atomic_read(&session->ref_count) != 0); | 1723 | BUG_ON(atomic_read(&session->ref_count) != 0); |
1737 | 1724 | ||
1738 | tunnel = session->tunnel; | 1725 | if (tunnel) { |
1739 | if (tunnel != NULL) { | ||
1740 | BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); | 1726 | BUG_ON(tunnel->magic != L2TP_TUNNEL_MAGIC); |
1727 | if (session->session_id != 0) | ||
1728 | atomic_dec(&l2tp_session_count); | ||
1729 | sock_put(tunnel->sock); | ||
1730 | session->tunnel = NULL; | ||
1731 | l2tp_tunnel_dec_refcount(tunnel); | ||
1732 | } | ||
1733 | |||
1734 | kfree(session); | ||
1741 | 1735 | ||
1742 | /* Delete the session from the hash */ | 1736 | return; |
1737 | } | ||
1738 | EXPORT_SYMBOL_GPL(l2tp_session_free); | ||
1739 | |||
1740 | /* Remove an l2tp session from l2tp_core's hash lists. | ||
1741 | * Provides a tidyup interface for pseudowire code which can't just route all | ||
1742 | * shutdown via. l2tp_session_delete and a pseudowire-specific session_close | ||
1743 | * callback. | ||
1744 | */ | ||
1745 | void __l2tp_session_unhash(struct l2tp_session *session) | ||
1746 | { | ||
1747 | struct l2tp_tunnel *tunnel = session->tunnel; | ||
1748 | |||
1749 | /* Remove the session from core hashes */ | ||
1750 | if (tunnel) { | ||
1751 | /* Remove from the per-tunnel hash */ | ||
1743 | write_lock_bh(&tunnel->hlist_lock); | 1752 | write_lock_bh(&tunnel->hlist_lock); |
1744 | hlist_del_init(&session->hlist); | 1753 | hlist_del_init(&session->hlist); |
1745 | write_unlock_bh(&tunnel->hlist_lock); | 1754 | write_unlock_bh(&tunnel->hlist_lock); |
1746 | 1755 | ||
1747 | /* Unlink from the global hash if not L2TPv2 */ | 1756 | /* For L2TPv3 we have a per-net hash: remove from there, too */ |
1748 | if (tunnel->version != L2TP_HDR_VER_2) { | 1757 | if (tunnel->version != L2TP_HDR_VER_2) { |
1749 | struct l2tp_net *pn = l2tp_pernet(tunnel->l2tp_net); | 1758 | struct l2tp_net *pn = l2tp_pernet(tunnel->l2tp_net); |
1750 | |||
1751 | spin_lock_bh(&pn->l2tp_session_hlist_lock); | 1759 | spin_lock_bh(&pn->l2tp_session_hlist_lock); |
1752 | hlist_del_init_rcu(&session->global_hlist); | 1760 | hlist_del_init_rcu(&session->global_hlist); |
1753 | spin_unlock_bh(&pn->l2tp_session_hlist_lock); | 1761 | spin_unlock_bh(&pn->l2tp_session_hlist_lock); |
1754 | synchronize_rcu(); | 1762 | synchronize_rcu(); |
1755 | } | 1763 | } |
1756 | |||
1757 | if (session->session_id != 0) | ||
1758 | atomic_dec(&l2tp_session_count); | ||
1759 | |||
1760 | sock_put(tunnel->sock); | ||
1761 | |||
1762 | /* This will delete the tunnel context if this | ||
1763 | * is the last session on the tunnel. | ||
1764 | */ | ||
1765 | session->tunnel = NULL; | ||
1766 | l2tp_tunnel_dec_refcount(tunnel); | ||
1767 | } | 1764 | } |
1768 | |||
1769 | kfree(session); | ||
1770 | |||
1771 | return; | ||
1772 | } | 1765 | } |
1773 | EXPORT_SYMBOL_GPL(l2tp_session_free); | 1766 | EXPORT_SYMBOL_GPL(__l2tp_session_unhash); |
1774 | 1767 | ||
1775 | /* This function is used by the netlink SESSION_DELETE command and by | 1768 | /* This function is used by the netlink SESSION_DELETE command and by |
1776 | pseudowire modules. | 1769 | pseudowire modules. |
1777 | */ | 1770 | */ |
1778 | int l2tp_session_delete(struct l2tp_session *session) | 1771 | int l2tp_session_delete(struct l2tp_session *session) |
1779 | { | 1772 | { |
1773 | if (session->ref) | ||
1774 | (*session->ref)(session); | ||
1775 | __l2tp_session_unhash(session); | ||
1776 | l2tp_session_queue_purge(session); | ||
1780 | if (session->session_close != NULL) | 1777 | if (session->session_close != NULL) |
1781 | (*session->session_close)(session); | 1778 | (*session->session_close)(session); |
1782 | 1779 | if (session->deref) | |
1780 | (*session->ref)(session); | ||
1783 | l2tp_session_dec_refcount(session); | 1781 | l2tp_session_dec_refcount(session); |
1784 | |||
1785 | return 0; | 1782 | return 0; |
1786 | } | 1783 | } |
1787 | EXPORT_SYMBOL_GPL(l2tp_session_delete); | 1784 | EXPORT_SYMBOL_GPL(l2tp_session_delete); |
1788 | 1785 | ||
1789 | |||
1790 | /* We come here whenever a session's send_seq, cookie_len or | 1786 | /* We come here whenever a session's send_seq, cookie_len or |
1791 | * l2specific_len parameters are set. | 1787 | * l2specific_len parameters are set. |
1792 | */ | 1788 | */ |
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h index 8eb8f1d47f3a..485a490fd990 100644 --- a/net/l2tp/l2tp_core.h +++ b/net/l2tp/l2tp_core.h | |||
@@ -36,16 +36,15 @@ enum { | |||
36 | struct sk_buff; | 36 | struct sk_buff; |
37 | 37 | ||
38 | struct l2tp_stats { | 38 | struct l2tp_stats { |
39 | u64 tx_packets; | 39 | atomic_long_t tx_packets; |
40 | u64 tx_bytes; | 40 | atomic_long_t tx_bytes; |
41 | u64 tx_errors; | 41 | atomic_long_t tx_errors; |
42 | u64 rx_packets; | 42 | atomic_long_t rx_packets; |
43 | u64 rx_bytes; | 43 | atomic_long_t rx_bytes; |
44 | u64 rx_seq_discards; | 44 | atomic_long_t rx_seq_discards; |
45 | u64 rx_oos_packets; | 45 | atomic_long_t rx_oos_packets; |
46 | u64 rx_errors; | 46 | atomic_long_t rx_errors; |
47 | u64 rx_cookie_discards; | 47 | atomic_long_t rx_cookie_discards; |
48 | struct u64_stats_sync syncp; | ||
49 | }; | 48 | }; |
50 | 49 | ||
51 | struct l2tp_tunnel; | 50 | struct l2tp_tunnel; |
@@ -240,11 +239,14 @@ extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id); | |||
240 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); | 239 | extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth); |
241 | 240 | ||
242 | extern int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp); | 241 | extern int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, struct l2tp_tunnel **tunnelp); |
242 | extern void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); | ||
243 | extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); | 243 | extern int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); |
244 | extern struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg); | 244 | extern struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg); |
245 | extern void __l2tp_session_unhash(struct l2tp_session *session); | ||
245 | extern int l2tp_session_delete(struct l2tp_session *session); | 246 | extern int l2tp_session_delete(struct l2tp_session *session); |
246 | extern void l2tp_session_free(struct l2tp_session *session); | 247 | extern void l2tp_session_free(struct l2tp_session *session); |
247 | extern void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, unsigned char *ptr, unsigned char *optr, u16 hdrflags, int length, int (*payload_hook)(struct sk_buff *skb)); | 248 | extern void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb, unsigned char *ptr, unsigned char *optr, u16 hdrflags, int length, int (*payload_hook)(struct sk_buff *skb)); |
249 | extern int l2tp_session_queue_purge(struct l2tp_session *session); | ||
248 | extern int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb); | 250 | extern int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb); |
249 | 251 | ||
250 | extern int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len); | 252 | extern int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len); |
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c index c3813bc84552..072d7202e182 100644 --- a/net/l2tp/l2tp_debugfs.c +++ b/net/l2tp/l2tp_debugfs.c | |||
@@ -146,14 +146,14 @@ static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v) | |||
146 | tunnel->sock ? atomic_read(&tunnel->sock->sk_refcnt) : 0, | 146 | tunnel->sock ? atomic_read(&tunnel->sock->sk_refcnt) : 0, |
147 | atomic_read(&tunnel->ref_count)); | 147 | atomic_read(&tunnel->ref_count)); |
148 | 148 | ||
149 | seq_printf(m, " %08x rx %llu/%llu/%llu rx %llu/%llu/%llu\n", | 149 | seq_printf(m, " %08x rx %ld/%ld/%ld rx %ld/%ld/%ld\n", |
150 | tunnel->debug, | 150 | tunnel->debug, |
151 | (unsigned long long)tunnel->stats.tx_packets, | 151 | atomic_long_read(&tunnel->stats.tx_packets), |
152 | (unsigned long long)tunnel->stats.tx_bytes, | 152 | atomic_long_read(&tunnel->stats.tx_bytes), |
153 | (unsigned long long)tunnel->stats.tx_errors, | 153 | atomic_long_read(&tunnel->stats.tx_errors), |
154 | (unsigned long long)tunnel->stats.rx_packets, | 154 | atomic_long_read(&tunnel->stats.rx_packets), |
155 | (unsigned long long)tunnel->stats.rx_bytes, | 155 | atomic_long_read(&tunnel->stats.rx_bytes), |
156 | (unsigned long long)tunnel->stats.rx_errors); | 156 | atomic_long_read(&tunnel->stats.rx_errors)); |
157 | 157 | ||
158 | if (tunnel->show != NULL) | 158 | if (tunnel->show != NULL) |
159 | tunnel->show(m, tunnel); | 159 | tunnel->show(m, tunnel); |
@@ -203,14 +203,14 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v) | |||
203 | seq_printf(m, "\n"); | 203 | seq_printf(m, "\n"); |
204 | } | 204 | } |
205 | 205 | ||
206 | seq_printf(m, " %hu/%hu tx %llu/%llu/%llu rx %llu/%llu/%llu\n", | 206 | seq_printf(m, " %hu/%hu tx %ld/%ld/%ld rx %ld/%ld/%ld\n", |
207 | session->nr, session->ns, | 207 | session->nr, session->ns, |
208 | (unsigned long long)session->stats.tx_packets, | 208 | atomic_long_read(&session->stats.tx_packets), |
209 | (unsigned long long)session->stats.tx_bytes, | 209 | atomic_long_read(&session->stats.tx_bytes), |
210 | (unsigned long long)session->stats.tx_errors, | 210 | atomic_long_read(&session->stats.tx_errors), |
211 | (unsigned long long)session->stats.rx_packets, | 211 | atomic_long_read(&session->stats.rx_packets), |
212 | (unsigned long long)session->stats.rx_bytes, | 212 | atomic_long_read(&session->stats.rx_bytes), |
213 | (unsigned long long)session->stats.rx_errors); | 213 | atomic_long_read(&session->stats.rx_errors)); |
214 | 214 | ||
215 | if (session->show != NULL) | 215 | if (session->show != NULL) |
216 | session->show(m, session); | 216 | session->show(m, session); |
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index 7f41b7051269..571db8dd2292 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c | |||
@@ -228,10 +228,16 @@ static void l2tp_ip_close(struct sock *sk, long timeout) | |||
228 | static void l2tp_ip_destroy_sock(struct sock *sk) | 228 | static void l2tp_ip_destroy_sock(struct sock *sk) |
229 | { | 229 | { |
230 | struct sk_buff *skb; | 230 | struct sk_buff *skb; |
231 | struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); | ||
231 | 232 | ||
232 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) | 233 | while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) |
233 | kfree_skb(skb); | 234 | kfree_skb(skb); |
234 | 235 | ||
236 | if (tunnel) { | ||
237 | l2tp_tunnel_closeall(tunnel); | ||
238 | sock_put(sk); | ||
239 | } | ||
240 | |||
235 | sk_refcnt_debug_dec(sk); | 241 | sk_refcnt_debug_dec(sk); |
236 | } | 242 | } |
237 | 243 | ||
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 41f2f8126ebc..c74f5a91ff6a 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -241,10 +241,17 @@ static void l2tp_ip6_close(struct sock *sk, long timeout) | |||
241 | 241 | ||
242 | static void l2tp_ip6_destroy_sock(struct sock *sk) | 242 | static void l2tp_ip6_destroy_sock(struct sock *sk) |
243 | { | 243 | { |
244 | struct l2tp_tunnel *tunnel = l2tp_sock_to_tunnel(sk); | ||
245 | |||
244 | lock_sock(sk); | 246 | lock_sock(sk); |
245 | ip6_flush_pending_frames(sk); | 247 | ip6_flush_pending_frames(sk); |
246 | release_sock(sk); | 248 | release_sock(sk); |
247 | 249 | ||
250 | if (tunnel) { | ||
251 | l2tp_tunnel_closeall(tunnel); | ||
252 | sock_put(sk); | ||
253 | } | ||
254 | |||
248 | inet6_destroy_sock(sk); | 255 | inet6_destroy_sock(sk); |
249 | } | 256 | } |
250 | 257 | ||
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index c1bab22db85e..0825ff26e113 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -246,8 +246,6 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla | |||
246 | #if IS_ENABLED(CONFIG_IPV6) | 246 | #if IS_ENABLED(CONFIG_IPV6) |
247 | struct ipv6_pinfo *np = NULL; | 247 | struct ipv6_pinfo *np = NULL; |
248 | #endif | 248 | #endif |
249 | struct l2tp_stats stats; | ||
250 | unsigned int start; | ||
251 | 249 | ||
252 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, | 250 | hdr = genlmsg_put(skb, portid, seq, &l2tp_nl_family, flags, |
253 | L2TP_CMD_TUNNEL_GET); | 251 | L2TP_CMD_TUNNEL_GET); |
@@ -265,28 +263,22 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla | |||
265 | if (nest == NULL) | 263 | if (nest == NULL) |
266 | goto nla_put_failure; | 264 | goto nla_put_failure; |
267 | 265 | ||
268 | do { | 266 | if (nla_put_u64(skb, L2TP_ATTR_TX_PACKETS, |
269 | start = u64_stats_fetch_begin(&tunnel->stats.syncp); | 267 | atomic_long_read(&tunnel->stats.tx_packets)) || |
270 | stats.tx_packets = tunnel->stats.tx_packets; | 268 | nla_put_u64(skb, L2TP_ATTR_TX_BYTES, |
271 | stats.tx_bytes = tunnel->stats.tx_bytes; | 269 | atomic_long_read(&tunnel->stats.tx_bytes)) || |
272 | stats.tx_errors = tunnel->stats.tx_errors; | 270 | nla_put_u64(skb, L2TP_ATTR_TX_ERRORS, |
273 | stats.rx_packets = tunnel->stats.rx_packets; | 271 | atomic_long_read(&tunnel->stats.tx_errors)) || |
274 | stats.rx_bytes = tunnel->stats.rx_bytes; | 272 | nla_put_u64(skb, L2TP_ATTR_RX_PACKETS, |
275 | stats.rx_errors = tunnel->stats.rx_errors; | 273 | atomic_long_read(&tunnel->stats.rx_packets)) || |
276 | stats.rx_seq_discards = tunnel->stats.rx_seq_discards; | 274 | nla_put_u64(skb, L2TP_ATTR_RX_BYTES, |
277 | stats.rx_oos_packets = tunnel->stats.rx_oos_packets; | 275 | atomic_long_read(&tunnel->stats.rx_bytes)) || |
278 | } while (u64_stats_fetch_retry(&tunnel->stats.syncp, start)); | ||
279 | |||
280 | if (nla_put_u64(skb, L2TP_ATTR_TX_PACKETS, stats.tx_packets) || | ||
281 | nla_put_u64(skb, L2TP_ATTR_TX_BYTES, stats.tx_bytes) || | ||
282 | nla_put_u64(skb, L2TP_ATTR_TX_ERRORS, stats.tx_errors) || | ||
283 | nla_put_u64(skb, L2TP_ATTR_RX_PACKETS, stats.rx_packets) || | ||
284 | nla_put_u64(skb, L2TP_ATTR_RX_BYTES, stats.rx_bytes) || | ||
285 | nla_put_u64(skb, L2TP_ATTR_RX_SEQ_DISCARDS, | 276 | nla_put_u64(skb, L2TP_ATTR_RX_SEQ_DISCARDS, |
286 | stats.rx_seq_discards) || | 277 | atomic_long_read(&tunnel->stats.rx_seq_discards)) || |
287 | nla_put_u64(skb, L2TP_ATTR_RX_OOS_PACKETS, | 278 | nla_put_u64(skb, L2TP_ATTR_RX_OOS_PACKETS, |
288 | stats.rx_oos_packets) || | 279 | atomic_long_read(&tunnel->stats.rx_oos_packets)) || |
289 | nla_put_u64(skb, L2TP_ATTR_RX_ERRORS, stats.rx_errors)) | 280 | nla_put_u64(skb, L2TP_ATTR_RX_ERRORS, |
281 | atomic_long_read(&tunnel->stats.rx_errors))) | ||
290 | goto nla_put_failure; | 282 | goto nla_put_failure; |
291 | nla_nest_end(skb, nest); | 283 | nla_nest_end(skb, nest); |
292 | 284 | ||
@@ -612,8 +604,6 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl | |||
612 | struct nlattr *nest; | 604 | struct nlattr *nest; |
613 | struct l2tp_tunnel *tunnel = session->tunnel; | 605 | struct l2tp_tunnel *tunnel = session->tunnel; |
614 | struct sock *sk = NULL; | 606 | struct sock *sk = NULL; |
615 | struct l2tp_stats stats; | ||
616 | unsigned int start; | ||
617 | 607 | ||
618 | sk = tunnel->sock; | 608 | sk = tunnel->sock; |
619 | 609 | ||
@@ -656,28 +646,22 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl | |||
656 | if (nest == NULL) | 646 | if (nest == NULL) |
657 | goto nla_put_failure; | 647 | goto nla_put_failure; |
658 | 648 | ||
659 | do { | 649 | if (nla_put_u64(skb, L2TP_ATTR_TX_PACKETS, |
660 | start = u64_stats_fetch_begin(&session->stats.syncp); | 650 | atomic_long_read(&session->stats.tx_packets)) || |
661 | stats.tx_packets = session->stats.tx_packets; | 651 | nla_put_u64(skb, L2TP_ATTR_TX_BYTES, |
662 | stats.tx_bytes = session->stats.tx_bytes; | 652 | atomic_long_read(&session->stats.tx_bytes)) || |
663 | stats.tx_errors = session->stats.tx_errors; | 653 | nla_put_u64(skb, L2TP_ATTR_TX_ERRORS, |
664 | stats.rx_packets = session->stats.rx_packets; | 654 | atomic_long_read(&session->stats.tx_errors)) || |
665 | stats.rx_bytes = session->stats.rx_bytes; | 655 | nla_put_u64(skb, L2TP_ATTR_RX_PACKETS, |
666 | stats.rx_errors = session->stats.rx_errors; | 656 | atomic_long_read(&session->stats.rx_packets)) || |
667 | stats.rx_seq_discards = session->stats.rx_seq_discards; | 657 | nla_put_u64(skb, L2TP_ATTR_RX_BYTES, |
668 | stats.rx_oos_packets = session->stats.rx_oos_packets; | 658 | atomic_long_read(&session->stats.rx_bytes)) || |
669 | } while (u64_stats_fetch_retry(&session->stats.syncp, start)); | ||
670 | |||
671 | if (nla_put_u64(skb, L2TP_ATTR_TX_PACKETS, stats.tx_packets) || | ||
672 | nla_put_u64(skb, L2TP_ATTR_TX_BYTES, stats.tx_bytes) || | ||
673 | nla_put_u64(skb, L2TP_ATTR_TX_ERRORS, stats.tx_errors) || | ||
674 | nla_put_u64(skb, L2TP_ATTR_RX_PACKETS, stats.rx_packets) || | ||
675 | nla_put_u64(skb, L2TP_ATTR_RX_BYTES, stats.rx_bytes) || | ||
676 | nla_put_u64(skb, L2TP_ATTR_RX_SEQ_DISCARDS, | 659 | nla_put_u64(skb, L2TP_ATTR_RX_SEQ_DISCARDS, |
677 | stats.rx_seq_discards) || | 660 | atomic_long_read(&session->stats.rx_seq_discards)) || |
678 | nla_put_u64(skb, L2TP_ATTR_RX_OOS_PACKETS, | 661 | nla_put_u64(skb, L2TP_ATTR_RX_OOS_PACKETS, |
679 | stats.rx_oos_packets) || | 662 | atomic_long_read(&session->stats.rx_oos_packets)) || |
680 | nla_put_u64(skb, L2TP_ATTR_RX_ERRORS, stats.rx_errors)) | 663 | nla_put_u64(skb, L2TP_ATTR_RX_ERRORS, |
664 | atomic_long_read(&session->stats.rx_errors))) | ||
681 | goto nla_put_failure; | 665 | goto nla_put_failure; |
682 | nla_nest_end(skb, nest); | 666 | nla_nest_end(skb, nest); |
683 | 667 | ||
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 6a53371dba1f..637a341c1e2d 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -97,6 +97,7 @@ | |||
97 | #include <net/ip.h> | 97 | #include <net/ip.h> |
98 | #include <net/udp.h> | 98 | #include <net/udp.h> |
99 | #include <net/xfrm.h> | 99 | #include <net/xfrm.h> |
100 | #include <net/inet_common.h> | ||
100 | 101 | ||
101 | #include <asm/byteorder.h> | 102 | #include <asm/byteorder.h> |
102 | #include <linux/atomic.h> | 103 | #include <linux/atomic.h> |
@@ -259,7 +260,7 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int | |||
259 | session->name); | 260 | session->name); |
260 | 261 | ||
261 | /* Not bound. Nothing we can do, so discard. */ | 262 | /* Not bound. Nothing we can do, so discard. */ |
262 | session->stats.rx_errors++; | 263 | atomic_long_inc(&session->stats.rx_errors); |
263 | kfree_skb(skb); | 264 | kfree_skb(skb); |
264 | } | 265 | } |
265 | 266 | ||
@@ -447,34 +448,16 @@ static void pppol2tp_session_close(struct l2tp_session *session) | |||
447 | { | 448 | { |
448 | struct pppol2tp_session *ps = l2tp_session_priv(session); | 449 | struct pppol2tp_session *ps = l2tp_session_priv(session); |
449 | struct sock *sk = ps->sock; | 450 | struct sock *sk = ps->sock; |
450 | struct sk_buff *skb; | 451 | struct socket *sock = sk->sk_socket; |
451 | 452 | ||
452 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); | 453 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); |
453 | 454 | ||
454 | if (session->session_id == 0) | ||
455 | goto out; | ||
456 | |||
457 | if (sk != NULL) { | ||
458 | lock_sock(sk); | ||
459 | |||
460 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | ||
461 | pppox_unbind_sock(sk); | ||
462 | sk->sk_state = PPPOX_DEAD; | ||
463 | sk->sk_state_change(sk); | ||
464 | } | ||
465 | |||
466 | /* Purge any queued data */ | ||
467 | skb_queue_purge(&sk->sk_receive_queue); | ||
468 | skb_queue_purge(&sk->sk_write_queue); | ||
469 | while ((skb = skb_dequeue(&session->reorder_q))) { | ||
470 | kfree_skb(skb); | ||
471 | sock_put(sk); | ||
472 | } | ||
473 | 455 | ||
474 | release_sock(sk); | 456 | if (sock) { |
457 | inet_shutdown(sock, 2); | ||
458 | /* Don't let the session go away before our socket does */ | ||
459 | l2tp_session_inc_refcount(session); | ||
475 | } | 460 | } |
476 | |||
477 | out: | ||
478 | return; | 461 | return; |
479 | } | 462 | } |
480 | 463 | ||
@@ -483,19 +466,12 @@ out: | |||
483 | */ | 466 | */ |
484 | static void pppol2tp_session_destruct(struct sock *sk) | 467 | static void pppol2tp_session_destruct(struct sock *sk) |
485 | { | 468 | { |
486 | struct l2tp_session *session; | 469 | struct l2tp_session *session = sk->sk_user_data; |
487 | 470 | if (session) { | |
488 | if (sk->sk_user_data != NULL) { | ||
489 | session = sk->sk_user_data; | ||
490 | if (session == NULL) | ||
491 | goto out; | ||
492 | |||
493 | sk->sk_user_data = NULL; | 471 | sk->sk_user_data = NULL; |
494 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); | 472 | BUG_ON(session->magic != L2TP_SESSION_MAGIC); |
495 | l2tp_session_dec_refcount(session); | 473 | l2tp_session_dec_refcount(session); |
496 | } | 474 | } |
497 | |||
498 | out: | ||
499 | return; | 475 | return; |
500 | } | 476 | } |
501 | 477 | ||
@@ -525,16 +501,13 @@ static int pppol2tp_release(struct socket *sock) | |||
525 | session = pppol2tp_sock_to_session(sk); | 501 | session = pppol2tp_sock_to_session(sk); |
526 | 502 | ||
527 | /* Purge any queued data */ | 503 | /* Purge any queued data */ |
528 | skb_queue_purge(&sk->sk_receive_queue); | ||
529 | skb_queue_purge(&sk->sk_write_queue); | ||
530 | if (session != NULL) { | 504 | if (session != NULL) { |
531 | struct sk_buff *skb; | 505 | __l2tp_session_unhash(session); |
532 | while ((skb = skb_dequeue(&session->reorder_q))) { | 506 | l2tp_session_queue_purge(session); |
533 | kfree_skb(skb); | ||
534 | sock_put(sk); | ||
535 | } | ||
536 | sock_put(sk); | 507 | sock_put(sk); |
537 | } | 508 | } |
509 | skb_queue_purge(&sk->sk_receive_queue); | ||
510 | skb_queue_purge(&sk->sk_write_queue); | ||
538 | 511 | ||
539 | release_sock(sk); | 512 | release_sock(sk); |
540 | 513 | ||
@@ -880,18 +853,6 @@ out: | |||
880 | return error; | 853 | return error; |
881 | } | 854 | } |
882 | 855 | ||
883 | /* Called when deleting sessions via the netlink interface. | ||
884 | */ | ||
885 | static int pppol2tp_session_delete(struct l2tp_session *session) | ||
886 | { | ||
887 | struct pppol2tp_session *ps = l2tp_session_priv(session); | ||
888 | |||
889 | if (ps->sock == NULL) | ||
890 | l2tp_session_dec_refcount(session); | ||
891 | |||
892 | return 0; | ||
893 | } | ||
894 | |||
895 | #endif /* CONFIG_L2TP_V3 */ | 856 | #endif /* CONFIG_L2TP_V3 */ |
896 | 857 | ||
897 | /* getname() support. | 858 | /* getname() support. |
@@ -1025,14 +986,14 @@ end: | |||
1025 | static void pppol2tp_copy_stats(struct pppol2tp_ioc_stats *dest, | 986 | static void pppol2tp_copy_stats(struct pppol2tp_ioc_stats *dest, |
1026 | struct l2tp_stats *stats) | 987 | struct l2tp_stats *stats) |
1027 | { | 988 | { |
1028 | dest->tx_packets = stats->tx_packets; | 989 | dest->tx_packets = atomic_long_read(&stats->tx_packets); |
1029 | dest->tx_bytes = stats->tx_bytes; | 990 | dest->tx_bytes = atomic_long_read(&stats->tx_bytes); |
1030 | dest->tx_errors = stats->tx_errors; | 991 | dest->tx_errors = atomic_long_read(&stats->tx_errors); |
1031 | dest->rx_packets = stats->rx_packets; | 992 | dest->rx_packets = atomic_long_read(&stats->rx_packets); |
1032 | dest->rx_bytes = stats->rx_bytes; | 993 | dest->rx_bytes = atomic_long_read(&stats->rx_bytes); |
1033 | dest->rx_seq_discards = stats->rx_seq_discards; | 994 | dest->rx_seq_discards = atomic_long_read(&stats->rx_seq_discards); |
1034 | dest->rx_oos_packets = stats->rx_oos_packets; | 995 | dest->rx_oos_packets = atomic_long_read(&stats->rx_oos_packets); |
1035 | dest->rx_errors = stats->rx_errors; | 996 | dest->rx_errors = atomic_long_read(&stats->rx_errors); |
1036 | } | 997 | } |
1037 | 998 | ||
1038 | /* Session ioctl helper. | 999 | /* Session ioctl helper. |
@@ -1666,14 +1627,14 @@ static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v) | |||
1666 | tunnel->name, | 1627 | tunnel->name, |
1667 | (tunnel == tunnel->sock->sk_user_data) ? 'Y' : 'N', | 1628 | (tunnel == tunnel->sock->sk_user_data) ? 'Y' : 'N', |
1668 | atomic_read(&tunnel->ref_count) - 1); | 1629 | atomic_read(&tunnel->ref_count) - 1); |
1669 | seq_printf(m, " %08x %llu/%llu/%llu %llu/%llu/%llu\n", | 1630 | seq_printf(m, " %08x %ld/%ld/%ld %ld/%ld/%ld\n", |
1670 | tunnel->debug, | 1631 | tunnel->debug, |
1671 | (unsigned long long)tunnel->stats.tx_packets, | 1632 | atomic_long_read(&tunnel->stats.tx_packets), |
1672 | (unsigned long long)tunnel->stats.tx_bytes, | 1633 | atomic_long_read(&tunnel->stats.tx_bytes), |
1673 | (unsigned long long)tunnel->stats.tx_errors, | 1634 | atomic_long_read(&tunnel->stats.tx_errors), |
1674 | (unsigned long long)tunnel->stats.rx_packets, | 1635 | atomic_long_read(&tunnel->stats.rx_packets), |
1675 | (unsigned long long)tunnel->stats.rx_bytes, | 1636 | atomic_long_read(&tunnel->stats.rx_bytes), |
1676 | (unsigned long long)tunnel->stats.rx_errors); | 1637 | atomic_long_read(&tunnel->stats.rx_errors)); |
1677 | } | 1638 | } |
1678 | 1639 | ||
1679 | static void pppol2tp_seq_session_show(struct seq_file *m, void *v) | 1640 | static void pppol2tp_seq_session_show(struct seq_file *m, void *v) |
@@ -1708,14 +1669,14 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v) | |||
1708 | session->lns_mode ? "LNS" : "LAC", | 1669 | session->lns_mode ? "LNS" : "LAC", |
1709 | session->debug, | 1670 | session->debug, |
1710 | jiffies_to_msecs(session->reorder_timeout)); | 1671 | jiffies_to_msecs(session->reorder_timeout)); |
1711 | seq_printf(m, " %hu/%hu %llu/%llu/%llu %llu/%llu/%llu\n", | 1672 | seq_printf(m, " %hu/%hu %ld/%ld/%ld %ld/%ld/%ld\n", |
1712 | session->nr, session->ns, | 1673 | session->nr, session->ns, |
1713 | (unsigned long long)session->stats.tx_packets, | 1674 | atomic_long_read(&session->stats.tx_packets), |
1714 | (unsigned long long)session->stats.tx_bytes, | 1675 | atomic_long_read(&session->stats.tx_bytes), |
1715 | (unsigned long long)session->stats.tx_errors, | 1676 | atomic_long_read(&session->stats.tx_errors), |
1716 | (unsigned long long)session->stats.rx_packets, | 1677 | atomic_long_read(&session->stats.rx_packets), |
1717 | (unsigned long long)session->stats.rx_bytes, | 1678 | atomic_long_read(&session->stats.rx_bytes), |
1718 | (unsigned long long)session->stats.rx_errors); | 1679 | atomic_long_read(&session->stats.rx_errors)); |
1719 | 1680 | ||
1720 | if (po) | 1681 | if (po) |
1721 | seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); | 1682 | seq_printf(m, " interface %s\n", ppp_dev_name(&po->chan)); |
@@ -1839,7 +1800,7 @@ static const struct pppox_proto pppol2tp_proto = { | |||
1839 | 1800 | ||
1840 | static const struct l2tp_nl_cmd_ops pppol2tp_nl_cmd_ops = { | 1801 | static const struct l2tp_nl_cmd_ops pppol2tp_nl_cmd_ops = { |
1841 | .session_create = pppol2tp_session_create, | 1802 | .session_create = pppol2tp_session_create, |
1842 | .session_delete = pppol2tp_session_delete, | 1803 | .session_delete = l2tp_session_delete, |
1843 | }; | 1804 | }; |
1844 | 1805 | ||
1845 | #endif /* CONFIG_L2TP_V3 */ | 1806 | #endif /* CONFIG_L2TP_V3 */ |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 47edf5a40a59..61f49d241712 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1394,10 +1394,8 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum) | |||
1394 | skb_reset_network_header(skb); | 1394 | skb_reset_network_header(skb); |
1395 | IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n", | 1395 | IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n", |
1396 | &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, mtu); | 1396 | &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr, mtu); |
1397 | rcu_read_lock(); | ||
1398 | ipv4_update_pmtu(skb, dev_net(skb->dev), | 1397 | ipv4_update_pmtu(skb, dev_net(skb->dev), |
1399 | mtu, 0, 0, 0, 0); | 1398 | mtu, 0, 0, 0, 0); |
1400 | rcu_read_unlock(); | ||
1401 | /* Client uses PMTUD? */ | 1399 | /* Client uses PMTUD? */ |
1402 | if (!(cih->frag_off & htons(IP_DF))) | 1400 | if (!(cih->frag_off & htons(IP_DF))) |
1403 | goto ignore_ipip; | 1401 | goto ignore_ipip; |
@@ -1577,7 +1575,8 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) | |||
1577 | } | 1575 | } |
1578 | /* ipvs enabled in this netns ? */ | 1576 | /* ipvs enabled in this netns ? */ |
1579 | net = skb_net(skb); | 1577 | net = skb_net(skb); |
1580 | if (!net_ipvs(net)->enable) | 1578 | ipvs = net_ipvs(net); |
1579 | if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable)) | ||
1581 | return NF_ACCEPT; | 1580 | return NF_ACCEPT; |
1582 | 1581 | ||
1583 | ip_vs_fill_iph_skb(af, skb, &iph); | 1582 | ip_vs_fill_iph_skb(af, skb, &iph); |
@@ -1654,7 +1653,6 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af) | |||
1654 | } | 1653 | } |
1655 | 1654 | ||
1656 | IP_VS_DBG_PKT(11, af, pp, skb, 0, "Incoming packet"); | 1655 | IP_VS_DBG_PKT(11, af, pp, skb, 0, "Incoming packet"); |
1657 | ipvs = net_ipvs(net); | ||
1658 | /* Check the server status */ | 1656 | /* Check the server status */ |
1659 | if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) { | 1657 | if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) { |
1660 | /* the destination server is not available */ | 1658 | /* the destination server is not available */ |
@@ -1815,13 +1813,15 @@ ip_vs_forward_icmp(unsigned int hooknum, struct sk_buff *skb, | |||
1815 | { | 1813 | { |
1816 | int r; | 1814 | int r; |
1817 | struct net *net; | 1815 | struct net *net; |
1816 | struct netns_ipvs *ipvs; | ||
1818 | 1817 | ||
1819 | if (ip_hdr(skb)->protocol != IPPROTO_ICMP) | 1818 | if (ip_hdr(skb)->protocol != IPPROTO_ICMP) |
1820 | return NF_ACCEPT; | 1819 | return NF_ACCEPT; |
1821 | 1820 | ||
1822 | /* ipvs enabled in this netns ? */ | 1821 | /* ipvs enabled in this netns ? */ |
1823 | net = skb_net(skb); | 1822 | net = skb_net(skb); |
1824 | if (!net_ipvs(net)->enable) | 1823 | ipvs = net_ipvs(net); |
1824 | if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable)) | ||
1825 | return NF_ACCEPT; | 1825 | return NF_ACCEPT; |
1826 | 1826 | ||
1827 | return ip_vs_in_icmp(skb, &r, hooknum); | 1827 | return ip_vs_in_icmp(skb, &r, hooknum); |
@@ -1835,6 +1835,7 @@ ip_vs_forward_icmp_v6(unsigned int hooknum, struct sk_buff *skb, | |||
1835 | { | 1835 | { |
1836 | int r; | 1836 | int r; |
1837 | struct net *net; | 1837 | struct net *net; |
1838 | struct netns_ipvs *ipvs; | ||
1838 | struct ip_vs_iphdr iphdr; | 1839 | struct ip_vs_iphdr iphdr; |
1839 | 1840 | ||
1840 | ip_vs_fill_iph_skb(AF_INET6, skb, &iphdr); | 1841 | ip_vs_fill_iph_skb(AF_INET6, skb, &iphdr); |
@@ -1843,7 +1844,8 @@ ip_vs_forward_icmp_v6(unsigned int hooknum, struct sk_buff *skb, | |||
1843 | 1844 | ||
1844 | /* ipvs enabled in this netns ? */ | 1845 | /* ipvs enabled in this netns ? */ |
1845 | net = skb_net(skb); | 1846 | net = skb_net(skb); |
1846 | if (!net_ipvs(net)->enable) | 1847 | ipvs = net_ipvs(net); |
1848 | if (unlikely(sysctl_backup_only(ipvs) || !ipvs->enable)) | ||
1847 | return NF_ACCEPT; | 1849 | return NF_ACCEPT; |
1848 | 1850 | ||
1849 | return ip_vs_in_icmp_v6(skb, &r, hooknum, &iphdr); | 1851 | return ip_vs_in_icmp_v6(skb, &r, hooknum, &iphdr); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index c68198bf9128..9e2d1cccd1eb 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1808,6 +1808,12 @@ static struct ctl_table vs_vars[] = { | |||
1808 | .mode = 0644, | 1808 | .mode = 0644, |
1809 | .proc_handler = proc_dointvec, | 1809 | .proc_handler = proc_dointvec, |
1810 | }, | 1810 | }, |
1811 | { | ||
1812 | .procname = "backup_only", | ||
1813 | .maxlen = sizeof(int), | ||
1814 | .mode = 0644, | ||
1815 | .proc_handler = proc_dointvec, | ||
1816 | }, | ||
1811 | #ifdef CONFIG_IP_VS_DEBUG | 1817 | #ifdef CONFIG_IP_VS_DEBUG |
1812 | { | 1818 | { |
1813 | .procname = "debug_level", | 1819 | .procname = "debug_level", |
@@ -3741,6 +3747,7 @@ static int __net_init ip_vs_control_net_init_sysctl(struct net *net) | |||
3741 | tbl[idx++].data = &ipvs->sysctl_nat_icmp_send; | 3747 | tbl[idx++].data = &ipvs->sysctl_nat_icmp_send; |
3742 | ipvs->sysctl_pmtu_disc = 1; | 3748 | ipvs->sysctl_pmtu_disc = 1; |
3743 | tbl[idx++].data = &ipvs->sysctl_pmtu_disc; | 3749 | tbl[idx++].data = &ipvs->sysctl_pmtu_disc; |
3750 | tbl[idx++].data = &ipvs->sysctl_backup_only; | ||
3744 | 3751 | ||
3745 | 3752 | ||
3746 | ipvs->sysctl_hdr = register_net_sysctl(net, "net/ipv4/vs", tbl); | 3753 | ipvs->sysctl_hdr = register_net_sysctl(net, "net/ipv4/vs", tbl); |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index ae8ec6f27688..cd1d7298f7ba 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -906,7 +906,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | |||
906 | sctp_chunkhdr_t _sctpch, *sch; | 906 | sctp_chunkhdr_t _sctpch, *sch; |
907 | unsigned char chunk_type; | 907 | unsigned char chunk_type; |
908 | int event, next_state; | 908 | int event, next_state; |
909 | int ihl; | 909 | int ihl, cofs; |
910 | 910 | ||
911 | #ifdef CONFIG_IP_VS_IPV6 | 911 | #ifdef CONFIG_IP_VS_IPV6 |
912 | ihl = cp->af == AF_INET ? ip_hdrlen(skb) : sizeof(struct ipv6hdr); | 912 | ihl = cp->af == AF_INET ? ip_hdrlen(skb) : sizeof(struct ipv6hdr); |
@@ -914,8 +914,8 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | |||
914 | ihl = ip_hdrlen(skb); | 914 | ihl = ip_hdrlen(skb); |
915 | #endif | 915 | #endif |
916 | 916 | ||
917 | sch = skb_header_pointer(skb, ihl + sizeof(sctp_sctphdr_t), | 917 | cofs = ihl + sizeof(sctp_sctphdr_t); |
918 | sizeof(_sctpch), &_sctpch); | 918 | sch = skb_header_pointer(skb, cofs, sizeof(_sctpch), &_sctpch); |
919 | if (sch == NULL) | 919 | if (sch == NULL) |
920 | return; | 920 | return; |
921 | 921 | ||
@@ -933,10 +933,12 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | |||
933 | */ | 933 | */ |
934 | if ((sch->type == SCTP_CID_COOKIE_ECHO) || | 934 | if ((sch->type == SCTP_CID_COOKIE_ECHO) || |
935 | (sch->type == SCTP_CID_COOKIE_ACK)) { | 935 | (sch->type == SCTP_CID_COOKIE_ACK)) { |
936 | sch = skb_header_pointer(skb, (ihl + sizeof(sctp_sctphdr_t) + | 936 | int clen = ntohs(sch->length); |
937 | sch->length), sizeof(_sctpch), &_sctpch); | 937 | |
938 | if (sch) { | 938 | if (clen >= sizeof(sctp_chunkhdr_t)) { |
939 | if (sch->type == SCTP_CID_ABORT) | 939 | sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4), |
940 | sizeof(_sctpch), &_sctpch); | ||
941 | if (sch && sch->type == SCTP_CID_ABORT) | ||
940 | chunk_type = sch->type; | 942 | chunk_type = sch->type; |
941 | } | 943 | } |
942 | } | 944 | } |
diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c index 432f95780003..ba65b2041eb4 100644 --- a/net/netfilter/nf_conntrack_proto_dccp.c +++ b/net/netfilter/nf_conntrack_proto_dccp.c | |||
@@ -969,6 +969,10 @@ static int __init nf_conntrack_proto_dccp_init(void) | |||
969 | { | 969 | { |
970 | int ret; | 970 | int ret; |
971 | 971 | ||
972 | ret = register_pernet_subsys(&dccp_net_ops); | ||
973 | if (ret < 0) | ||
974 | goto out_pernet; | ||
975 | |||
972 | ret = nf_ct_l4proto_register(&dccp_proto4); | 976 | ret = nf_ct_l4proto_register(&dccp_proto4); |
973 | if (ret < 0) | 977 | if (ret < 0) |
974 | goto out_dccp4; | 978 | goto out_dccp4; |
@@ -977,16 +981,12 @@ static int __init nf_conntrack_proto_dccp_init(void) | |||
977 | if (ret < 0) | 981 | if (ret < 0) |
978 | goto out_dccp6; | 982 | goto out_dccp6; |
979 | 983 | ||
980 | ret = register_pernet_subsys(&dccp_net_ops); | ||
981 | if (ret < 0) | ||
982 | goto out_pernet; | ||
983 | |||
984 | return 0; | 984 | return 0; |
985 | out_pernet: | ||
986 | nf_ct_l4proto_unregister(&dccp_proto6); | ||
987 | out_dccp6: | 985 | out_dccp6: |
988 | nf_ct_l4proto_unregister(&dccp_proto4); | 986 | nf_ct_l4proto_unregister(&dccp_proto4); |
989 | out_dccp4: | 987 | out_dccp4: |
988 | unregister_pernet_subsys(&dccp_net_ops); | ||
989 | out_pernet: | ||
990 | return ret; | 990 | return ret; |
991 | } | 991 | } |
992 | 992 | ||
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index bd7d01d9c7e7..155ce9f8a0db 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
@@ -420,18 +420,18 @@ static int __init nf_ct_proto_gre_init(void) | |||
420 | { | 420 | { |
421 | int ret; | 421 | int ret; |
422 | 422 | ||
423 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_gre4); | ||
424 | if (ret < 0) | ||
425 | goto out_gre4; | ||
426 | |||
427 | ret = register_pernet_subsys(&proto_gre_net_ops); | 423 | ret = register_pernet_subsys(&proto_gre_net_ops); |
428 | if (ret < 0) | 424 | if (ret < 0) |
429 | goto out_pernet; | 425 | goto out_pernet; |
430 | 426 | ||
427 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_gre4); | ||
428 | if (ret < 0) | ||
429 | goto out_gre4; | ||
430 | |||
431 | return 0; | 431 | return 0; |
432 | out_pernet: | ||
433 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_gre4); | ||
434 | out_gre4: | 432 | out_gre4: |
433 | unregister_pernet_subsys(&proto_gre_net_ops); | ||
434 | out_pernet: | ||
435 | return ret; | 435 | return ret; |
436 | } | 436 | } |
437 | 437 | ||
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index 480f616d5936..ec83536def9a 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -888,6 +888,10 @@ static int __init nf_conntrack_proto_sctp_init(void) | |||
888 | { | 888 | { |
889 | int ret; | 889 | int ret; |
890 | 890 | ||
891 | ret = register_pernet_subsys(&sctp_net_ops); | ||
892 | if (ret < 0) | ||
893 | goto out_pernet; | ||
894 | |||
891 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_sctp4); | 895 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_sctp4); |
892 | if (ret < 0) | 896 | if (ret < 0) |
893 | goto out_sctp4; | 897 | goto out_sctp4; |
@@ -896,16 +900,12 @@ static int __init nf_conntrack_proto_sctp_init(void) | |||
896 | if (ret < 0) | 900 | if (ret < 0) |
897 | goto out_sctp6; | 901 | goto out_sctp6; |
898 | 902 | ||
899 | ret = register_pernet_subsys(&sctp_net_ops); | ||
900 | if (ret < 0) | ||
901 | goto out_pernet; | ||
902 | |||
903 | return 0; | 903 | return 0; |
904 | out_pernet: | ||
905 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_sctp6); | ||
906 | out_sctp6: | 904 | out_sctp6: |
907 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_sctp4); | 905 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_sctp4); |
908 | out_sctp4: | 906 | out_sctp4: |
907 | unregister_pernet_subsys(&sctp_net_ops); | ||
908 | out_pernet: | ||
909 | return ret; | 909 | return ret; |
910 | } | 910 | } |
911 | 911 | ||
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c index 157489581c31..ca969f6273f7 100644 --- a/net/netfilter/nf_conntrack_proto_udplite.c +++ b/net/netfilter/nf_conntrack_proto_udplite.c | |||
@@ -371,6 +371,10 @@ static int __init nf_conntrack_proto_udplite_init(void) | |||
371 | { | 371 | { |
372 | int ret; | 372 | int ret; |
373 | 373 | ||
374 | ret = register_pernet_subsys(&udplite_net_ops); | ||
375 | if (ret < 0) | ||
376 | goto out_pernet; | ||
377 | |||
374 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_udplite4); | 378 | ret = nf_ct_l4proto_register(&nf_conntrack_l4proto_udplite4); |
375 | if (ret < 0) | 379 | if (ret < 0) |
376 | goto out_udplite4; | 380 | goto out_udplite4; |
@@ -379,16 +383,12 @@ static int __init nf_conntrack_proto_udplite_init(void) | |||
379 | if (ret < 0) | 383 | if (ret < 0) |
380 | goto out_udplite6; | 384 | goto out_udplite6; |
381 | 385 | ||
382 | ret = register_pernet_subsys(&udplite_net_ops); | ||
383 | if (ret < 0) | ||
384 | goto out_pernet; | ||
385 | |||
386 | return 0; | 386 | return 0; |
387 | out_pernet: | ||
388 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udplite6); | ||
389 | out_udplite6: | 387 | out_udplite6: |
390 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udplite4); | 388 | nf_ct_l4proto_unregister(&nf_conntrack_l4proto_udplite4); |
391 | out_udplite4: | 389 | out_udplite4: |
390 | unregister_pernet_subsys(&udplite_net_ops); | ||
391 | out_pernet: | ||
392 | return ret; | 392 | return ret; |
393 | } | 393 | } |
394 | 394 | ||
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 858fd52c1040..1cb48540f86a 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -112,7 +112,7 @@ instance_create(u_int16_t queue_num, int portid) | |||
112 | inst->queue_num = queue_num; | 112 | inst->queue_num = queue_num; |
113 | inst->peer_portid = portid; | 113 | inst->peer_portid = portid; |
114 | inst->queue_maxlen = NFQNL_QMAX_DEFAULT; | 114 | inst->queue_maxlen = NFQNL_QMAX_DEFAULT; |
115 | inst->copy_range = 0xfffff; | 115 | inst->copy_range = 0xffff; |
116 | inst->copy_mode = NFQNL_COPY_NONE; | 116 | inst->copy_mode = NFQNL_COPY_NONE; |
117 | spin_lock_init(&inst->lock); | 117 | spin_lock_init(&inst->lock); |
118 | INIT_LIST_HEAD(&inst->queue_list); | 118 | INIT_LIST_HEAD(&inst->queue_list); |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index f2aabb6f4105..5a55be3f17a5 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -142,6 +142,7 @@ int genl_register_mc_group(struct genl_family *family, | |||
142 | int err = 0; | 142 | int err = 0; |
143 | 143 | ||
144 | BUG_ON(grp->name[0] == '\0'); | 144 | BUG_ON(grp->name[0] == '\0'); |
145 | BUG_ON(memchr(grp->name, '\0', GENL_NAMSIZ) == NULL); | ||
145 | 146 | ||
146 | genl_lock(); | 147 | genl_lock(); |
147 | 148 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 51be64f163ec..971282b6f6a3 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -382,7 +382,7 @@ static void unix_sock_destructor(struct sock *sk) | |||
382 | #endif | 382 | #endif |
383 | } | 383 | } |
384 | 384 | ||
385 | static int unix_release_sock(struct sock *sk, int embrion) | 385 | static void unix_release_sock(struct sock *sk, int embrion) |
386 | { | 386 | { |
387 | struct unix_sock *u = unix_sk(sk); | 387 | struct unix_sock *u = unix_sk(sk); |
388 | struct path path; | 388 | struct path path; |
@@ -451,8 +451,6 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
451 | 451 | ||
452 | if (unix_tot_inflight) | 452 | if (unix_tot_inflight) |
453 | unix_gc(); /* Garbage collect fds */ | 453 | unix_gc(); /* Garbage collect fds */ |
454 | |||
455 | return 0; | ||
456 | } | 454 | } |
457 | 455 | ||
458 | static void init_peercred(struct sock *sk) | 456 | static void init_peercred(struct sock *sk) |
@@ -699,9 +697,10 @@ static int unix_release(struct socket *sock) | |||
699 | if (!sk) | 697 | if (!sk) |
700 | return 0; | 698 | return 0; |
701 | 699 | ||
700 | unix_release_sock(sk, 0); | ||
702 | sock->sk = NULL; | 701 | sock->sk = NULL; |
703 | 702 | ||
704 | return unix_release_sock(sk, 0); | 703 | return 0; |
705 | } | 704 | } |
706 | 705 | ||
707 | static int unix_autobind(struct socket *sock) | 706 | static int unix_autobind(struct socket *sock) |
@@ -1413,8 +1412,8 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock, | |||
1413 | if (UNIXCB(skb).cred) | 1412 | if (UNIXCB(skb).cred) |
1414 | return; | 1413 | return; |
1415 | if (test_bit(SOCK_PASSCRED, &sock->flags) || | 1414 | if (test_bit(SOCK_PASSCRED, &sock->flags) || |
1416 | !other->sk_socket || | 1415 | (other->sk_socket && |
1417 | test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) { | 1416 | test_bit(SOCK_PASSCRED, &other->sk_socket->flags))) { |
1418 | UNIXCB(skb).pid = get_pid(task_tgid(current)); | 1417 | UNIXCB(skb).pid = get_pid(task_tgid(current)); |
1419 | UNIXCB(skb).cred = get_current_cred(); | 1418 | UNIXCB(skb).cred = get_current_cred(); |
1420 | } | 1419 | } |