aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-27 20:24:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-27 20:24:37 -0400
commitc84afab02c311b08b5cb8ea758cc177f81c95d11 (patch)
tree6ef80077188ee8ace092e1f740f4712c5a520484
parent249155c20f9b0754bc1b932a33344cfb4e0c2101 (diff)
parent89ed5b519004a7706f50b70f611edbd3aaacff2c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix ppp_mppe crypto soft dependencies, from Takashi Iawi. 2) Fix TX completion to be finite, from Sergej Benilov. 3) Use register_pernet_device to avoid a dst leak in tipc, from Xin Long. 4) Double free of TX cleanup in Dirk van der Merwe. 5) Memory leak in packet_set_ring(), from Eric Dumazet. 6) Out of bounds read in qmi_wwan, from Bjørn Mork. 7) Fix iif used in mcast/bcast looped back packets, from Stephen Suryaputra. 8) Fix neighbour resolution on raw ipv6 sockets, from Nicolas Dichtel. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (25 commits) af_packet: Block execution of tasks waiting for transmit to complete in AF_PACKET sctp: change to hold sk after auth shkey is created successfully ipv6: fix neighbour resolution with raw socket ipv6: constify rt6_nexthop() net: dsa: microchip: Use gpiod_set_value_cansleep() net: aquantia: fix vlans not working over bridged network ipv4: reset rt_iif for recirculated mcast/bcast out pkts team: Always enable vlan tx offload net/smc: Fix error path in smc_init net/smc: hold conns_lock before calling smc_lgr_register_conn() bonding: Always enable vlan tx offload net/ipv6: Fix misuse of proc_dointvec "skip_notify_on_dev_down" ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop qmi_wwan: Fix out-of-bounds read tipc: check msg->req data len in tipc_nl_compat_bearer_disable net: macb: do not copy the mac address if NULL net/packet: fix memory leak in packet_set_ring() net/tls: fix page double free on TX cleanup net/sched: cbs: Fix error path of cbs_module_init tipc: change to use register_pernet_device ...
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/dsa/microchip/ksz_common.c6
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_filters.c10
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.c1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.h1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c19
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_ethtool.c28
-rw-r--r--drivers/net/ethernet/sis/sis900.c16
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c22
-rw-r--r--drivers/net/ppp/ppp_mppe.c1
-rw-r--r--drivers/net/team/team.c2
-rw-r--r--drivers/net/usb/qmi_wwan.c2
-rw-r--r--drivers/net/vrf.c2
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/route.h1
-rw-r--r--include/net/tls.h15
-rw-r--r--net/bluetooth/6lowpan.c4
-rw-r--r--net/ipv4/ip_output.c12
-rw-r--r--net/ipv4/raw.c2
-rw-r--r--net/ipv4/route.c33
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/route.c5
-rw-r--r--net/netfilter/nf_flow_table_ip.c2
-rw-r--r--net/packet/af_packet.c23
-rw-r--r--net/packet/internal.h1
-rw-r--r--net/sched/sch_cbs.c9
-rw-r--r--net/sctp/endpointola.c8
-rw-r--r--net/smc/af_smc.c5
-rw-r--r--net/smc/smc_core.c3
-rw-r--r--net/tipc/core.c12
-rw-r--r--net/tipc/netlink_compat.c18
-rw-r--r--net/tls/tls_main.c3
34 files changed, 194 insertions, 84 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 407f4095a37a..799fc38c5c34 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4320,12 +4320,12 @@ void bond_setup(struct net_device *bond_dev)
4320 bond_dev->features |= NETIF_F_NETNS_LOCAL; 4320 bond_dev->features |= NETIF_F_NETNS_LOCAL;
4321 4321
4322 bond_dev->hw_features = BOND_VLAN_FEATURES | 4322 bond_dev->hw_features = BOND_VLAN_FEATURES |
4323 NETIF_F_HW_VLAN_CTAG_TX |
4324 NETIF_F_HW_VLAN_CTAG_RX | 4323 NETIF_F_HW_VLAN_CTAG_RX |
4325 NETIF_F_HW_VLAN_CTAG_FILTER; 4324 NETIF_F_HW_VLAN_CTAG_FILTER;
4326 4325
4327 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4; 4326 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
4328 bond_dev->features |= bond_dev->hw_features; 4327 bond_dev->features |= bond_dev->hw_features;
4328 bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
4329} 4329}
4330 4330
4331/* Destroy a bonding device. 4331/* Destroy a bonding device.
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index f46086fa9064..db91b213eae1 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -436,9 +436,9 @@ int ksz_switch_register(struct ksz_device *dev,
436 return PTR_ERR(dev->reset_gpio); 436 return PTR_ERR(dev->reset_gpio);
437 437
438 if (dev->reset_gpio) { 438 if (dev->reset_gpio) {
439 gpiod_set_value(dev->reset_gpio, 1); 439 gpiod_set_value_cansleep(dev->reset_gpio, 1);
440 mdelay(10); 440 mdelay(10);
441 gpiod_set_value(dev->reset_gpio, 0); 441 gpiod_set_value_cansleep(dev->reset_gpio, 0);
442 } 442 }
443 443
444 mutex_init(&dev->dev_mutex); 444 mutex_init(&dev->dev_mutex);
@@ -487,7 +487,7 @@ void ksz_switch_remove(struct ksz_device *dev)
487 dsa_unregister_switch(dev->ds); 487 dsa_unregister_switch(dev->ds);
488 488
489 if (dev->reset_gpio) 489 if (dev->reset_gpio)
490 gpiod_set_value(dev->reset_gpio, 1); 490 gpiod_set_value_cansleep(dev->reset_gpio, 1);
491 491
492} 492}
493EXPORT_SYMBOL(ksz_switch_remove); 493EXPORT_SYMBOL(ksz_switch_remove);
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
index 18bc035da850..1fff462a4175 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
@@ -843,9 +843,14 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
843 return err; 843 return err;
844 844
845 if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { 845 if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
846 if (hweight < AQ_VLAN_MAX_FILTERS) 846 if (hweight < AQ_VLAN_MAX_FILTERS && hweight > 0) {
847 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, true); 847 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw,
848 !(aq_nic->packet_filter & IFF_PROMISC));
849 aq_nic->aq_nic_cfg.is_vlan_force_promisc = false;
850 } else {
848 /* otherwise left in promiscue mode */ 851 /* otherwise left in promiscue mode */
852 aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
853 }
849 } 854 }
850 855
851 return err; 856 return err;
@@ -866,6 +871,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic)
866 if (unlikely(!aq_hw_ops->hw_filter_vlan_ctrl)) 871 if (unlikely(!aq_hw_ops->hw_filter_vlan_ctrl))
867 return -EOPNOTSUPP; 872 return -EOPNOTSUPP;
868 873
874 aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
869 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false); 875 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
870 if (err) 876 if (err)
871 return err; 877 return err;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 0da5e161ec5d..41172fbebddd 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -126,6 +126,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
126 126
127 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk; 127 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
128 cfg->features = cfg->aq_hw_caps->hw_features; 128 cfg->features = cfg->aq_hw_caps->hw_features;
129 cfg->is_vlan_force_promisc = true;
129} 130}
130 131
131static int aq_nic_update_link_status(struct aq_nic_s *self) 132static int aq_nic_update_link_status(struct aq_nic_s *self)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index eb2e3c7c36f9..0f22f5d5691b 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -35,6 +35,7 @@ struct aq_nic_cfg_s {
35 u32 flow_control; 35 u32 flow_control;
36 u32 link_speed_msk; 36 u32 link_speed_msk;
37 u32 wol; 37 u32 wol;
38 bool is_vlan_force_promisc;
38 u16 is_mc_list_enabled; 39 u16 is_mc_list_enabled;
39 u16 mc_list_count; 40 u16 mc_list_count;
40 bool is_autoneg; 41 bool is_autoneg;
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
index 1c7593d54035..13ac2661a473 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
@@ -778,8 +778,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
778 unsigned int packet_filter) 778 unsigned int packet_filter)
779{ 779{
780 unsigned int i = 0U; 780 unsigned int i = 0U;
781 struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
782
783 hw_atl_rpfl2promiscuous_mode_en_set(self,
784 IS_FILTER_ENABLED(IFF_PROMISC));
785
786 hw_atl_rpf_vlan_prom_mode_en_set(self,
787 IS_FILTER_ENABLED(IFF_PROMISC) ||
788 cfg->is_vlan_force_promisc);
781 789
782 hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC));
783 hw_atl_rpfl2multicast_flr_en_set(self, 790 hw_atl_rpfl2multicast_flr_en_set(self,
784 IS_FILTER_ENABLED(IFF_ALLMULTI), 0); 791 IS_FILTER_ENABLED(IFF_ALLMULTI), 0);
785 792
@@ -788,13 +795,13 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self,
788 795
789 hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); 796 hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
790 797
791 self->aq_nic_cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST); 798 cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST);
792 799
793 for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) 800 for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
794 hw_atl_rpfl2_uc_flr_en_set(self, 801 hw_atl_rpfl2_uc_flr_en_set(self,
795 (self->aq_nic_cfg->is_mc_list_enabled && 802 (cfg->is_mc_list_enabled &&
796 (i <= self->aq_nic_cfg->mc_list_count)) ? 803 (i <= cfg->mc_list_count)) ?
797 1U : 0U, i); 804 1U : 0U, i);
798 805
799 return aq_hw_err_from_flags(self); 806 return aq_hw_err_from_flags(self);
800} 807}
@@ -1086,7 +1093,7 @@ static int hw_atl_b0_hw_vlan_set(struct aq_hw_s *self,
1086static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable) 1093static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
1087{ 1094{
1088 /* set promisc in case of disabing the vland filter */ 1095 /* set promisc in case of disabing the vland filter */
1089 hw_atl_rpf_vlan_prom_mode_en_set(self, !!!enable); 1096 hw_atl_rpf_vlan_prom_mode_en_set(self, !enable);
1090 1097
1091 return aq_hw_err_from_flags(self); 1098 return aq_hw_err_from_flags(self);
1092} 1099}
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 2375a13bb446..262a28ff81fc 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4180,7 +4180,7 @@ static int macb_probe(struct platform_device *pdev)
4180 if (PTR_ERR(mac) == -EPROBE_DEFER) { 4180 if (PTR_ERR(mac) == -EPROBE_DEFER) {
4181 err = -EPROBE_DEFER; 4181 err = -EPROBE_DEFER;
4182 goto err_out_free_netdev; 4182 goto err_out_free_netdev;
4183 } else if (!IS_ERR(mac)) { 4183 } else if (!IS_ERR_OR_NULL(mac)) {
4184 ether_addr_copy(bp->dev->dev_addr, mac); 4184 ether_addr_copy(bp->dev->dev_addr, mac);
4185 } else { 4185 } else {
4186 macb_get_hwaddr(bp); 4186 macb_get_hwaddr(bp);
diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c
index 8a6785173228..492f8769ac12 100644
--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
+++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
@@ -891,7 +891,7 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test,
891 u64 *data) 891 u64 *data)
892{ 892{
893 struct be_adapter *adapter = netdev_priv(netdev); 893 struct be_adapter *adapter = netdev_priv(netdev);
894 int status; 894 int status, cnt;
895 u8 link_status = 0; 895 u8 link_status = 0;
896 896
897 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { 897 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) {
@@ -902,6 +902,9 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test,
902 902
903 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); 903 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
904 904
905 /* check link status before offline tests */
906 link_status = netif_carrier_ok(netdev);
907
905 if (test->flags & ETH_TEST_FL_OFFLINE) { 908 if (test->flags & ETH_TEST_FL_OFFLINE) {
906 if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0) 909 if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0)
907 test->flags |= ETH_TEST_FL_FAILED; 910 test->flags |= ETH_TEST_FL_FAILED;
@@ -922,13 +925,26 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test,
922 test->flags |= ETH_TEST_FL_FAILED; 925 test->flags |= ETH_TEST_FL_FAILED;
923 } 926 }
924 927
925 status = be_cmd_link_status_query(adapter, NULL, &link_status, 0); 928 /* link status was down prior to test */
926 if (status) { 929 if (!link_status) {
927 test->flags |= ETH_TEST_FL_FAILED;
928 data[4] = -1;
929 } else if (!link_status) {
930 test->flags |= ETH_TEST_FL_FAILED; 930 test->flags |= ETH_TEST_FL_FAILED;
931 data[4] = 1; 931 data[4] = 1;
932 return;
933 }
934
935 for (cnt = 10; cnt; cnt--) {
936 status = be_cmd_link_status_query(adapter, NULL, &link_status,
937 0);
938 if (status) {
939 test->flags |= ETH_TEST_FL_FAILED;
940 data[4] = -1;
941 break;
942 }
943
944 if (link_status)
945 break;
946
947 msleep_interruptible(500);
932 } 948 }
933} 949}
934 950
diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c
index 67f9bb6e941b..9b036c857b1d 100644
--- a/drivers/net/ethernet/sis/sis900.c
+++ b/drivers/net/ethernet/sis/sis900.c
@@ -1057,7 +1057,7 @@ sis900_open(struct net_device *net_dev)
1057 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); 1057 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED);
1058 1058
1059 /* Enable all known interrupts by setting the interrupt mask. */ 1059 /* Enable all known interrupts by setting the interrupt mask. */
1060 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); 1060 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC);
1061 sw32(cr, RxENA | sr32(cr)); 1061 sw32(cr, RxENA | sr32(cr));
1062 sw32(ier, IE); 1062 sw32(ier, IE);
1063 1063
@@ -1578,7 +1578,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
1578 sw32(txdp, sis_priv->tx_ring_dma); 1578 sw32(txdp, sis_priv->tx_ring_dma);
1579 1579
1580 /* Enable all known interrupts by setting the interrupt mask. */ 1580 /* Enable all known interrupts by setting the interrupt mask. */
1581 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); 1581 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC);
1582} 1582}
1583 1583
1584/** 1584/**
@@ -1618,7 +1618,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
1618 spin_unlock_irqrestore(&sis_priv->lock, flags); 1618 spin_unlock_irqrestore(&sis_priv->lock, flags);
1619 return NETDEV_TX_OK; 1619 return NETDEV_TX_OK;
1620 } 1620 }
1621 sis_priv->tx_ring[entry].cmdsts = (OWN | skb->len); 1621 sis_priv->tx_ring[entry].cmdsts = (OWN | INTR | skb->len);
1622 sw32(cr, TxENA | sr32(cr)); 1622 sw32(cr, TxENA | sr32(cr));
1623 1623
1624 sis_priv->cur_tx ++; 1624 sis_priv->cur_tx ++;
@@ -1674,7 +1674,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance)
1674 do { 1674 do {
1675 status = sr32(isr); 1675 status = sr32(isr);
1676 1676
1677 if ((status & (HIBERR|TxURN|TxERR|TxIDLE|RxORN|RxERR|RxOK)) == 0) 1677 if ((status & (HIBERR|TxURN|TxERR|TxIDLE|TxDESC|RxORN|RxERR|RxOK)) == 0)
1678 /* nothing intresting happened */ 1678 /* nothing intresting happened */
1679 break; 1679 break;
1680 handled = 1; 1680 handled = 1;
@@ -1684,7 +1684,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance)
1684 /* Rx interrupt */ 1684 /* Rx interrupt */
1685 sis900_rx(net_dev); 1685 sis900_rx(net_dev);
1686 1686
1687 if (status & (TxURN | TxERR | TxIDLE)) 1687 if (status & (TxURN | TxERR | TxIDLE | TxDESC))
1688 /* Tx interrupt */ 1688 /* Tx interrupt */
1689 sis900_finish_xmit(net_dev); 1689 sis900_finish_xmit(net_dev);
1690 1690
@@ -1896,8 +1896,8 @@ static void sis900_finish_xmit (struct net_device *net_dev)
1896 1896
1897 if (tx_status & OWN) { 1897 if (tx_status & OWN) {
1898 /* The packet is not transmitted yet (owned by hardware) ! 1898 /* The packet is not transmitted yet (owned by hardware) !
1899 * Note: the interrupt is generated only when Tx Machine 1899 * Note: this is an almost impossible condition
1900 * is idle, so this is an almost impossible case */ 1900 * in case of TxDESC ('descriptor interrupt') */
1901 break; 1901 break;
1902 } 1902 }
1903 1903
@@ -2473,7 +2473,7 @@ static int sis900_resume(struct pci_dev *pci_dev)
2473 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); 2473 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED);
2474 2474
2475 /* Enable all known interrupts by setting the interrupt mask. */ 2475 /* Enable all known interrupts by setting the interrupt mask. */
2476 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); 2476 sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC);
2477 sw32(cr, RxENA | sr32(cr)); 2477 sw32(cr, RxENA | sr32(cr));
2478 sw32(ier, IE); 2478 sw32(ier, IE);
2479 2479
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
index 2dcdf761d525..020159622559 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
@@ -112,7 +112,7 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec,
112 * programmed with (2^32 – <new_sec_value>) 112 * programmed with (2^32 – <new_sec_value>)
113 */ 113 */
114 if (gmac4) 114 if (gmac4)
115 sec = (100000000ULL - sec); 115 sec = -sec;
116 116
117 value = readl(ioaddr + PTP_TCR); 117 value = readl(ioaddr + PTP_TCR);
118 if (value & PTP_TCR_TSCTRLSSR) 118 if (value & PTP_TCR_TSCTRLSSR)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 06dd51f47cfd..06358fe5b245 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2947,12 +2947,15 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
2947 2947
2948 /* Manage tx mitigation */ 2948 /* Manage tx mitigation */
2949 tx_q->tx_count_frames += nfrags + 1; 2949 tx_q->tx_count_frames += nfrags + 1;
2950 if (priv->tx_coal_frames <= tx_q->tx_count_frames) { 2950 if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
2951 !(priv->synopsys_id >= DWMAC_CORE_4_00 &&
2952 (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
2953 priv->hwts_tx_en)) {
2954 stmmac_tx_timer_arm(priv, queue);
2955 } else {
2956 tx_q->tx_count_frames = 0;
2951 stmmac_set_tx_ic(priv, desc); 2957 stmmac_set_tx_ic(priv, desc);
2952 priv->xstats.tx_set_ic_bit++; 2958 priv->xstats.tx_set_ic_bit++;
2953 tx_q->tx_count_frames = 0;
2954 } else {
2955 stmmac_tx_timer_arm(priv, queue);
2956 } 2959 }
2957 2960
2958 skb_tx_timestamp(skb); 2961 skb_tx_timestamp(skb);
@@ -3166,12 +3169,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
3166 * element in case of no SG. 3169 * element in case of no SG.
3167 */ 3170 */
3168 tx_q->tx_count_frames += nfrags + 1; 3171 tx_q->tx_count_frames += nfrags + 1;
3169 if (priv->tx_coal_frames <= tx_q->tx_count_frames) { 3172 if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) &&
3173 !(priv->synopsys_id >= DWMAC_CORE_4_00 &&
3174 (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
3175 priv->hwts_tx_en)) {
3176 stmmac_tx_timer_arm(priv, queue);
3177 } else {
3178 tx_q->tx_count_frames = 0;
3170 stmmac_set_tx_ic(priv, desc); 3179 stmmac_set_tx_ic(priv, desc);
3171 priv->xstats.tx_set_ic_bit++; 3180 priv->xstats.tx_set_ic_bit++;
3172 tx_q->tx_count_frames = 0;
3173 } else {
3174 stmmac_tx_timer_arm(priv, queue);
3175 } 3181 }
3176 3182
3177 skb_tx_timestamp(skb); 3183 skb_tx_timestamp(skb);
diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
index ff61dd8748de..66c8e65f6872 100644
--- a/drivers/net/ppp/ppp_mppe.c
+++ b/drivers/net/ppp/ppp_mppe.c
@@ -63,6 +63,7 @@ MODULE_AUTHOR("Frank Cusack <fcusack@fcusack.com>");
63MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); 63MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support");
64MODULE_LICENSE("Dual BSD/GPL"); 64MODULE_LICENSE("Dual BSD/GPL");
65MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); 65MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE));
66MODULE_SOFTDEP("pre: arc4");
66MODULE_VERSION("1.0.2"); 67MODULE_VERSION("1.0.2");
67 68
68static unsigned int 69static unsigned int
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index b48006e7fa2f..36916bf51ee6 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2128,12 +2128,12 @@ static void team_setup(struct net_device *dev)
2128 dev->features |= NETIF_F_NETNS_LOCAL; 2128 dev->features |= NETIF_F_NETNS_LOCAL;
2129 2129
2130 dev->hw_features = TEAM_VLAN_FEATURES | 2130 dev->hw_features = TEAM_VLAN_FEATURES |
2131 NETIF_F_HW_VLAN_CTAG_TX |
2132 NETIF_F_HW_VLAN_CTAG_RX | 2131 NETIF_F_HW_VLAN_CTAG_RX |
2133 NETIF_F_HW_VLAN_CTAG_FILTER; 2132 NETIF_F_HW_VLAN_CTAG_FILTER;
2134 2133
2135 dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4; 2134 dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
2136 dev->features |= dev->hw_features; 2135 dev->features |= dev->hw_features;
2136 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
2137} 2137}
2138 2138
2139static int team_newlink(struct net *src_net, struct net_device *dev, 2139static int team_newlink(struct net *src_net, struct net_device *dev,
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index d080f8048e52..8b4ad10cf940 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1482,7 +1482,7 @@ static int qmi_wwan_probe(struct usb_interface *intf,
1482 * different. Ignore the current interface if the number of endpoints 1482 * different. Ignore the current interface if the number of endpoints
1483 * equals the number for the diag interface (two). 1483 * equals the number for the diag interface (two).
1484 */ 1484 */
1485 info = (void *)&id->driver_info; 1485 info = (void *)id->driver_info;
1486 1486
1487 if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) { 1487 if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) {
1488 if (desc->bNumEndpoints == 2) 1488 if (desc->bNumEndpoints == 2)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 11b9525dff27..311b0cc6eb98 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -350,8 +350,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
350{ 350{
351 struct dst_entry *dst = skb_dst(skb); 351 struct dst_entry *dst = skb_dst(skb);
352 struct net_device *dev = dst->dev; 352 struct net_device *dev = dst->dev;
353 const struct in6_addr *nexthop;
353 struct neighbour *neigh; 354 struct neighbour *neigh;
354 struct in6_addr *nexthop;
355 int ret; 355 int ret;
356 356
357 nf_reset(skb); 357 nf_reset(skb);
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4790beaa86e0..ee7405e759ba 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -262,8 +262,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
262 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; 262 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
263} 263}
264 264
265static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, 265static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
266 struct in6_addr *daddr) 266 const struct in6_addr *daddr)
267{ 267{
268 if (rt->rt6i_flags & RTF_GATEWAY) 268 if (rt->rt6i_flags & RTF_GATEWAY)
269 return &rt->rt6i_gateway; 269 return &rt->rt6i_gateway;
diff --git a/include/net/route.h b/include/net/route.h
index 065b47754f05..55ff71ffb796 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -221,6 +221,7 @@ void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
221struct rtable *rt_dst_alloc(struct net_device *dev, 221struct rtable *rt_dst_alloc(struct net_device *dev,
222 unsigned int flags, u16 type, 222 unsigned int flags, u16 type,
223 bool nopolicy, bool noxfrm, bool will_cache); 223 bool nopolicy, bool noxfrm, bool will_cache);
224struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt);
224 225
225struct in_ifaddr; 226struct in_ifaddr;
226void fib_add_ifaddr(struct in_ifaddr *); 227void fib_add_ifaddr(struct in_ifaddr *);
diff --git a/include/net/tls.h b/include/net/tls.h
index 4a55ce6a303f..53d96bca220d 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -373,21 +373,6 @@ static inline bool tls_is_partially_sent_record(struct tls_context *ctx)
373 return !!ctx->partially_sent_record; 373 return !!ctx->partially_sent_record;
374} 374}
375 375
376static inline int tls_complete_pending_work(struct sock *sk,
377 struct tls_context *ctx,
378 int flags, long *timeo)
379{
380 int rc = 0;
381
382 if (unlikely(sk->sk_write_pending))
383 rc = wait_on_pending_writer(sk, timeo);
384
385 if (!rc && tls_is_partially_sent_record(ctx))
386 rc = tls_push_partial_record(sk, ctx, flags);
387
388 return rc;
389}
390
391static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx) 376static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx)
392{ 377{
393 return tls_ctx->pending_open_record_frags; 378 return tls_ctx->pending_open_record_frags;
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 19d27bee285e..1555b0c6f7ec 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -160,10 +160,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
160 struct in6_addr *daddr, 160 struct in6_addr *daddr,
161 struct sk_buff *skb) 161 struct sk_buff *skb)
162{ 162{
163 struct lowpan_peer *peer;
164 struct in6_addr *nexthop;
165 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); 163 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
166 int count = atomic_read(&dev->peer_count); 164 int count = atomic_read(&dev->peer_count);
165 const struct in6_addr *nexthop;
166 struct lowpan_peer *peer;
167 167
168 BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt); 168 BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
169 169
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 16f9159234a2..8c2ec35b6512 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -318,6 +318,7 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk
318static int ip_mc_finish_output(struct net *net, struct sock *sk, 318static int ip_mc_finish_output(struct net *net, struct sock *sk,
319 struct sk_buff *skb) 319 struct sk_buff *skb)
320{ 320{
321 struct rtable *new_rt;
321 int ret; 322 int ret;
322 323
323 ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); 324 ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb);
@@ -326,6 +327,17 @@ static int ip_mc_finish_output(struct net *net, struct sock *sk,
326 return ret; 327 return ret;
327 } 328 }
328 329
330 /* Reset rt_iif so that inet_iif() will return skb->skb_iif. Setting
331 * this to non-zero causes ipi_ifindex in in_pktinfo to be overwritten,
332 * see ipv4_pktinfo_prepare().
333 */
334 new_rt = rt_dst_clone(net->loopback_dev, skb_rtable(skb));
335 if (new_rt) {
336 new_rt->rt_iif = 0;
337 skb_dst_drop(skb);
338 skb_dst_set(skb, &new_rt->dst);
339 }
340
329 return dev_loopback_xmit(net, sk, skb); 341 return dev_loopback_xmit(net, sk, skb);
330} 342}
331 343
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 0b8e06ca75d6..40a6abbc9cf6 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -197,7 +197,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
197 } 197 }
198 sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol, 198 sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol,
199 iph->saddr, iph->daddr, 199 iph->saddr, iph->daddr,
200 skb->dev->ifindex, sdif); 200 dif, sdif);
201 } 201 }
202out: 202out:
203 read_unlock(&raw_v4_hashinfo.lock); 203 read_unlock(&raw_v4_hashinfo.lock);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6cb7cff22db9..8ea0735a6754 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1647,6 +1647,39 @@ struct rtable *rt_dst_alloc(struct net_device *dev,
1647} 1647}
1648EXPORT_SYMBOL(rt_dst_alloc); 1648EXPORT_SYMBOL(rt_dst_alloc);
1649 1649
1650struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt)
1651{
1652 struct rtable *new_rt;
1653
1654 new_rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK,
1655 rt->dst.flags);
1656
1657 if (new_rt) {
1658 new_rt->rt_genid = rt_genid_ipv4(dev_net(dev));
1659 new_rt->rt_flags = rt->rt_flags;
1660 new_rt->rt_type = rt->rt_type;
1661 new_rt->rt_is_input = rt->rt_is_input;
1662 new_rt->rt_iif = rt->rt_iif;
1663 new_rt->rt_pmtu = rt->rt_pmtu;
1664 new_rt->rt_mtu_locked = rt->rt_mtu_locked;
1665 new_rt->rt_gw_family = rt->rt_gw_family;
1666 if (rt->rt_gw_family == AF_INET)
1667 new_rt->rt_gw4 = rt->rt_gw4;
1668 else if (rt->rt_gw_family == AF_INET6)
1669 new_rt->rt_gw6 = rt->rt_gw6;
1670 INIT_LIST_HEAD(&new_rt->rt_uncached);
1671
1672 new_rt->dst.flags |= DST_HOST;
1673 new_rt->dst.input = rt->dst.input;
1674 new_rt->dst.output = rt->dst.output;
1675 new_rt->dst.error = rt->dst.error;
1676 new_rt->dst.lastuse = jiffies;
1677 new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate);
1678 }
1679 return new_rt;
1680}
1681EXPORT_SYMBOL(rt_dst_clone);
1682
1650/* called in rcu_read_lock() section */ 1683/* called in rcu_read_lock() section */
1651int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, 1684int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1652 u8 tos, struct net_device *dev, 1685 u8 tos, struct net_device *dev,
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 834475717110..21efcd02f337 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -59,8 +59,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
59{ 59{
60 struct dst_entry *dst = skb_dst(skb); 60 struct dst_entry *dst = skb_dst(skb);
61 struct net_device *dev = dst->dev; 61 struct net_device *dev = dst->dev;
62 const struct in6_addr *nexthop;
62 struct neighbour *neigh; 63 struct neighbour *neigh;
63 struct in6_addr *nexthop;
64 int ret; 64 int ret;
65 65
66 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { 66 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 11ad62effd56..97a843cf164c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -218,7 +218,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst,
218{ 218{
219 const struct rt6_info *rt = container_of(dst, struct rt6_info, dst); 219 const struct rt6_info *rt = container_of(dst, struct rt6_info, dst);
220 220
221 return ip6_neigh_lookup(&rt->rt6i_gateway, dst->dev, skb, daddr); 221 return ip6_neigh_lookup(rt6_nexthop(rt, &in6addr_any),
222 dst->dev, skb, daddr);
222} 223}
223 224
224static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr) 225static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr)
@@ -5281,7 +5282,7 @@ static struct ctl_table ipv6_route_table_template[] = {
5281 .data = &init_net.ipv6.sysctl.skip_notify_on_dev_down, 5282 .data = &init_net.ipv6.sysctl.skip_notify_on_dev_down,
5282 .maxlen = sizeof(int), 5283 .maxlen = sizeof(int),
5283 .mode = 0644, 5284 .mode = 0644,
5284 .proc_handler = proc_dointvec, 5285 .proc_handler = proc_dointvec_minmax,
5285 .extra1 = &zero, 5286 .extra1 = &zero,
5286 .extra2 = &one, 5287 .extra2 = &one,
5287 }, 5288 },
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 241317473114..cdfc33517e85 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -439,9 +439,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
439 struct nf_flowtable *flow_table = priv; 439 struct nf_flowtable *flow_table = priv;
440 struct flow_offload_tuple tuple = {}; 440 struct flow_offload_tuple tuple = {};
441 enum flow_offload_tuple_dir dir; 441 enum flow_offload_tuple_dir dir;
442 const struct in6_addr *nexthop;
442 struct flow_offload *flow; 443 struct flow_offload *flow;
443 struct net_device *outdev; 444 struct net_device *outdev;
444 struct in6_addr *nexthop;
445 struct ipv6hdr *ip6h; 445 struct ipv6hdr *ip6h;
446 struct rt6_info *rt; 446 struct rt6_info *rt;
447 447
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index a29d66da7394..5f78df080573 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2401,6 +2401,9 @@ static void tpacket_destruct_skb(struct sk_buff *skb)
2401 2401
2402 ts = __packet_set_timestamp(po, ph, skb); 2402 ts = __packet_set_timestamp(po, ph, skb);
2403 __packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts); 2403 __packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts);
2404
2405 if (!packet_read_pending(&po->tx_ring))
2406 complete(&po->skb_completion);
2404 } 2407 }
2405 2408
2406 sock_wfree(skb); 2409 sock_wfree(skb);
@@ -2585,7 +2588,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame,
2585 2588
2586static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) 2589static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2587{ 2590{
2588 struct sk_buff *skb; 2591 struct sk_buff *skb = NULL;
2589 struct net_device *dev; 2592 struct net_device *dev;
2590 struct virtio_net_hdr *vnet_hdr = NULL; 2593 struct virtio_net_hdr *vnet_hdr = NULL;
2591 struct sockcm_cookie sockc; 2594 struct sockcm_cookie sockc;
@@ -2600,6 +2603,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2600 int len_sum = 0; 2603 int len_sum = 0;
2601 int status = TP_STATUS_AVAILABLE; 2604 int status = TP_STATUS_AVAILABLE;
2602 int hlen, tlen, copylen = 0; 2605 int hlen, tlen, copylen = 0;
2606 long timeo = 0;
2603 2607
2604 mutex_lock(&po->pg_vec_lock); 2608 mutex_lock(&po->pg_vec_lock);
2605 2609
@@ -2646,12 +2650,21 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2646 if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr) 2650 if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr)
2647 size_max = dev->mtu + reserve + VLAN_HLEN; 2651 size_max = dev->mtu + reserve + VLAN_HLEN;
2648 2652
2653 reinit_completion(&po->skb_completion);
2654
2649 do { 2655 do {
2650 ph = packet_current_frame(po, &po->tx_ring, 2656 ph = packet_current_frame(po, &po->tx_ring,
2651 TP_STATUS_SEND_REQUEST); 2657 TP_STATUS_SEND_REQUEST);
2652 if (unlikely(ph == NULL)) { 2658 if (unlikely(ph == NULL)) {
2653 if (need_wait && need_resched()) 2659 if (need_wait && skb) {
2654 schedule(); 2660 timeo = sock_sndtimeo(&po->sk, msg->msg_flags & MSG_DONTWAIT);
2661 timeo = wait_for_completion_interruptible_timeout(&po->skb_completion, timeo);
2662 if (timeo <= 0) {
2663 err = !timeo ? -ETIMEDOUT : -ERESTARTSYS;
2664 goto out_put;
2665 }
2666 }
2667 /* check for additional frames */
2655 continue; 2668 continue;
2656 } 2669 }
2657 2670
@@ -3207,6 +3220,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
3207 sock_init_data(sock, sk); 3220 sock_init_data(sock, sk);
3208 3221
3209 po = pkt_sk(sk); 3222 po = pkt_sk(sk);
3223 init_completion(&po->skb_completion);
3210 sk->sk_family = PF_PACKET; 3224 sk->sk_family = PF_PACKET;
3211 po->num = proto; 3225 po->num = proto;
3212 po->xmit = dev_queue_xmit; 3226 po->xmit = dev_queue_xmit;
@@ -4314,7 +4328,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
4314 req3->tp_sizeof_priv || 4328 req3->tp_sizeof_priv ||
4315 req3->tp_feature_req_word) { 4329 req3->tp_feature_req_word) {
4316 err = -EINVAL; 4330 err = -EINVAL;
4317 goto out; 4331 goto out_free_pg_vec;
4318 } 4332 }
4319 } 4333 }
4320 break; 4334 break;
@@ -4378,6 +4392,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
4378 prb_shutdown_retire_blk_timer(po, rb_queue); 4392 prb_shutdown_retire_blk_timer(po, rb_queue);
4379 } 4393 }
4380 4394
4395out_free_pg_vec:
4381 if (pg_vec) 4396 if (pg_vec)
4382 free_pg_vec(pg_vec, order, req->tp_block_nr); 4397 free_pg_vec(pg_vec, order, req->tp_block_nr);
4383out: 4398out:
diff --git a/net/packet/internal.h b/net/packet/internal.h
index 3bb7c5fb3bff..c70a2794456f 100644
--- a/net/packet/internal.h
+++ b/net/packet/internal.h
@@ -128,6 +128,7 @@ struct packet_sock {
128 unsigned int tp_hdrlen; 128 unsigned int tp_hdrlen;
129 unsigned int tp_reserve; 129 unsigned int tp_reserve;
130 unsigned int tp_tstamp; 130 unsigned int tp_tstamp;
131 struct completion skb_completion;
131 struct net_device __rcu *cached_dev; 132 struct net_device __rcu *cached_dev;
132 int (*xmit)(struct sk_buff *skb); 133 int (*xmit)(struct sk_buff *skb);
133 struct packet_type prot_hook ____cacheline_aligned_in_smp; 134 struct packet_type prot_hook ____cacheline_aligned_in_smp;
diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
index e16a3d37d2bc..732e109c3055 100644
--- a/net/sched/sch_cbs.c
+++ b/net/sched/sch_cbs.c
@@ -549,12 +549,17 @@ static struct notifier_block cbs_device_notifier = {
549 549
550static int __init cbs_module_init(void) 550static int __init cbs_module_init(void)
551{ 551{
552 int err = register_netdevice_notifier(&cbs_device_notifier); 552 int err;
553 553
554 err = register_netdevice_notifier(&cbs_device_notifier);
554 if (err) 555 if (err)
555 return err; 556 return err;
556 557
557 return register_qdisc(&cbs_qdisc_ops); 558 err = register_qdisc(&cbs_qdisc_ops);
559 if (err)
560 unregister_netdevice_notifier(&cbs_device_notifier);
561
562 return err;
558} 563}
559 564
560static void __exit cbs_module_exit(void) 565static void __exit cbs_module_exit(void)
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index e358437ba29b..69cebb2c998b 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -118,10 +118,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
118 /* Initialize the bind addr area */ 118 /* Initialize the bind addr area */
119 sctp_bind_addr_init(&ep->base.bind_addr, 0); 119 sctp_bind_addr_init(&ep->base.bind_addr, 0);
120 120
121 /* Remember who we are attached to. */
122 ep->base.sk = sk;
123 sock_hold(ep->base.sk);
124
125 /* Create the lists of associations. */ 121 /* Create the lists of associations. */
126 INIT_LIST_HEAD(&ep->asocs); 122 INIT_LIST_HEAD(&ep->asocs);
127 123
@@ -154,6 +150,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
154 ep->prsctp_enable = net->sctp.prsctp_enable; 150 ep->prsctp_enable = net->sctp.prsctp_enable;
155 ep->reconf_enable = net->sctp.reconf_enable; 151 ep->reconf_enable = net->sctp.reconf_enable;
156 152
153 /* Remember who we are attached to. */
154 ep->base.sk = sk;
155 sock_hold(ep->base.sk);
156
157 return ep; 157 return ep;
158 158
159nomem_shkey: 159nomem_shkey:
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 0c874e996f85..7621ec2f539c 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -2029,7 +2029,7 @@ static int __init smc_init(void)
2029 2029
2030 rc = smc_pnet_init(); 2030 rc = smc_pnet_init();
2031 if (rc) 2031 if (rc)
2032 return rc; 2032 goto out_pernet_subsys;
2033 2033
2034 rc = smc_llc_init(); 2034 rc = smc_llc_init();
2035 if (rc) { 2035 if (rc) {
@@ -2080,6 +2080,9 @@ out_proto:
2080 proto_unregister(&smc_proto); 2080 proto_unregister(&smc_proto);
2081out_pnet: 2081out_pnet:
2082 smc_pnet_exit(); 2082 smc_pnet_exit();
2083out_pernet_subsys:
2084 unregister_pernet_subsys(&smc_net_ops);
2085
2083 return rc; 2086 return rc;
2084} 2087}
2085 2088
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 2d2850adc2a3..4ca50ddf8d16 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -652,7 +652,10 @@ create:
652 rc = smc_lgr_create(smc, ini); 652 rc = smc_lgr_create(smc, ini);
653 if (rc) 653 if (rc)
654 goto out; 654 goto out;
655 lgr = conn->lgr;
656 write_lock_bh(&lgr->conns_lock);
655 smc_lgr_register_conn(conn); /* add smc conn to lgr */ 657 smc_lgr_register_conn(conn); /* add smc conn to lgr */
658 write_unlock_bh(&lgr->conns_lock);
656 } 659 }
657 conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE; 660 conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE;
658 conn->local_tx_ctrl.len = SMC_WR_TX_SIZE; 661 conn->local_tx_ctrl.len = SMC_WR_TX_SIZE;
diff --git a/net/tipc/core.c b/net/tipc/core.c
index ed536c05252a..c8370722f0bb 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -134,7 +134,7 @@ static int __init tipc_init(void)
134 if (err) 134 if (err)
135 goto out_sysctl; 135 goto out_sysctl;
136 136
137 err = register_pernet_subsys(&tipc_net_ops); 137 err = register_pernet_device(&tipc_net_ops);
138 if (err) 138 if (err)
139 goto out_pernet; 139 goto out_pernet;
140 140
@@ -142,7 +142,7 @@ static int __init tipc_init(void)
142 if (err) 142 if (err)
143 goto out_socket; 143 goto out_socket;
144 144
145 err = register_pernet_subsys(&tipc_topsrv_net_ops); 145 err = register_pernet_device(&tipc_topsrv_net_ops);
146 if (err) 146 if (err)
147 goto out_pernet_topsrv; 147 goto out_pernet_topsrv;
148 148
@@ -153,11 +153,11 @@ static int __init tipc_init(void)
153 pr_info("Started in single node mode\n"); 153 pr_info("Started in single node mode\n");
154 return 0; 154 return 0;
155out_bearer: 155out_bearer:
156 unregister_pernet_subsys(&tipc_topsrv_net_ops); 156 unregister_pernet_device(&tipc_topsrv_net_ops);
157out_pernet_topsrv: 157out_pernet_topsrv:
158 tipc_socket_stop(); 158 tipc_socket_stop();
159out_socket: 159out_socket:
160 unregister_pernet_subsys(&tipc_net_ops); 160 unregister_pernet_device(&tipc_net_ops);
161out_pernet: 161out_pernet:
162 tipc_unregister_sysctl(); 162 tipc_unregister_sysctl();
163out_sysctl: 163out_sysctl:
@@ -172,9 +172,9 @@ out_netlink:
172static void __exit tipc_exit(void) 172static void __exit tipc_exit(void)
173{ 173{
174 tipc_bearer_cleanup(); 174 tipc_bearer_cleanup();
175 unregister_pernet_subsys(&tipc_topsrv_net_ops); 175 unregister_pernet_device(&tipc_topsrv_net_ops);
176 tipc_socket_stop(); 176 tipc_socket_stop();
177 unregister_pernet_subsys(&tipc_net_ops); 177 unregister_pernet_device(&tipc_net_ops);
178 tipc_netlink_stop(); 178 tipc_netlink_stop();
179 tipc_netlink_compat_stop(); 179 tipc_netlink_compat_stop();
180 tipc_unregister_sysctl(); 180 tipc_unregister_sysctl();
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index c6a04c09d075..cf155061c472 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd,
445 if (!bearer) 445 if (!bearer)
446 return -EMSGSIZE; 446 return -EMSGSIZE;
447 447
448 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME); 448 len = TLV_GET_DATA_LEN(msg->req);
449 if (len <= 0)
450 return -EINVAL;
451
452 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
449 if (!string_is_valid(name, len)) 453 if (!string_is_valid(name, len))
450 return -EINVAL; 454 return -EINVAL;
451 455
@@ -539,7 +543,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg,
539 543
540 name = (char *)TLV_DATA(msg->req); 544 name = (char *)TLV_DATA(msg->req);
541 545
542 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); 546 len = TLV_GET_DATA_LEN(msg->req);
547 if (len <= 0)
548 return -EINVAL;
549
550 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
543 if (!string_is_valid(name, len)) 551 if (!string_is_valid(name, len))
544 return -EINVAL; 552 return -EINVAL;
545 553
@@ -817,7 +825,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd,
817 if (!link) 825 if (!link)
818 return -EMSGSIZE; 826 return -EMSGSIZE;
819 827
820 len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); 828 len = TLV_GET_DATA_LEN(msg->req);
829 if (len <= 0)
830 return -EINVAL;
831
832 len = min_t(int, len, TIPC_MAX_BEARER_NAME);
821 if (!string_is_valid(name, len)) 833 if (!string_is_valid(name, len))
822 return -EINVAL; 834 return -EINVAL;
823 835
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index fc81ae18cc44..e2b69e805d46 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -279,7 +279,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
279 goto skip_tx_cleanup; 279 goto skip_tx_cleanup;
280 } 280 }
281 281
282 if (!tls_complete_pending_work(sk, ctx, 0, &timeo)) 282 if (unlikely(sk->sk_write_pending) &&
283 !wait_on_pending_writer(sk, &timeo))
283 tls_handle_open_record(sk, 0); 284 tls_handle_open_record(sk, 0);
284 285
285 /* We need these for tls_sw_fallback handling of other packets */ 286 /* We need these for tls_sw_fallback handling of other packets */