summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-07 12:29:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-07 12:29:14 -0400
commit1e1d926369545ea09c98c6c7f5d109aa4ee0cd0b (patch)
tree8ece321f1b8950da023642da4b5167ccceb86862
parent6e38335dcc70f03faba26bf1260ee024d930afe1 (diff)
parent720f1de4021f09898b8c8443f3b3e995991b6e3a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Free AF_PACKET po->rollover properly, from Willem de Bruijn. 2) Read SFP eeprom in max 16 byte increments to avoid problems with some SFP modules, from Russell King. 3) Fix UDP socket lookup wrt. VRF, from Tim Beale. 4) Handle route invalidation properly in s390 qeth driver, from Julian Wiedmann. 5) Memory leak on unload in RDS, from Zhu Yanjun. 6) sctp_process_init leak, from Neil HOrman. 7) Fix fib_rules rule insertion semantic change that broke Android, from Hangbin Liu. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (33 commits) pktgen: do not sleep with the thread lock held. net: mvpp2: Use strscpy to handle stat strings net: rds: fix memory leak in rds_ib_flush_mr_pool ipv6: fix EFAULT on sendto with icmpv6 and hdrincl ipv6: use READ_ONCE() for inet->hdrincl as in ipv4 Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied" net: aquantia: fix wol configuration not applied sometimes ethtool: fix potential userspace buffer overflow Fix memory leak in sctp_process_init net: rds: fix memory leak when unload rds_rdma ipv6: fix the check before getting the cookie in rt6_get_cookie ipv4: not do cache for local delivery if bc_forwarding is enabled s390/qeth: handle error when updating TX queue count s390/qeth: fix VLAN attribute in bridge_hostnotify udev event s390/qeth: check dst entry before use s390/qeth: handle limited IPv4 broadcast in L3 TX path net: fix indirect calls helpers for ptype list hooks. net: ipvlan: Fix ipvlan device tso disabled while NETIF_F_IP_CSUM is set udp: only choose unbound UDP socket for multicast when not in a VRF net/tls: replace the sleeping lock around RX resync with a bit lock ...
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c2
-rw-r--r--drivers/net/dsa/sja1105/sja1105_main.c32
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c14
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c4
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ethtool.c4
-rw-r--r--drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c4
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c15
-rw-r--r--drivers/net/ethernet/ti/cpsw_ethtool.c2
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c2
-rw-r--r--drivers/net/phy/phylink.c13
-rw-r--r--drivers/net/phy/sfp.c24
-rw-r--r--drivers/s390/net/qeth_core_main.c22
-rw-r--r--drivers/s390/net/qeth_l2_main.c2
-rw-r--r--drivers/s390/net/qeth_l3_main.c32
-rw-r--r--include/linux/dsa/sja1105.h12
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/tls.h4
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/ethtool.c5
-rw-r--r--net/core/fib_rules.c6
-rw-r--r--net/core/pktgen.c11
-rw-r--r--net/dsa/tag_sja1105.c10
-rw-r--r--net/ipv4/route.c24
-rw-r--r--net/ipv4/udp.c3
-rw-r--r--net/ipv6/raw.c25
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rds/ib.c2
-rw-r--r--net/rds/ib_rdma.c10
-rw-r--r--net/rds/ib_recv.c3
-rw-r--r--net/sctp/sm_make_chunk.c13
-rw-r--r--net/sctp/sm_sideeffect.c5
-rw-r--r--net/tls/tls_device.c26
-rwxr-xr-xtools/testing/selftests/net/forwarding/router_broadcast.sh5
34 files changed, 218 insertions, 131 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index a6954776a37e..36a84614d6c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17312,7 +17312,7 @@ F: Documentation/ABI/stable/sysfs-hypervisor-xen
17312F: Documentation/ABI/testing/sysfs-hypervisor-xen 17312F: Documentation/ABI/testing/sysfs-hypervisor-xen
17313 17313
17314XEN NETWORK BACKEND DRIVER 17314XEN NETWORK BACKEND DRIVER
17315M: Wei Liu <wei.liu2@citrix.com> 17315M: Wei Liu <wei.liu@kernel.org>
17316M: Paul Durrant <paul.durrant@citrix.com> 17316M: Paul Durrant <paul.durrant@citrix.com>
17317L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 17317L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
17318L: netdev@vger.kernel.org 17318L: netdev@vger.kernel.org
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 42da3f1bff5b..063c7a671b41 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1388,7 +1388,7 @@ static int mv88e6xxx_vtu_get(struct mv88e6xxx_chip *chip, u16 vid,
1388 int err; 1388 int err;
1389 1389
1390 if (!vid) 1390 if (!vid)
1391 return -EINVAL; 1391 return -EOPNOTSUPP;
1392 1392
1393 entry->vid = vid - 1; 1393 entry->vid = vid - 1;
1394 entry->valid = false; 1394 entry->valid = false;
diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 0663b78a2f6c..1c3959efebc4 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -652,16 +652,6 @@ static int sja1105_speed[] = {
652 [SJA1105_SPEED_1000MBPS] = 1000, 652 [SJA1105_SPEED_1000MBPS] = 1000,
653}; 653};
654 654
655static sja1105_speed_t sja1105_get_speed_cfg(unsigned int speed_mbps)
656{
657 int i;
658
659 for (i = SJA1105_SPEED_AUTO; i <= SJA1105_SPEED_1000MBPS; i++)
660 if (sja1105_speed[i] == speed_mbps)
661 return i;
662 return -EINVAL;
663}
664
665/* Set link speed and enable/disable traffic I/O in the MAC configuration 655/* Set link speed and enable/disable traffic I/O in the MAC configuration
666 * for a specific port. 656 * for a specific port.
667 * 657 *
@@ -684,8 +674,21 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port,
684 mii = priv->static_config.tables[BLK_IDX_XMII_PARAMS].entries; 674 mii = priv->static_config.tables[BLK_IDX_XMII_PARAMS].entries;
685 mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries; 675 mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
686 676
687 speed = sja1105_get_speed_cfg(speed_mbps); 677 switch (speed_mbps) {
688 if (speed_mbps && speed < 0) { 678 case 0:
679 /* No speed update requested */
680 speed = SJA1105_SPEED_AUTO;
681 break;
682 case 10:
683 speed = SJA1105_SPEED_10MBPS;
684 break;
685 case 100:
686 speed = SJA1105_SPEED_100MBPS;
687 break;
688 case 1000:
689 speed = SJA1105_SPEED_1000MBPS;
690 break;
691 default:
689 dev_err(dev, "Invalid speed %iMbps\n", speed_mbps); 692 dev_err(dev, "Invalid speed %iMbps\n", speed_mbps);
690 return -EINVAL; 693 return -EINVAL;
691 } 694 }
@@ -695,10 +698,7 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port,
695 * and we no longer need to store it in the static config (already told 698 * and we no longer need to store it in the static config (already told
696 * hardware we want auto during upload phase). 699 * hardware we want auto during upload phase).
697 */ 700 */
698 if (speed_mbps) 701 mac[port].speed = speed;
699 mac[port].speed = speed;
700 else
701 mac[port].speed = SJA1105_SPEED_AUTO;
702 702
703 /* On P/Q/R/S, one can read from the device via the MAC reconfiguration 703 /* On P/Q/R/S, one can read from the device via the MAC reconfiguration
704 * tables. On E/T, MAC reconfig tables are not readable, only writable. 704 * tables. On E/T, MAC reconfig tables are not readable, only writable.
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 1208f7ecdd76..3fc41da39a0a 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -335,13 +335,13 @@ static int hw_atl_utils_fw_upload_dwords(struct aq_hw_s *self, u32 a, u32 *p,
335{ 335{
336 u32 val; 336 u32 val;
337 int err = 0; 337 int err = 0;
338 bool is_locked;
339 338
340 is_locked = hw_atl_sem_ram_get(self); 339 err = readx_poll_timeout_atomic(hw_atl_sem_ram_get, self,
341 if (!is_locked) { 340 val, val == 1U,
342 err = -ETIME; 341 10U, 100000U);
342 if (err < 0)
343 goto err_exit; 343 goto err_exit;
344 } 344
345 if (IS_CHIP_FEATURE(REVISION_B1)) { 345 if (IS_CHIP_FEATURE(REVISION_B1)) {
346 u32 offset = 0; 346 u32 offset = 0;
347 347
@@ -353,8 +353,8 @@ static int hw_atl_utils_fw_upload_dwords(struct aq_hw_s *self, u32 a, u32 *p,
353 /* 1000 times by 10us = 10ms */ 353 /* 1000 times by 10us = 10ms */
354 err = readx_poll_timeout_atomic(hw_atl_scrpad12_get, 354 err = readx_poll_timeout_atomic(hw_atl_scrpad12_get,
355 self, val, 355 self, val,
356 (val & 0xF0000000) == 356 (val & 0xF0000000) !=
357 0x80000000, 357 0x80000000,
358 10U, 10000U); 358 10U, 10000U);
359 } 359 }
360 } else { 360 } else {
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
index fbc9d6ac841f..9c16d85fb104 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
@@ -384,7 +384,7 @@ static int aq_fw2x_set_sleep_proxy(struct aq_hw_s *self, u8 *mac)
384 err = readx_poll_timeout_atomic(aq_fw2x_state2_get, 384 err = readx_poll_timeout_atomic(aq_fw2x_state2_get,
385 self, val, 385 self, val,
386 val & HW_ATL_FW2X_CTRL_SLEEP_PROXY, 386 val & HW_ATL_FW2X_CTRL_SLEEP_PROXY,
387 1U, 10000U); 387 1U, 100000U);
388 388
389err_exit: 389err_exit:
390 return err; 390 return err;
@@ -404,6 +404,8 @@ static int aq_fw2x_set_wol_params(struct aq_hw_s *self, u8 *mac)
404 404
405 msg = (struct fw2x_msg_wol *)rpc; 405 msg = (struct fw2x_msg_wol *)rpc;
406 406
407 memset(msg, 0, sizeof(*msg));
408
407 msg->msg_id = HAL_ATLANTIC_UTILS_FW2X_MSG_WOL; 409 msg->msg_id = HAL_ATLANTIC_UTILS_FW2X_MSG_WOL;
408 msg->magic_packet_enabled = true; 410 msg->magic_packet_enabled = true;
409 memcpy(msg->hw_addr, mac, ETH_ALEN); 411 memcpy(msg->hw_addr, mac, ETH_ALEN);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index d1df0a44f93c..717fccc2efba 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -335,6 +335,7 @@ static int __lb_setup(struct net_device *ndev,
335static int __lb_up(struct net_device *ndev, 335static int __lb_up(struct net_device *ndev,
336 enum hnae_loop loop_mode) 336 enum hnae_loop loop_mode)
337{ 337{
338#define NIC_LB_TEST_WAIT_PHY_LINK_TIME 300
338 struct hns_nic_priv *priv = netdev_priv(ndev); 339 struct hns_nic_priv *priv = netdev_priv(ndev);
339 struct hnae_handle *h = priv->ae_handle; 340 struct hnae_handle *h = priv->ae_handle;
340 int speed, duplex; 341 int speed, duplex;
@@ -361,6 +362,9 @@ static int __lb_up(struct net_device *ndev,
361 362
362 h->dev->ops->adjust_link(h, speed, duplex); 363 h->dev->ops->adjust_link(h, speed, duplex);
363 364
365 /* wait adjust link done and phy ready */
366 msleep(NIC_LB_TEST_WAIT_PHY_LINK_TIME);
367
364 return 0; 368 return 0;
365} 369}
366 370
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 7a67e23a2c2b..d8e5241097a9 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1304,8 +1304,8 @@ static void mvpp2_ethtool_get_strings(struct net_device *netdev, u32 sset,
1304 int i; 1304 int i;
1305 1305
1306 for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++) 1306 for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++)
1307 memcpy(data + i * ETH_GSTRING_LEN, 1307 strscpy(data + i * ETH_GSTRING_LEN,
1308 &mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN); 1308 mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN);
1309 } 1309 }
1310} 1310}
1311 1311
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index f9fbb3ffa3a6..765cd56ebcd2 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1778,6 +1778,7 @@ static void mtk_poll_controller(struct net_device *dev)
1778 1778
1779static int mtk_start_dma(struct mtk_eth *eth) 1779static int mtk_start_dma(struct mtk_eth *eth)
1780{ 1780{
1781 u32 rx_2b_offset = (NET_IP_ALIGN == 2) ? MTK_RX_2B_OFFSET : 0;
1781 int err; 1782 int err;
1782 1783
1783 err = mtk_dma_init(eth); 1784 err = mtk_dma_init(eth);
@@ -1794,7 +1795,7 @@ static int mtk_start_dma(struct mtk_eth *eth)
1794 MTK_QDMA_GLO_CFG); 1795 MTK_QDMA_GLO_CFG);
1795 1796
1796 mtk_w32(eth, 1797 mtk_w32(eth,
1797 MTK_RX_DMA_EN | MTK_RX_2B_OFFSET | 1798 MTK_RX_DMA_EN | rx_2b_offset |
1798 MTK_RX_BT_32DWORDS | MTK_MULTI_EN, 1799 MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
1799 MTK_PDMA_GLO_CFG); 1800 MTK_PDMA_GLO_CFG);
1800 1801
@@ -2298,13 +2299,13 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
2298 2299
2299 switch (cmd->cmd) { 2300 switch (cmd->cmd) {
2300 case ETHTOOL_GRXRINGS: 2301 case ETHTOOL_GRXRINGS:
2301 if (dev->features & NETIF_F_LRO) { 2302 if (dev->hw_features & NETIF_F_LRO) {
2302 cmd->data = MTK_MAX_RX_RING_NUM; 2303 cmd->data = MTK_MAX_RX_RING_NUM;
2303 ret = 0; 2304 ret = 0;
2304 } 2305 }
2305 break; 2306 break;
2306 case ETHTOOL_GRXCLSRLCNT: 2307 case ETHTOOL_GRXCLSRLCNT:
2307 if (dev->features & NETIF_F_LRO) { 2308 if (dev->hw_features & NETIF_F_LRO) {
2308 struct mtk_mac *mac = netdev_priv(dev); 2309 struct mtk_mac *mac = netdev_priv(dev);
2309 2310
2310 cmd->rule_cnt = mac->hwlro_ip_cnt; 2311 cmd->rule_cnt = mac->hwlro_ip_cnt;
@@ -2312,11 +2313,11 @@ static int mtk_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
2312 } 2313 }
2313 break; 2314 break;
2314 case ETHTOOL_GRXCLSRULE: 2315 case ETHTOOL_GRXCLSRULE:
2315 if (dev->features & NETIF_F_LRO) 2316 if (dev->hw_features & NETIF_F_LRO)
2316 ret = mtk_hwlro_get_fdir_entry(dev, cmd); 2317 ret = mtk_hwlro_get_fdir_entry(dev, cmd);
2317 break; 2318 break;
2318 case ETHTOOL_GRXCLSRLALL: 2319 case ETHTOOL_GRXCLSRLALL:
2319 if (dev->features & NETIF_F_LRO) 2320 if (dev->hw_features & NETIF_F_LRO)
2320 ret = mtk_hwlro_get_fdir_all(dev, cmd, 2321 ret = mtk_hwlro_get_fdir_all(dev, cmd,
2321 rule_locs); 2322 rule_locs);
2322 break; 2323 break;
@@ -2333,11 +2334,11 @@ static int mtk_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
2333 2334
2334 switch (cmd->cmd) { 2335 switch (cmd->cmd) {
2335 case ETHTOOL_SRXCLSRLINS: 2336 case ETHTOOL_SRXCLSRLINS:
2336 if (dev->features & NETIF_F_LRO) 2337 if (dev->hw_features & NETIF_F_LRO)
2337 ret = mtk_hwlro_add_ipaddr(dev, cmd); 2338 ret = mtk_hwlro_add_ipaddr(dev, cmd);
2338 break; 2339 break;
2339 case ETHTOOL_SRXCLSRLDEL: 2340 case ETHTOOL_SRXCLSRLDEL:
2340 if (dev->features & NETIF_F_LRO) 2341 if (dev->hw_features & NETIF_F_LRO)
2341 ret = mtk_hwlro_del_ipaddr(dev, cmd); 2342 ret = mtk_hwlro_del_ipaddr(dev, cmd);
2342 break; 2343 break;
2343 default: 2344 default:
diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c
index a4a7ec0d2531..6d1c9ebae7cc 100644
--- a/drivers/net/ethernet/ti/cpsw_ethtool.c
+++ b/drivers/net/ethernet/ti/cpsw_ethtool.c
@@ -643,7 +643,7 @@ void cpsw_get_ringparam(struct net_device *ndev,
643 struct cpsw_common *cpsw = priv->cpsw; 643 struct cpsw_common *cpsw = priv->cpsw;
644 644
645 /* not supported */ 645 /* not supported */
646 ering->tx_max_pending = 0; 646 ering->tx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
647 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma); 647 ering->tx_pending = cpdma_get_num_tx_descs(cpsw->dma);
648 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES; 648 ering->rx_max_pending = cpsw->descs_pool_size - CPSW_MAX_QUEUES;
649 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma); 649 ering->rx_pending = cpdma_get_num_rx_descs(cpsw->dma);
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index cf38c392b9b6..1c96bed5a7c4 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -107,7 +107,7 @@ static void ipvlan_port_destroy(struct net_device *dev)
107} 107}
108 108
109#define IPVLAN_FEATURES \ 109#define IPVLAN_FEATURES \
110 (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ 110 (NETIF_F_SG | NETIF_F_CSUM_MASK | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
111 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_GSO_ROBUST | \ 111 NETIF_F_GSO | NETIF_F_TSO | NETIF_F_GSO_ROBUST | \
112 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \ 112 NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
113 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER) 113 NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 9044b95d2afe..4c0616ba314d 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1073,6 +1073,7 @@ EXPORT_SYMBOL_GPL(phylink_ethtool_ksettings_get);
1073int phylink_ethtool_ksettings_set(struct phylink *pl, 1073int phylink_ethtool_ksettings_set(struct phylink *pl,
1074 const struct ethtool_link_ksettings *kset) 1074 const struct ethtool_link_ksettings *kset)
1075{ 1075{
1076 __ETHTOOL_DECLARE_LINK_MODE_MASK(support);
1076 struct ethtool_link_ksettings our_kset; 1077 struct ethtool_link_ksettings our_kset;
1077 struct phylink_link_state config; 1078 struct phylink_link_state config;
1078 int ret; 1079 int ret;
@@ -1083,11 +1084,12 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
1083 kset->base.autoneg != AUTONEG_ENABLE) 1084 kset->base.autoneg != AUTONEG_ENABLE)
1084 return -EINVAL; 1085 return -EINVAL;
1085 1086
1087 linkmode_copy(support, pl->supported);
1086 config = pl->link_config; 1088 config = pl->link_config;
1087 1089
1088 /* Mask out unsupported advertisements */ 1090 /* Mask out unsupported advertisements */
1089 linkmode_and(config.advertising, kset->link_modes.advertising, 1091 linkmode_and(config.advertising, kset->link_modes.advertising,
1090 pl->supported); 1092 support);
1091 1093
1092 /* FIXME: should we reject autoneg if phy/mac does not support it? */ 1094 /* FIXME: should we reject autoneg if phy/mac does not support it? */
1093 if (kset->base.autoneg == AUTONEG_DISABLE) { 1095 if (kset->base.autoneg == AUTONEG_DISABLE) {
@@ -1097,7 +1099,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
1097 * duplex. 1099 * duplex.
1098 */ 1100 */
1099 s = phy_lookup_setting(kset->base.speed, kset->base.duplex, 1101 s = phy_lookup_setting(kset->base.speed, kset->base.duplex,
1100 pl->supported, false); 1102 support, false);
1101 if (!s) 1103 if (!s)
1102 return -EINVAL; 1104 return -EINVAL;
1103 1105
@@ -1126,7 +1128,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
1126 __set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising); 1128 __set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, config.advertising);
1127 } 1129 }
1128 1130
1129 if (phylink_validate(pl, pl->supported, &config)) 1131 if (phylink_validate(pl, support, &config))
1130 return -EINVAL; 1132 return -EINVAL;
1131 1133
1132 /* If autonegotiation is enabled, we must have an advertisement */ 1134 /* If autonegotiation is enabled, we must have an advertisement */
@@ -1576,6 +1578,7 @@ static int phylink_sfp_module_insert(void *upstream,
1576{ 1578{
1577 struct phylink *pl = upstream; 1579 struct phylink *pl = upstream;
1578 __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, }; 1580 __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
1581 __ETHTOOL_DECLARE_LINK_MODE_MASK(support1);
1579 struct phylink_link_state config; 1582 struct phylink_link_state config;
1580 phy_interface_t iface; 1583 phy_interface_t iface;
1581 int ret = 0; 1584 int ret = 0;
@@ -1603,6 +1606,8 @@ static int phylink_sfp_module_insert(void *upstream,
1603 return ret; 1606 return ret;
1604 } 1607 }
1605 1608
1609 linkmode_copy(support1, support);
1610
1606 iface = sfp_select_interface(pl->sfp_bus, id, config.advertising); 1611 iface = sfp_select_interface(pl->sfp_bus, id, config.advertising);
1607 if (iface == PHY_INTERFACE_MODE_NA) { 1612 if (iface == PHY_INTERFACE_MODE_NA) {
1608 netdev_err(pl->netdev, 1613 netdev_err(pl->netdev,
@@ -1612,7 +1617,7 @@ static int phylink_sfp_module_insert(void *upstream,
1612 } 1617 }
1613 1618
1614 config.interface = iface; 1619 config.interface = iface;
1615 ret = phylink_validate(pl, support, &config); 1620 ret = phylink_validate(pl, support1, &config);
1616 if (ret) { 1621 if (ret) {
1617 netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n", 1622 netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n",
1618 phylink_an_mode_str(MLO_AN_INBAND), 1623 phylink_an_mode_str(MLO_AN_INBAND),
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index d4635c2178d1..71812be0ac64 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -281,6 +281,7 @@ static int sfp_i2c_read(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
281{ 281{
282 struct i2c_msg msgs[2]; 282 struct i2c_msg msgs[2];
283 u8 bus_addr = a2 ? 0x51 : 0x50; 283 u8 bus_addr = a2 ? 0x51 : 0x50;
284 size_t this_len;
284 int ret; 285 int ret;
285 286
286 msgs[0].addr = bus_addr; 287 msgs[0].addr = bus_addr;
@@ -292,11 +293,26 @@ static int sfp_i2c_read(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
292 msgs[1].len = len; 293 msgs[1].len = len;
293 msgs[1].buf = buf; 294 msgs[1].buf = buf;
294 295
295 ret = i2c_transfer(sfp->i2c, msgs, ARRAY_SIZE(msgs)); 296 while (len) {
296 if (ret < 0) 297 this_len = len;
297 return ret; 298 if (this_len > 16)
299 this_len = 16;
298 300
299 return ret == ARRAY_SIZE(msgs) ? len : 0; 301 msgs[1].len = this_len;
302
303 ret = i2c_transfer(sfp->i2c, msgs, ARRAY_SIZE(msgs));
304 if (ret < 0)
305 return ret;
306
307 if (ret != ARRAY_SIZE(msgs))
308 break;
309
310 msgs[1].buf += this_len;
311 dev_addr += this_len;
312 len -= this_len;
313 }
314
315 return msgs[1].buf - (u8 *)buf;
300} 316}
301 317
302static int sfp_i2c_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf, 318static int sfp_i2c_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 009f2c0ec504..b1823d75dd35 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -1274,16 +1274,20 @@ static int qeth_setup_channel(struct qeth_channel *channel, bool alloc_buffers)
1274 return 0; 1274 return 0;
1275} 1275}
1276 1276
1277static void qeth_osa_set_output_queues(struct qeth_card *card, bool single) 1277static int qeth_osa_set_output_queues(struct qeth_card *card, bool single)
1278{ 1278{
1279 unsigned int count = single ? 1 : card->dev->num_tx_queues; 1279 unsigned int count = single ? 1 : card->dev->num_tx_queues;
1280 int rc;
1280 1281
1281 rtnl_lock(); 1282 rtnl_lock();
1282 netif_set_real_num_tx_queues(card->dev, count); 1283 rc = netif_set_real_num_tx_queues(card->dev, count);
1283 rtnl_unlock(); 1284 rtnl_unlock();
1284 1285
1286 if (rc)
1287 return rc;
1288
1285 if (card->qdio.no_out_queues == count) 1289 if (card->qdio.no_out_queues == count)
1286 return; 1290 return 0;
1287 1291
1288 if (atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED) 1292 if (atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED)
1289 qeth_free_qdio_queues(card); 1293 qeth_free_qdio_queues(card);
@@ -1293,12 +1297,14 @@ static void qeth_osa_set_output_queues(struct qeth_card *card, bool single)
1293 1297
1294 card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE; 1298 card->qdio.default_out_queue = single ? 0 : QETH_DEFAULT_QUEUE;
1295 card->qdio.no_out_queues = count; 1299 card->qdio.no_out_queues = count;
1300 return 0;
1296} 1301}
1297 1302
1298static int qeth_update_from_chp_desc(struct qeth_card *card) 1303static int qeth_update_from_chp_desc(struct qeth_card *card)
1299{ 1304{
1300 struct ccw_device *ccwdev; 1305 struct ccw_device *ccwdev;
1301 struct channel_path_desc_fmt0 *chp_dsc; 1306 struct channel_path_desc_fmt0 *chp_dsc;
1307 int rc = 0;
1302 1308
1303 QETH_DBF_TEXT(SETUP, 2, "chp_desc"); 1309 QETH_DBF_TEXT(SETUP, 2, "chp_desc");
1304 1310
@@ -1311,12 +1317,12 @@ static int qeth_update_from_chp_desc(struct qeth_card *card)
1311 1317
1312 if (IS_OSD(card) || IS_OSX(card)) 1318 if (IS_OSD(card) || IS_OSX(card))
1313 /* CHPP field bit 6 == 1 -> single queue */ 1319 /* CHPP field bit 6 == 1 -> single queue */
1314 qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02); 1320 rc = qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02);
1315 1321
1316 kfree(chp_dsc); 1322 kfree(chp_dsc);
1317 QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues); 1323 QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues);
1318 QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level); 1324 QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level);
1319 return 0; 1325 return rc;
1320} 1326}
1321 1327
1322static void qeth_init_qdio_info(struct qeth_card *card) 1328static void qeth_init_qdio_info(struct qeth_card *card)
@@ -5597,8 +5603,12 @@ static struct net_device *qeth_alloc_netdev(struct qeth_card *card)
5597 dev->hw_features |= NETIF_F_SG; 5603 dev->hw_features |= NETIF_F_SG;
5598 dev->vlan_features |= NETIF_F_SG; 5604 dev->vlan_features |= NETIF_F_SG;
5599 if (IS_IQD(card)) { 5605 if (IS_IQD(card)) {
5600 netif_set_real_num_tx_queues(dev, QETH_IQD_MIN_TXQ);
5601 dev->features |= NETIF_F_SG; 5606 dev->features |= NETIF_F_SG;
5607 if (netif_set_real_num_tx_queues(dev,
5608 QETH_IQD_MIN_TXQ)) {
5609 free_netdev(dev);
5610 return NULL;
5611 }
5602 } 5612 }
5603 } 5613 }
5604 5614
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 218801232ca2..ff8a6cd790b1 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1680,7 +1680,7 @@ static void qeth_bridgeport_an_set_cb(void *priv,
1680 1680
1681 l2entry = (struct qdio_brinfo_entry_l2 *)entry; 1681 l2entry = (struct qdio_brinfo_entry_l2 *)entry;
1682 code = IPA_ADDR_CHANGE_CODE_MACADDR; 1682 code = IPA_ADDR_CHANGE_CODE_MACADDR;
1683 if (l2entry->addr_lnid.lnid) 1683 if (l2entry->addr_lnid.lnid < VLAN_N_VID)
1684 code |= IPA_ADDR_CHANGE_CODE_VLANID; 1684 code |= IPA_ADDR_CHANGE_CODE_VLANID;
1685 qeth_bridge_emit_host_event(card, anev_reg_unreg, code, 1685 qeth_bridge_emit_host_event(card, anev_reg_unreg, code,
1686 (struct net_if_token *)&l2entry->nit, 1686 (struct net_if_token *)&l2entry->nit,
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 0271833da6a2..13bf3e2e9cea 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1888,13 +1888,20 @@ static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1888 1888
1889static int qeth_l3_get_cast_type(struct sk_buff *skb) 1889static int qeth_l3_get_cast_type(struct sk_buff *skb)
1890{ 1890{
1891 int ipv = qeth_get_ip_version(skb);
1891 struct neighbour *n = NULL; 1892 struct neighbour *n = NULL;
1892 struct dst_entry *dst; 1893 struct dst_entry *dst;
1893 1894
1894 rcu_read_lock(); 1895 rcu_read_lock();
1895 dst = skb_dst(skb); 1896 dst = skb_dst(skb);
1896 if (dst) 1897 if (dst) {
1897 n = dst_neigh_lookup_skb(dst, skb); 1898 struct rt6_info *rt = (struct rt6_info *) dst;
1899
1900 dst = dst_check(dst, (ipv == 6) ? rt6_get_cookie(rt) : 0);
1901 if (dst)
1902 n = dst_neigh_lookup_skb(dst, skb);
1903 }
1904
1898 if (n) { 1905 if (n) {
1899 int cast_type = n->type; 1906 int cast_type = n->type;
1900 1907
@@ -1909,8 +1916,10 @@ static int qeth_l3_get_cast_type(struct sk_buff *skb)
1909 rcu_read_unlock(); 1916 rcu_read_unlock();
1910 1917
1911 /* no neighbour (eg AF_PACKET), fall back to target's IP address ... */ 1918 /* no neighbour (eg AF_PACKET), fall back to target's IP address ... */
1912 switch (qeth_get_ip_version(skb)) { 1919 switch (ipv) {
1913 case 4: 1920 case 4:
1921 if (ipv4_is_lbcast(ip_hdr(skb)->daddr))
1922 return RTN_BROADCAST;
1914 return ipv4_is_multicast(ip_hdr(skb)->daddr) ? 1923 return ipv4_is_multicast(ip_hdr(skb)->daddr) ?
1915 RTN_MULTICAST : RTN_UNICAST; 1924 RTN_MULTICAST : RTN_UNICAST;
1916 case 6: 1925 case 6:
@@ -1940,6 +1949,7 @@ static void qeth_l3_fill_header(struct qeth_qdio_out_q *queue,
1940 struct qeth_hdr_layer3 *l3_hdr = &hdr->hdr.l3; 1949 struct qeth_hdr_layer3 *l3_hdr = &hdr->hdr.l3;
1941 struct vlan_ethhdr *veth = vlan_eth_hdr(skb); 1950 struct vlan_ethhdr *veth = vlan_eth_hdr(skb);
1942 struct qeth_card *card = queue->card; 1951 struct qeth_card *card = queue->card;
1952 struct dst_entry *dst;
1943 1953
1944 hdr->hdr.l3.length = data_len; 1954 hdr->hdr.l3.length = data_len;
1945 1955
@@ -1985,15 +1995,27 @@ static void qeth_l3_fill_header(struct qeth_qdio_out_q *queue,
1985 } 1995 }
1986 1996
1987 rcu_read_lock(); 1997 rcu_read_lock();
1998 dst = skb_dst(skb);
1999
1988 if (ipv == 4) { 2000 if (ipv == 4) {
1989 struct rtable *rt = skb_rtable(skb); 2001 struct rtable *rt;
2002
2003 if (dst)
2004 dst = dst_check(dst, 0);
2005 rt = (struct rtable *) dst;
1990 2006
1991 *((__be32 *) &hdr->hdr.l3.next_hop.ipv4.addr) = (rt) ? 2007 *((__be32 *) &hdr->hdr.l3.next_hop.ipv4.addr) = (rt) ?
1992 rt_nexthop(rt, ip_hdr(skb)->daddr) : 2008 rt_nexthop(rt, ip_hdr(skb)->daddr) :
1993 ip_hdr(skb)->daddr; 2009 ip_hdr(skb)->daddr;
1994 } else { 2010 } else {
1995 /* IPv6 */ 2011 /* IPv6 */
1996 const struct rt6_info *rt = skb_rt6_info(skb); 2012 struct rt6_info *rt;
2013
2014 if (dst) {
2015 rt = (struct rt6_info *) dst;
2016 dst = dst_check(dst, rt6_get_cookie(rt));
2017 }
2018 rt = (struct rt6_info *) dst;
1997 2019
1998 if (rt && !ipv6_addr_any(&rt->rt6i_gateway)) 2020 if (rt && !ipv6_addr_any(&rt->rt6i_gateway))
1999 l3_hdr->next_hop.ipv6_addr = rt->rt6i_gateway; 2021 l3_hdr->next_hop.ipv6_addr = rt->rt6i_gateway;
diff --git a/include/linux/dsa/sja1105.h b/include/linux/dsa/sja1105.h
index 603a02e5a8cb..e46e18c47d41 100644
--- a/include/linux/dsa/sja1105.h
+++ b/include/linux/dsa/sja1105.h
@@ -20,18 +20,6 @@
20#define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull 20#define SJA1105_LINKLOCAL_FILTER_B 0x011B19000000ull
21#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull 21#define SJA1105_LINKLOCAL_FILTER_B_MASK 0xFFFFFF000000ull
22 22
23enum sja1105_frame_type {
24 SJA1105_FRAME_TYPE_NORMAL = 0,
25 SJA1105_FRAME_TYPE_LINK_LOCAL,
26};
27
28struct sja1105_skb_cb {
29 enum sja1105_frame_type type;
30};
31
32#define SJA1105_SKB_CB(skb) \
33 ((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb))
34
35struct sja1105_port { 23struct sja1105_port {
36 struct dsa_port *dp; 24 struct dsa_port *dp;
37 int mgmt_slot; 25 int mgmt_slot;
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 3fbc9894a39a..855b352b660f 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -259,8 +259,7 @@ static inline u32 rt6_get_cookie(const struct rt6_info *rt)
259 rcu_read_lock(); 259 rcu_read_lock();
260 260
261 from = rcu_dereference(rt->from); 261 from = rcu_dereference(rt->from);
262 if (from && (rt->rt6i_flags & RTF_PCPU || 262 if (from)
263 unlikely(!list_empty(&rt->rt6i_uncached))))
264 fib6_get_cookie_safe(from, &cookie); 263 fib6_get_cookie_safe(from, &cookie);
265 264
266 rcu_read_unlock(); 265 rcu_read_unlock();
diff --git a/include/net/tls.h b/include/net/tls.h
index 39ea62f0c1f6..4a55ce6a303f 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -209,6 +209,10 @@ struct tls_offload_context_tx {
209 (ALIGN(sizeof(struct tls_offload_context_tx), sizeof(void *)) + \ 209 (ALIGN(sizeof(struct tls_offload_context_tx), sizeof(void *)) + \
210 TLS_DRIVER_STATE_SIZE) 210 TLS_DRIVER_STATE_SIZE)
211 211
212enum tls_context_flags {
213 TLS_RX_SYNC_RUNNING = 0,
214};
215
212struct cipher_context { 216struct cipher_context {
213 char *iv; 217 char *iv;
214 char *rec_seq; 218 char *rec_seq;
diff --git a/net/core/dev.c b/net/core/dev.c
index 140858d4a048..eb7fb6daa1ef 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5021,12 +5021,12 @@ static inline void __netif_receive_skb_list_ptype(struct list_head *head,
5021 if (list_empty(head)) 5021 if (list_empty(head))
5022 return; 5022 return;
5023 if (pt_prev->list_func != NULL) 5023 if (pt_prev->list_func != NULL)
5024 pt_prev->list_func(head, pt_prev, orig_dev); 5024 INDIRECT_CALL_INET(pt_prev->list_func, ipv6_list_rcv,
5025 ip_list_rcv, head, pt_prev, orig_dev);
5025 else 5026 else
5026 list_for_each_entry_safe(skb, next, head, list) { 5027 list_for_each_entry_safe(skb, next, head, list) {
5027 skb_list_del_init(skb); 5028 skb_list_del_init(skb);
5028 INDIRECT_CALL_INET(pt_prev->func, ipv6_rcv, ip_rcv, skb, 5029 pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
5029 skb->dev, pt_prev, orig_dev);
5030 } 5030 }
5031} 5031}
5032 5032
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 6dadeff8d39a..d08b1e19ce9c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1355,13 +1355,16 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
1355 if (!regbuf) 1355 if (!regbuf)
1356 return -ENOMEM; 1356 return -ENOMEM;
1357 1357
1358 if (regs.len < reglen)
1359 reglen = regs.len;
1360
1358 ops->get_regs(dev, &regs, regbuf); 1361 ops->get_regs(dev, &regs, regbuf);
1359 1362
1360 ret = -EFAULT; 1363 ret = -EFAULT;
1361 if (copy_to_user(useraddr, &regs, sizeof(regs))) 1364 if (copy_to_user(useraddr, &regs, sizeof(regs)))
1362 goto out; 1365 goto out;
1363 useraddr += offsetof(struct ethtool_regs, data); 1366 useraddr += offsetof(struct ethtool_regs, data);
1364 if (regbuf && copy_to_user(useraddr, regbuf, regs.len)) 1367 if (copy_to_user(useraddr, regbuf, reglen))
1365 goto out; 1368 goto out;
1366 ret = 0; 1369 ret = 0;
1367 1370
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 43f0115cce9c..18f8dd8329ed 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -757,9 +757,9 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
757 if (err) 757 if (err)
758 goto errout; 758 goto errout;
759 759
760 if (rule_exists(ops, frh, tb, rule)) { 760 if ((nlh->nlmsg_flags & NLM_F_EXCL) &&
761 if (nlh->nlmsg_flags & NLM_F_EXCL) 761 rule_exists(ops, frh, tb, rule)) {
762 err = -EEXIST; 762 err = -EEXIST;
763 goto errout_free; 763 goto errout_free;
764 } 764 }
765 765
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 99ddc69736b2..f975c5e2a369 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3059,7 +3059,13 @@ static int pktgen_wait_thread_run(struct pktgen_thread *t)
3059{ 3059{
3060 while (thread_is_running(t)) { 3060 while (thread_is_running(t)) {
3061 3061
3062 /* note: 't' will still be around even after the unlock/lock
3063 * cycle because pktgen_thread threads are only cleared at
3064 * net exit
3065 */
3066 mutex_unlock(&pktgen_thread_lock);
3062 msleep_interruptible(100); 3067 msleep_interruptible(100);
3068 mutex_lock(&pktgen_thread_lock);
3063 3069
3064 if (signal_pending(current)) 3070 if (signal_pending(current))
3065 goto signal; 3071 goto signal;
@@ -3074,6 +3080,10 @@ static int pktgen_wait_all_threads_run(struct pktgen_net *pn)
3074 struct pktgen_thread *t; 3080 struct pktgen_thread *t;
3075 int sig = 1; 3081 int sig = 1;
3076 3082
3083 /* prevent from racing with rmmod */
3084 if (!try_module_get(THIS_MODULE))
3085 return sig;
3086
3077 mutex_lock(&pktgen_thread_lock); 3087 mutex_lock(&pktgen_thread_lock);
3078 3088
3079 list_for_each_entry(t, &pn->pktgen_threads, th_list) { 3089 list_for_each_entry(t, &pn->pktgen_threads, th_list) {
@@ -3087,6 +3097,7 @@ static int pktgen_wait_all_threads_run(struct pktgen_net *pn)
3087 t->control |= (T_STOP); 3097 t->control |= (T_STOP);
3088 3098
3089 mutex_unlock(&pktgen_thread_lock); 3099 mutex_unlock(&pktgen_thread_lock);
3100 module_put(THIS_MODULE);
3090 return sig; 3101 return sig;
3091} 3102}
3092 3103
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index 969402c7dbf1..d43737e6c3fb 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -28,14 +28,10 @@ static inline bool sja1105_is_link_local(const struct sk_buff *skb)
28 */ 28 */
29static bool sja1105_filter(const struct sk_buff *skb, struct net_device *dev) 29static bool sja1105_filter(const struct sk_buff *skb, struct net_device *dev)
30{ 30{
31 if (sja1105_is_link_local(skb)) { 31 if (sja1105_is_link_local(skb))
32 SJA1105_SKB_CB(skb)->type = SJA1105_FRAME_TYPE_LINK_LOCAL;
33 return true; 32 return true;
34 } 33 if (!dsa_port_is_vlan_filtering(dev->dsa_ptr))
35 if (!dsa_port_is_vlan_filtering(dev->dsa_ptr)) {
36 SJA1105_SKB_CB(skb)->type = SJA1105_FRAME_TYPE_NORMAL;
37 return true; 34 return true;
38 }
39 return false; 35 return false;
40} 36}
41 37
@@ -84,7 +80,7 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
84 80
85 skb->offload_fwd_mark = 1; 81 skb->offload_fwd_mark = 1;
86 82
87 if (SJA1105_SKB_CB(skb)->type == SJA1105_FRAME_TYPE_LINK_LOCAL) { 83 if (sja1105_is_link_local(skb)) {
88 /* Management traffic path. Switch embeds the switch ID and 84 /* Management traffic path. Switch embeds the switch ID and
89 * port ID into bytes of the destination MAC, courtesy of 85 * port ID into bytes of the destination MAC, courtesy of
90 * the incl_srcpt options. 86 * the incl_srcpt options.
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cee640281e02..6cb7cff22db9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1981,7 +1981,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1981 u32 itag = 0; 1981 u32 itag = 0;
1982 struct rtable *rth; 1982 struct rtable *rth;
1983 struct flowi4 fl4; 1983 struct flowi4 fl4;
1984 bool do_cache; 1984 bool do_cache = true;
1985 1985
1986 /* IP on this device is disabled. */ 1986 /* IP on this device is disabled. */
1987 1987
@@ -2058,6 +2058,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2058 if (res->type == RTN_BROADCAST) { 2058 if (res->type == RTN_BROADCAST) {
2059 if (IN_DEV_BFORWARD(in_dev)) 2059 if (IN_DEV_BFORWARD(in_dev))
2060 goto make_route; 2060 goto make_route;
2061 /* not do cache if bc_forwarding is enabled */
2062 if (IPV4_DEVCONF_ALL(net, BC_FORWARDING))
2063 do_cache = false;
2061 goto brd_input; 2064 goto brd_input;
2062 } 2065 }
2063 2066
@@ -2095,18 +2098,15 @@ brd_input:
2095 RT_CACHE_STAT_INC(in_brd); 2098 RT_CACHE_STAT_INC(in_brd);
2096 2099
2097local_input: 2100local_input:
2098 do_cache = false; 2101 do_cache &= res->fi && !itag;
2099 if (res->fi) { 2102 if (do_cache) {
2100 if (!itag) { 2103 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
2101 struct fib_nh_common *nhc = FIB_RES_NHC(*res);
2102 2104
2103 rth = rcu_dereference(nhc->nhc_rth_input); 2105 rth = rcu_dereference(nhc->nhc_rth_input);
2104 if (rt_cache_valid(rth)) { 2106 if (rt_cache_valid(rth)) {
2105 skb_dst_set_noref(skb, &rth->dst); 2107 skb_dst_set_noref(skb, &rth->dst);
2106 err = 0; 2108 err = 0;
2107 goto out; 2109 goto out;
2108 }
2109 do_cache = true;
2110 } 2110 }
2111 } 2111 }
2112 2112
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 189144346cd4..7c6228fbf5dd 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -533,8 +533,7 @@ static inline bool __udp_is_mcast_sock(struct net *net, struct sock *sk,
533 (inet->inet_dport != rmt_port && inet->inet_dport) || 533 (inet->inet_dport != rmt_port && inet->inet_dport) ||
534 (inet->inet_rcv_saddr && inet->inet_rcv_saddr != loc_addr) || 534 (inet->inet_rcv_saddr && inet->inet_rcv_saddr != loc_addr) ||
535 ipv6_only_sock(sk) || 535 ipv6_only_sock(sk) ||
536 (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif && 536 !udp_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif))
537 sk->sk_bound_dev_if != sdif))
538 return false; 537 return false;
539 if (!ip_mc_sf_allow(sk, loc_addr, rmt_addr, dif, sdif)) 538 if (!ip_mc_sf_allow(sk, loc_addr, rmt_addr, dif, sdif))
540 return false; 539 return false;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 703c8387f102..70693bc7ad9d 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -779,6 +779,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
779 struct flowi6 fl6; 779 struct flowi6 fl6;
780 struct ipcm6_cookie ipc6; 780 struct ipcm6_cookie ipc6;
781 int addr_len = msg->msg_namelen; 781 int addr_len = msg->msg_namelen;
782 int hdrincl;
782 u16 proto; 783 u16 proto;
783 int err; 784 int err;
784 785
@@ -792,6 +793,13 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
792 if (msg->msg_flags & MSG_OOB) 793 if (msg->msg_flags & MSG_OOB)
793 return -EOPNOTSUPP; 794 return -EOPNOTSUPP;
794 795
796 /* hdrincl should be READ_ONCE(inet->hdrincl)
797 * but READ_ONCE() doesn't work with bit fields.
798 * Doing this indirectly yields the same result.
799 */
800 hdrincl = inet->hdrincl;
801 hdrincl = READ_ONCE(hdrincl);
802
795 /* 803 /*
796 * Get and verify the address. 804 * Get and verify the address.
797 */ 805 */
@@ -883,11 +891,14 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
883 opt = ipv6_fixup_options(&opt_space, opt); 891 opt = ipv6_fixup_options(&opt_space, opt);
884 892
885 fl6.flowi6_proto = proto; 893 fl6.flowi6_proto = proto;
886 rfv.msg = msg; 894
887 rfv.hlen = 0; 895 if (!hdrincl) {
888 err = rawv6_probe_proto_opt(&rfv, &fl6); 896 rfv.msg = msg;
889 if (err) 897 rfv.hlen = 0;
890 goto out; 898 err = rawv6_probe_proto_opt(&rfv, &fl6);
899 if (err)
900 goto out;
901 }
891 902
892 if (!ipv6_addr_any(daddr)) 903 if (!ipv6_addr_any(daddr))
893 fl6.daddr = *daddr; 904 fl6.daddr = *daddr;
@@ -904,7 +915,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
904 fl6.flowi6_oif = np->ucast_oif; 915 fl6.flowi6_oif = np->ucast_oif;
905 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); 916 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
906 917
907 if (inet->hdrincl) 918 if (hdrincl)
908 fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH; 919 fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH;
909 920
910 if (ipc6.tclass < 0) 921 if (ipc6.tclass < 0)
@@ -927,7 +938,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
927 goto do_confirm; 938 goto do_confirm;
928 939
929back_from_confirm: 940back_from_confirm:
930 if (inet->hdrincl) 941 if (hdrincl)
931 err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst, 942 err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst,
932 msg->msg_flags, &ipc6.sockc); 943 msg->msg_flags, &ipc6.sockc);
933 else { 944 else {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index fc012e801459..a29d66da7394 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3008,8 +3008,8 @@ static int packet_release(struct socket *sock)
3008 3008
3009 synchronize_net(); 3009 synchronize_net();
3010 3010
3011 kfree(po->rollover);
3011 if (f) { 3012 if (f) {
3012 kfree(po->rollover);
3013 fanout_release_data(f); 3013 fanout_release_data(f);
3014 kfree(f); 3014 kfree(f);
3015 } 3015 }
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 2da9b75bad16..b8d581b779b2 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -87,7 +87,7 @@ static void rds_ib_dev_shutdown(struct rds_ib_device *rds_ibdev)
87 87
88 spin_lock_irqsave(&rds_ibdev->spinlock, flags); 88 spin_lock_irqsave(&rds_ibdev->spinlock, flags);
89 list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node) 89 list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node)
90 rds_conn_drop(ic->conn); 90 rds_conn_path_drop(&ic->conn->c_path[0], true);
91 spin_unlock_irqrestore(&rds_ibdev->spinlock, flags); 91 spin_unlock_irqrestore(&rds_ibdev->spinlock, flags);
92} 92}
93 93
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index d664e9ade74d..0b347f46b2f4 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -428,12 +428,14 @@ int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
428 wait_clean_list_grace(); 428 wait_clean_list_grace();
429 429
430 list_to_llist_nodes(pool, &unmap_list, &clean_nodes, &clean_tail); 430 list_to_llist_nodes(pool, &unmap_list, &clean_nodes, &clean_tail);
431 if (ibmr_ret) 431 if (ibmr_ret) {
432 *ibmr_ret = llist_entry(clean_nodes, struct rds_ib_mr, llnode); 432 *ibmr_ret = llist_entry(clean_nodes, struct rds_ib_mr, llnode);
433 433 clean_nodes = clean_nodes->next;
434 }
434 /* more than one entry in llist nodes */ 435 /* more than one entry in llist nodes */
435 if (clean_nodes->next) 436 if (clean_nodes)
436 llist_add_batch(clean_nodes->next, clean_tail, &pool->clean_list); 437 llist_add_batch(clean_nodes, clean_tail,
438 &pool->clean_list);
437 439
438 } 440 }
439 441
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 8946c89d7392..3cae88cbdaa0 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -168,6 +168,7 @@ void rds_ib_recv_free_caches(struct rds_ib_connection *ic)
168 list_del(&inc->ii_cache_entry); 168 list_del(&inc->ii_cache_entry);
169 WARN_ON(!list_empty(&inc->ii_frags)); 169 WARN_ON(!list_empty(&inc->ii_frags));
170 kmem_cache_free(rds_ib_incoming_slab, inc); 170 kmem_cache_free(rds_ib_incoming_slab, inc);
171 atomic_dec(&rds_ib_allocation);
171 } 172 }
172 173
173 rds_ib_cache_xfer_to_ready(&ic->i_cache_frags); 174 rds_ib_cache_xfer_to_ready(&ic->i_cache_frags);
@@ -1057,6 +1058,8 @@ out:
1057 1058
1058void rds_ib_recv_exit(void) 1059void rds_ib_recv_exit(void)
1059{ 1060{
1061 WARN_ON(atomic_read(&rds_ib_allocation));
1062
1060 kmem_cache_destroy(rds_ib_incoming_slab); 1063 kmem_cache_destroy(rds_ib_incoming_slab);
1061 kmem_cache_destroy(rds_ib_frag_slab); 1064 kmem_cache_destroy(rds_ib_frag_slab);
1062} 1065}
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 92331e1195c1..f17908f5c4f3 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2312,7 +2312,6 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
2312 union sctp_addr addr; 2312 union sctp_addr addr;
2313 struct sctp_af *af; 2313 struct sctp_af *af;
2314 int src_match = 0; 2314 int src_match = 0;
2315 char *cookie;
2316 2315
2317 /* We must include the address that the INIT packet came from. 2316 /* We must include the address that the INIT packet came from.
2318 * This is the only address that matters for an INIT packet. 2317 * This is the only address that matters for an INIT packet.
@@ -2416,14 +2415,6 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
2416 /* Peer Rwnd : Current calculated value of the peer's rwnd. */ 2415 /* Peer Rwnd : Current calculated value of the peer's rwnd. */
2417 asoc->peer.rwnd = asoc->peer.i.a_rwnd; 2416 asoc->peer.rwnd = asoc->peer.i.a_rwnd;
2418 2417
2419 /* Copy cookie in case we need to resend COOKIE-ECHO. */
2420 cookie = asoc->peer.cookie;
2421 if (cookie) {
2422 asoc->peer.cookie = kmemdup(cookie, asoc->peer.cookie_len, gfp);
2423 if (!asoc->peer.cookie)
2424 goto clean_up;
2425 }
2426
2427 /* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily 2418 /* RFC 2960 7.2.1 The initial value of ssthresh MAY be arbitrarily
2428 * high (for example, implementations MAY use the size of the receiver 2419 * high (for example, implementations MAY use the size of the receiver
2429 * advertised window). 2420 * advertised window).
@@ -2592,7 +2583,9 @@ do_addr_param:
2592 case SCTP_PARAM_STATE_COOKIE: 2583 case SCTP_PARAM_STATE_COOKIE:
2593 asoc->peer.cookie_len = 2584 asoc->peer.cookie_len =
2594 ntohs(param.p->length) - sizeof(struct sctp_paramhdr); 2585 ntohs(param.p->length) - sizeof(struct sctp_paramhdr);
2595 asoc->peer.cookie = param.cookie->body; 2586 asoc->peer.cookie = kmemdup(param.cookie->body, asoc->peer.cookie_len, gfp);
2587 if (!asoc->peer.cookie)
2588 retval = 0;
2596 break; 2589 break;
2597 2590
2598 case SCTP_PARAM_HEARTBEAT_INFO: 2591 case SCTP_PARAM_HEARTBEAT_INFO:
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 9b50da548db2..a554d6d15d1b 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -883,6 +883,11 @@ static void sctp_cmd_new_state(struct sctp_cmd_seq *cmds,
883 asoc->rto_initial; 883 asoc->rto_initial;
884 } 884 }
885 885
886 if (sctp_state(asoc, ESTABLISHED)) {
887 kfree(asoc->peer.cookie);
888 asoc->peer.cookie = NULL;
889 }
890
886 if (sctp_state(asoc, ESTABLISHED) || 891 if (sctp_state(asoc, ESTABLISHED) ||
887 sctp_state(asoc, CLOSED) || 892 sctp_state(asoc, CLOSED) ||
888 sctp_state(asoc, SHUTDOWN_RECEIVED)) { 893 sctp_state(asoc, SHUTDOWN_RECEIVED)) {
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index b95c408fd771..1f9cf57d9754 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -550,11 +550,23 @@ void tls_device_write_space(struct sock *sk, struct tls_context *ctx)
550 } 550 }
551} 551}
552 552
553static void tls_device_resync_rx(struct tls_context *tls_ctx,
554 struct sock *sk, u32 seq, u64 rcd_sn)
555{
556 struct net_device *netdev;
557
558 if (WARN_ON(test_and_set_bit(TLS_RX_SYNC_RUNNING, &tls_ctx->flags)))
559 return;
560 netdev = READ_ONCE(tls_ctx->netdev);
561 if (netdev)
562 netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, seq, rcd_sn);
563 clear_bit_unlock(TLS_RX_SYNC_RUNNING, &tls_ctx->flags);
564}
565
553void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn) 566void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
554{ 567{
555 struct tls_context *tls_ctx = tls_get_ctx(sk); 568 struct tls_context *tls_ctx = tls_get_ctx(sk);
556 struct tls_offload_context_rx *rx_ctx; 569 struct tls_offload_context_rx *rx_ctx;
557 struct net_device *netdev;
558 u32 is_req_pending; 570 u32 is_req_pending;
559 s64 resync_req; 571 s64 resync_req;
560 u32 req_seq; 572 u32 req_seq;
@@ -570,12 +582,7 @@ void handle_device_resync(struct sock *sk, u32 seq, u64 rcd_sn)
570 if (unlikely(is_req_pending) && req_seq == seq && 582 if (unlikely(is_req_pending) && req_seq == seq &&
571 atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) { 583 atomic64_try_cmpxchg(&rx_ctx->resync_req, &resync_req, 0)) {
572 seq += TLS_HEADER_SIZE - 1; 584 seq += TLS_HEADER_SIZE - 1;
573 down_read(&device_offload_lock); 585 tls_device_resync_rx(tls_ctx, sk, seq, rcd_sn);
574 netdev = tls_ctx->netdev;
575 if (netdev)
576 netdev->tlsdev_ops->tls_dev_resync_rx(netdev, sk, seq,
577 rcd_sn);
578 up_read(&device_offload_lock);
579 } 586 }
580} 587}
581 588
@@ -977,7 +984,10 @@ static int tls_device_down(struct net_device *netdev)
977 if (ctx->rx_conf == TLS_HW) 984 if (ctx->rx_conf == TLS_HW)
978 netdev->tlsdev_ops->tls_dev_del(netdev, ctx, 985 netdev->tlsdev_ops->tls_dev_del(netdev, ctx,
979 TLS_OFFLOAD_CTX_DIR_RX); 986 TLS_OFFLOAD_CTX_DIR_RX);
980 ctx->netdev = NULL; 987 WRITE_ONCE(ctx->netdev, NULL);
988 smp_mb__before_atomic(); /* pairs with test_and_set_bit() */
989 while (test_bit(TLS_RX_SYNC_RUNNING, &ctx->flags))
990 usleep_range(10, 200);
981 dev_put(netdev); 991 dev_put(netdev);
982 list_del_init(&ctx->list); 992 list_del_init(&ctx->list);
983 993
diff --git a/tools/testing/selftests/net/forwarding/router_broadcast.sh b/tools/testing/selftests/net/forwarding/router_broadcast.sh
index 9a678ece32b4..4eac0a06f451 100755
--- a/tools/testing/selftests/net/forwarding/router_broadcast.sh
+++ b/tools/testing/selftests/net/forwarding/router_broadcast.sh
@@ -145,16 +145,19 @@ bc_forwarding_disable()
145{ 145{
146 sysctl_set net.ipv4.conf.all.bc_forwarding 0 146 sysctl_set net.ipv4.conf.all.bc_forwarding 0
147 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 0 147 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 0
148 sysctl_set net.ipv4.conf.$rp2.bc_forwarding 0
148} 149}
149 150
150bc_forwarding_enable() 151bc_forwarding_enable()
151{ 152{
152 sysctl_set net.ipv4.conf.all.bc_forwarding 1 153 sysctl_set net.ipv4.conf.all.bc_forwarding 1
153 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 1 154 sysctl_set net.ipv4.conf.$rp1.bc_forwarding 1
155 sysctl_set net.ipv4.conf.$rp2.bc_forwarding 1
154} 156}
155 157
156bc_forwarding_restore() 158bc_forwarding_restore()
157{ 159{
160 sysctl_restore net.ipv4.conf.$rp2.bc_forwarding
158 sysctl_restore net.ipv4.conf.$rp1.bc_forwarding 161 sysctl_restore net.ipv4.conf.$rp1.bc_forwarding
159 sysctl_restore net.ipv4.conf.all.bc_forwarding 162 sysctl_restore net.ipv4.conf.all.bc_forwarding
160} 163}
@@ -171,7 +174,7 @@ ping_test_from()
171 log_info "ping $dip, expected reply from $from" 174 log_info "ping $dip, expected reply from $from"
172 ip vrf exec $(master_name_get $oif) \ 175 ip vrf exec $(master_name_get $oif) \
173 $PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \ 176 $PING -I $oif $dip -c 10 -i 0.1 -w $PING_TIMEOUT -b 2>&1 \
174 | grep $from &> /dev/null 177 | grep "bytes from $from" > /dev/null
175 check_err_fail $fail $? 178 check_err_fail $fail $?
176} 179}
177 180