History

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

Pull networking fixes from David Miller: "Another week, another set of bug fixes: 1) Fix pskb_pull length in __xfrm_transport_prep(), from Xin Long. 2) Fix double xfrm_state put in esp{4,6}_gro_receive(), also from Xin Long. 3) Re-arm discovery timer properly in mac80211 mesh code, from Linus Lüssing. 4) Prevent buffer overflows in nf_conntrack_pptp debug code, from Pablo Neira Ayuso. 5) Fix race in ktls code between tls_sw_recvmsg() and tls_decrypt_done(), from Vinay Kumar Yadav. 6) Fix crashes on TCP fallback in MPTCP code, from Paolo Abeni. 7) More validation is necessary of untrusted GSO packets coming from virtualization devices, from Willem de Bruijn. 8) Fix endianness of bnxt_en firmware message length accesses, from Edwin Peer. 9) Fix infinite loop in sch_fq_pie, from Davide Caratti. 10) Fix lockdep splat in DSA by setting lockless TX in netdev features for slave ports, from Vladimir Oltean. 11) Fix suspend/resume crashes in mlx5, from Mark Bloch. 12) Fix use after free in bpf fmod_ret, from Alexei Starovoitov. 13) ARP retransmit timer guard uses wrong offset, from Hongbin Liu. 14) Fix leak in inetdev_init(), from Yang Yingliang. 15) Don't try to use inet hash and unhash in l2tp code, results in crashes. From Eric Dumazet" * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits) l2tp: add sk_family checks to l2tp_validate_socket l2tp: do not use inet_hash()/inet_unhash() net: qrtr: Allocate workqueue before kernel_bind mptcp: remove msk from the token container at destruction time. mptcp: fix race between MP_JOIN and close mptcp: fix unblocking connect() net/sched: act_ct: add nat mangle action only for NAT-conntrack devinet: fix memleak in inetdev_init() virtio_vsock: Fix race condition in virtio_transport_recv_pkt drivers/net/ibmvnic: Update VNIC protocol version reporting NFC: st21nfca: add missed kfree_skb() in an error path neigh: fix ARP retransmit timer guard bpf, selftests: Add a verifier test for assigning 32bit reg states to 64bit ones bpf, selftests: Verifier bounds tests need to be updated bpf: Fix a verifier issue when assigning 32bit reg states to 64bit ones bpf: Fix use-after-free in fmod_ret check net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta() net/mlx5e: Fix MLX5_TC_CT dependencies net/mlx5e: Properly set default values when disabling adaptive moderation net/mlx5e: Fix arch depending casting issue in FEC ...

Linus Torvalds committed 6 years ago

Commit 19835b12 parents ffeb595 d9a81a269 files · +806 −337Browse files

Unified · Split

69 files
  1. arch/powerpc/Kconfig +1 −0
  2. drivers/crypto/chelsio/chtls/chtls_io.c +1 −1
  3. drivers/net/bonding/bond_sysfs_slave.c +3 −1
  4. drivers/net/dsa/ocelot/felix.c +6 −2
  5. drivers/net/ethernet/broadcom/bnxt/bnxt.c +5 −11
  6. drivers/net/ethernet/broadcom/bnxt/bnxt.h +0 −5
  7. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +5 −4
  8. drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +1 −1
  9. drivers/net/ethernet/ibm/ibmvnic.c +3 −5
  10. drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 −1
  11. drivers/net/ethernet/mellanox/mlx5/core/en.h +6 −4
  12. drivers/net/ethernet/mellanox/mlx5/core/en/port.c +13 −11
  13. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +28 −13
  14. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +14 −6
  15. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +4 −8
  16. drivers/net/ethernet/mellanox/mlx5/core/main.c +18 −0
  17. drivers/net/ethernet/netronome/nfp/flower/offload.c +2 −1
  18. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +3 −1
  19. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 −1
  20. drivers/net/usb/qmi_wwan.c +1 −0
  21. drivers/nfc/st21nfca/dep.c +3 −1
  22. include/linux/ieee80211.h +1 −1
  23. include/linux/netfilter/nf_conntrack_pptp.h +1 −1
  24. include/linux/virtio_net.h +18 −7
  25. include/net/espintcp.h +1 −0
  26. include/net/ip_fib.h +12 −0
  27. include/net/nexthop.h +84 −16
  28. include/net/tls.h +4 −0
  29. include/uapi/linux/xfrm.h +1 −1
  30. kernel/bpf/verifier.c +16 −18
  31. net/bridge/br_multicast.c +2 −1
  32. net/bridge/netfilter/nft_reject_bridge.c +6 −0
  33. net/core/neighbour.c +2 −2
  34. net/dsa/slave.c +1 −0
  35. net/ipv4/devinet.c +1 −0
  36. net/ipv4/esp4_offload.c +18 −12
  37. net/ipv4/fib_frontend.c +10 −9
  38. net/ipv4/fib_trie.c +36 −15
  39. net/ipv4/ip_vti.c +22 −1
  40. net/ipv4/netfilter/nf_nat_pptp.c +2 −5
  41. net/ipv4/nexthop.c +63 −39
  42. net/ipv6/esp6_offload.c +25 −12
  43. net/l2tp/l2tp_core.c +3 −0
  44. net/l2tp/l2tp_ip.c +22 −7
  45. net/l2tp/l2tp_ip6.c +22 −8
  46. net/mac80211/mesh_hwmp.c +7 −0
  47. net/mptcp/protocol.c +48 −19
  48. net/netfilter/ipset/ip_set_list_set.c +1 −1
  49. net/netfilter/nf_conntrack_core.c +73 −7
  50. net/netfilter/nf_conntrack_pptp.c +35 −27
  51. net/netfilter/nfnetlink_cthelper.c +2 −1
  52. net/qrtr/ns.c +5 −5
  53. net/sched/act_ct.c +3 −0
  54. net/sched/sch_fq_pie.c +2 −2
  55. net/sctp/Kconfig +1 −1
  56. net/sctp/ulpevent.c +3 −0
  57. net/tls/tls_sw.c +27 −6
  58. net/vmw_vsock/af_vsock.c +1 −1
  59. net/vmw_vsock/virtio_transport_common.c +8 −0
  60. net/wireless/core.c +1 −1
  61. net/xdp/xdp_umem.c +6 −2
  62. net/xfrm/espintcp.c +2 −0
  63. net/xfrm/xfrm_device.c +3 −5
  64. net/xfrm/xfrm_input.c +1 −1
  65. net/xfrm/xfrm_interface.c +21 −0
  66. net/xfrm/xfrm_output.c +9 −6
  67. net/xfrm/xfrm_policy.c +1 −6
  68. tools/testing/selftests/bpf/verifier/bounds.c +32 −14
  69. tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_pie.json +21 −0
arch/powerpc/Kconfig+1−0
@@ -126,6 +126,7 @@ config PPC · 125 unmodified lines
126126 select ARCH_HAS_MMIOWB if PPC64
127127 select ARCH_HAS_PHYS_TO_DMA
128128 select ARCH_HAS_PMEM_API
129+ select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
129130 select ARCH_HAS_PTE_DEVMAP if PPC_BOOK3S_64
130131 select ARCH_HAS_PTE_SPECIAL
131132 select ARCH_HAS_MEMBARRIER_CALLBACKS
drivers/crypto/chelsio/chtls/chtls_io.c+1−1
@@ -682,7 +682,7 @@ int chtls_push_frames(struct chtls_sock *csk, int comp) · 681 unmodified lines
682682 make_tx_data_wr(sk, skb, immdlen, len,
683683 credits_needed, completion);
684684 tp->snd_nxt += len;
685− tp->lsndtime = tcp_time_stamp(tp);
685+ tp->lsndtime = tcp_jiffies32;
686686 if (completion)
687687 ULP_SKB_CB(skb)->flags &= ~ULPCB_FLAG_NEED_HDR;
688688 } else {
drivers/net/bonding/bond_sysfs_slave.c+3−1
@@ -149,8 +149,10 @@ int bond_sysfs_slave_add(struct slave *slave) · 148 unmodified lines
149149
150150 err = kobject_init_and_add(&slave->kobj, &slave_ktype,
151151 &(slave->dev->dev.kobj), "bonding_slave");
152− if (err)
152+ if (err) {
153+ kobject_put(&slave->kobj);
153154 return err;
155+ }
154156
155157 for (a = slave_attrs; *a; ++a) {
156158 err = sysfs_create_file(&slave->kobj, &((*a)->attr));
drivers/net/dsa/ocelot/felix.c+6−2
@@ -102,13 +102,17 @@ static void felix_vlan_add(struct dsa_switch *ds, int port, · 101 unmodified lines
102102 const struct switchdev_obj_port_vlan *vlan)
103103 {
104104 struct ocelot *ocelot = ds->priv;
105+ u16 flags = vlan->flags;
105106 u16 vid;
106107 int err;
107108
109+ if (dsa_is_cpu_port(ds, port))
110+ flags &= ~BRIDGE_VLAN_INFO_UNTAGGED;
111+
108112 for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
109113 err = ocelot_vlan_add(ocelot, port, vid,
110− vlan->flags & BRIDGE_VLAN_INFO_PVID,
111− vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED);
114+ flags & BRIDGE_VLAN_INFO_PVID,
115+ flags & BRIDGE_VLAN_INFO_UNTAGGED);
112116 if (err) {
113117 dev_err(ds->dev, "Failed to add VLAN %d to port %d: %d\n",
114118 vid, port, err);
drivers/net/ethernet/broadcom/bnxt/bnxt.c+5−11
@@ -4176,14 +4176,12 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 4175 unmodified lines
41764176 int i, intr_process, rc, tmo_count;
41774177 struct input *req = msg;
41784178 u32 *data = msg;
4179− __le32 *resp_len;
41804179 u8 *valid;
41814180 u16 cp_ring_id, len = 0;
41824181 struct hwrm_err_output *resp = bp->hwrm_cmd_resp_addr;
41834182 u16 max_req_len = BNXT_HWRM_MAX_REQ_LEN;
41844183 struct hwrm_short_input short_input = {0};
41854184 u32 doorbell_offset = BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER;
4186− u8 *resp_addr = (u8 *)bp->hwrm_cmd_resp_addr;
41874185 u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
41884186 u16 dst = BNXT_HWRM_CHNL_CHIMP;
41894187
@@ -4201,7 +4199,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 11 unmodified lines
42014199 bar_offset = BNXT_GRCPF_REG_KONG_COMM;
42024200 doorbell_offset = BNXT_GRCPF_REG_KONG_COMM_TRIGGER;
42034201 resp = bp->hwrm_cmd_kong_resp_addr;
4204− resp_addr = (u8 *)bp->hwrm_cmd_kong_resp_addr;
42054202 }
42064203
42074204 memset(resp, 0, PAGE_SIZE);
@@ -4270,7 +4267,6 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 62 unmodified lines
42704267 tmo_count = HWRM_SHORT_TIMEOUT_COUNTER;
42714268 timeout = timeout - HWRM_SHORT_MIN_TIMEOUT * HWRM_SHORT_TIMEOUT_COUNTER;
42724269 tmo_count += DIV_ROUND_UP(timeout, HWRM_MIN_TIMEOUT);
4273− resp_len = (__le32 *)(resp_addr + HWRM_RESP_LEN_OFFSET);
42744270
42754271 if (intr_process) {
42764272 u16 seq_id = bp->hwrm_intr_seq_id;
@@ -4298,9 +4294,8 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 21 unmodified lines
42984294 le16_to_cpu(req->req_type));
42994295 return -EBUSY;
43004296 }
4301− len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
4302− HWRM_RESP_LEN_SFT;
4303− valid = resp_addr + len - 1;
4297+ len = le16_to_cpu(resp->resp_len);
4298+ valid = ((u8 *)resp) + len - 1;
43044299 } else {
43054300 int j;
43064301
@@ -4311,8 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 4 unmodified lines
43114306 */
43124307 if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
43134308 return -EBUSY;
4314− len = (le32_to_cpu(*resp_len) & HWRM_RESP_LEN_MASK) >>
4315− HWRM_RESP_LEN_SFT;
4309+ len = le16_to_cpu(resp->resp_len);
43164310 if (len)
43174311 break;
43184312 /* on first few passes, just barely sleep */
@@ -4334,7 +4328,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len, · 15 unmodified lines
43344328 }
43354329
43364330 /* Last byte of resp contains valid bit */
4337− valid = resp_addr + len - 1;
4331+ valid = ((u8 *)resp) + len - 1;
43384332 for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
43394333 /* make sure we read from updated DMA memory */
43404334 dma_rmb();
@@ -9310,7 +9304,7 @@ static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init, · 4969 unmodified lines
93109304 bnxt_free_skbs(bp);
93119305
93129306 /* Save ring stats before shutdown */
9313− if (bp->bnapi)
9307+ if (bp->bnapi && irq_re_init)
93149308 bnxt_get_ring_stats(bp, &bp->net_stats_prev);
93159309 if (irq_re_init) {
93169310 bnxt_free_irq(bp);
drivers/net/ethernet/broadcom/bnxt/bnxt.h+0−5
@@ -656,11 +656,6 @@ struct nqe_cn { · 655 unmodified lines
656656 #define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
657657 #define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
658658 #define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12)
659−#define HWRM_RESP_ERR_CODE_MASK 0xffff
660−#define HWRM_RESP_LEN_OFFSET 4
661−#define HWRM_RESP_LEN_MASK 0xffff0000
662−#define HWRM_RESP_LEN_SFT 16
663−#define HWRM_RESP_VALID_MASK 0xff000000
664659 #define BNXT_HWRM_REQ_MAX_SIZE 128
665660 #define BNXT_HWRM_REQS_PER_PAGE (BNXT_PAGE_SIZE / \
666661 BNXT_HWRM_REQ_MAX_SIZE)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+5−4
@@ -2012,11 +2012,12 @@ int bnxt_flash_package_from_file(struct net_device *dev, const char *filename, · 2011 unmodified lines
20122012
20132013 bnxt_hwrm_fw_set_time(bp);
20142014
2015− if (bnxt_find_nvram_item(dev, BNX_DIR_TYPE_UPDATE,
2016− BNX_DIR_ORDINAL_FIRST, BNX_DIR_EXT_NONE,
2017− &index, &item_len, NULL) != 0) {
2015+ rc = bnxt_find_nvram_item(dev, BNX_DIR_TYPE_UPDATE,
2016+ BNX_DIR_ORDINAL_FIRST, BNX_DIR_EXT_NONE,
2017+ &index, &item_len, NULL);
2018+ if (rc) {
20182019 netdev_err(dev, "PKG update area not created in nvram\n");
2019− return -ENOBUFS;
2020+ return rc;
20202021 }
20212022
20222023 rc = request_firmware(&fw, filename, &dev->dev);
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c+1−1
@@ -2914,7 +2914,7 @@ static int dpaa_eth_probe(struct platform_device *pdev) · 2913 unmodified lines
29142914 }
29152915
29162916 /* Do this here, so we can be verbose early */
2917− SET_NETDEV_DEV(net_dev, dev);
2917+ SET_NETDEV_DEV(net_dev, dev->parent);
29182918 dev_set_drvdata(dev, net_dev);
29192919
29202920 priv = netdev_priv(net_dev);
drivers/net/ethernet/ibm/ibmvnic.c+3−5
@@ -4678,12 +4678,10 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq, · 4677 unmodified lines
46784678 dev_err(dev, "Error %ld in VERSION_EXCHG_RSP\n", rc);
46794679 break;
46804680 }
4681− dev_info(dev, "Partner protocol version is %d\n",
4682− crq->version_exchange_rsp.version);
4683− if (be16_to_cpu(crq->version_exchange_rsp.version) <
4684− ibmvnic_version)
4685− ibmvnic_version =
4681+ ibmvnic_version =
46864682 be16_to_cpu(crq->version_exchange_rsp.version);
4683+ dev_info(dev, "Partner protocol version is %d\n",
4684+ ibmvnic_version);
46874685 send_cap_queries(adapter);
46884686 break;
46894687 case QUERY_CAPABILITY_RSP:
drivers/net/ethernet/mellanox/mlx5/core/Kconfig+1−1
@@ -80,7 +80,7 @@ config MLX5_ESWITCH · 79 unmodified lines
8080
8181 config MLX5_TC_CT
8282 bool "MLX5 TC connection tracking offload support"
83− depends on MLX5_CORE_EN && NET_SWITCHDEV && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT
83+ depends on MLX5_ESWITCH && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT
8484 default y
8585 help
8686 Say Y here if you want to support offloading connection tracking rules
drivers/net/ethernet/mellanox/mlx5/core/en.h+6−4
@@ -1068,10 +1068,12 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv); · 1067 unmodified lines
10681068
10691069 void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
10701070 int num_channels);
1071−void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params,
1072− u8 cq_period_mode);
1073−void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
1074− u8 cq_period_mode);
1071+
1072+void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
1073+void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
1074+void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
1075+void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
1076+
10751077 void mlx5e_set_rq_type(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
10761078 void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev,
10771079 struct mlx5e_params *params);
drivers/net/ethernet/mellanox/mlx5/core/en/port.c+13−11
@@ -369,17 +369,19 @@ enum mlx5e_fec_supported_link_mode { · 368 unmodified lines
369369 *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \
370370 } while (0)
371371
372−#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \
373− do { \
374− u16 *__policy = &(policy); \
375− bool _write = (write); \
376− \
377− if (_write && *__policy) \
378− *__policy = find_first_bit((u_long *)__policy, \
379− sizeof(u16) * BITS_PER_BYTE);\
380− MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \
381− if (!_write && *__policy) \
382− *__policy = 1 << *__policy; \
372+#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \
373+ do { \
374+ unsigned long policy_long; \
375+ u16 *__policy = &(policy); \
376+ bool _write = (write); \
377+ \
378+ policy_long = *__policy; \
379+ if (_write && *__policy) \
380+ *__policy = find_first_bit(&policy_long, \
381+ sizeof(policy_long) * BITS_PER_BYTE);\
382+ MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \
383+ if (!_write && *__policy) \
384+ *__policy = 1 << *__policy; \
383385 } while (0)
384386
385387 /* get/set FEC admin field for a given speed */
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+28−13
@@ -527,8 +527,8 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, · 526 unmodified lines
527527 struct dim_cq_moder *rx_moder, *tx_moder;
528528 struct mlx5_core_dev *mdev = priv->mdev;
529529 struct mlx5e_channels new_channels = {};
530+ bool reset_rx, reset_tx;
530531 int err = 0;
531− bool reset;
532532
533533 if (!MLX5_CAP_GEN(mdev, cq_moderation))
534534 return -EOPNOTSUPP;
@@ -566,15 +566,28 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, · 31 unmodified lines
566566 }
567567 /* we are opened */
568568
569− reset = (!!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled) ||
570− (!!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled);
569+ reset_rx = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
570+ reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled;
571571
572− if (!reset) {
572+ if (!reset_rx && !reset_tx) {
573573 mlx5e_set_priv_channels_coalesce(priv, coal);
574574 priv->channels.params = new_channels.params;
575575 goto out;
576576 }
577577
578+ if (reset_rx) {
579+ u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
580+ MLX5E_PFLAG_RX_CQE_BASED_MODER);
581+
582+ mlx5e_reset_rx_moderation(&new_channels.params, mode);
583+ }
584+ if (reset_tx) {
585+ u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
586+ MLX5E_PFLAG_TX_CQE_BASED_MODER);
587+
588+ mlx5e_reset_tx_moderation(&new_channels.params, mode);
589+ }
590+
578591 err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL);
579592
580593 out:
@@ -665,11 +678,12 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = { · 84 unmodified lines
665678 static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
666679 struct ethtool_link_ksettings *link_ksettings)
667680 {
668− u_long active_fec = 0;
681+ unsigned long active_fec_long;
682+ u32 active_fec;
669683 u32 bitn;
670684 int err;
671685
672− err = mlx5e_get_fec_mode(dev, (u32 *)&active_fec, NULL);
686+ err = mlx5e_get_fec_mode(dev, &active_fec, NULL);
673687 if (err)
674688 return (err == -EOPNOTSUPP) ? 0 : err;
675689
@@ -682,10 +696,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, · 6 unmodified lines
682696 MLX5E_ADVERTISE_SUPPORTED_FEC(MLX5E_FEC_LLRS_272_257_1,
683697 ETHTOOL_LINK_MODE_FEC_LLRS_BIT);
684698
699+ active_fec_long = active_fec;
685700 /* active fec is a bit set, find out which bit is set and
686701 * advertise the corresponding ethtool bit
687702 */
688− bitn = find_first_bit(&active_fec, sizeof(u32) * BITS_PER_BYTE);
703+ bitn = find_first_bit(&active_fec_long, sizeof(active_fec_long) * BITS_PER_BYTE);
689704 if (bitn < ARRAY_SIZE(pplm_fec_2_ethtool_linkmodes))
690705 __set_bit(pplm_fec_2_ethtool_linkmodes[bitn],
691706 link_ksettings->link_modes.advertising);
@@ -1517,8 +1532,8 @@ static int mlx5e_get_fecparam(struct net_device *netdev, · 825 unmodified lines
15171532 {
15181533 struct mlx5e_priv *priv = netdev_priv(netdev);
15191534 struct mlx5_core_dev *mdev = priv->mdev;
1520− u16 fec_configured = 0;
1521− u32 fec_active = 0;
1535+ u16 fec_configured;
1536+ u32 fec_active;
15221537 int err;
15231538
15241539 err = mlx5e_get_fec_mode(mdev, &fec_active, &fec_configured);
@@ -1526,14 +1541,14 @@ static int mlx5e_get_fecparam(struct net_device *netdev, · 1 unmodified line
15261541 if (err)
15271542 return err;
15281543
1529− fecparam->active_fec = pplm2ethtool_fec((u_long)fec_active,
1530− sizeof(u32) * BITS_PER_BYTE);
1544+ fecparam->active_fec = pplm2ethtool_fec((unsigned long)fec_active,
1545+ sizeof(unsigned long) * BITS_PER_BYTE);
15311546
15321547 if (!fecparam->active_fec)
15331548 return -EOPNOTSUPP;
15341549
1535− fecparam->fec = pplm2ethtool_fec((u_long)fec_configured,
1536− sizeof(u16) * BITS_PER_BYTE);
1550+ fecparam->fec = pplm2ethtool_fec((unsigned long)fec_configured,
1551+ sizeof(unsigned long) * BITS_PER_BYTE);
15371552
15381553 return 0;
15391554 }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+14−6
@@ -4716,7 +4716,7 @@ static u8 mlx5_to_net_dim_cq_period_mode(u8 cq_period_mode) · 4715 unmodified lines
47164716 DIM_CQ_PERIOD_MODE_START_FROM_EQE;
47174717 }
47184718
4719−void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
4719+void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
47204720 {
47214721 if (params->tx_dim_enabled) {
47224722 u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
@@ -4725,13 +4725,9 @@ void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) · 2 unmodified lines
47254725 } else {
47264726 params->tx_cq_moderation = mlx5e_get_def_tx_moderation(cq_period_mode);
47274727 }
4728−
4729− MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
4730− params->tx_cq_moderation.cq_period_mode ==
4731− MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
47324728 }
47334729
4734−void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
4730+void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
47354731 {
47364732 if (params->rx_dim_enabled) {
47374733 u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
@@ -4740,7 +4736,19 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) · 2 unmodified lines
47404736 } else {
47414737 params->rx_cq_moderation = mlx5e_get_def_rx_moderation(cq_period_mode);
47424738 }
4739+}
4740+
4741+void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
4742+{
4743+ mlx5e_reset_tx_moderation(params, cq_period_mode);
4744+ MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
4745+ params->tx_cq_moderation.cq_period_mode ==
4746+ MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
4747+}
47434748
4749+void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
4750+{
4751+ mlx5e_reset_rx_moderation(params, cq_period_mode);
47444752 MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
47454753 params->rx_cq_moderation.cq_period_mode ==
47464754 MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+4−8
@@ -2068,7 +2068,7 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev, · 2067 unmodified lines
20682068 flow_rule_match_meta(rule, &match);
20692069 if (match.mask->ingress_ifindex != 0xFFFFFFFF) {
20702070 NL_SET_ERR_MSG_MOD(extack, "Unsupported ingress ifindex mask");
2071− return -EINVAL;
2071+ return -EOPNOTSUPP;
20722072 }
20732073
20742074 ingress_dev = __dev_get_by_index(dev_net(filter_dev),
@@ -2076,13 +2076,13 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev, · 1 unmodified line
20762076 if (!ingress_dev) {
20772077 NL_SET_ERR_MSG_MOD(extack,
20782078 "Can't find the ingress port to match on");
2079− return -EINVAL;
2079+ return -ENOENT;
20802080 }
20812081
20822082 if (ingress_dev != filter_dev) {
20832083 NL_SET_ERR_MSG_MOD(extack,
20842084 "Can't match on the ingress filter port");
2085− return -EINVAL;
2085+ return -EOPNOTSUPP;
20862086 }
20872087
20882088 return 0;
@@ -3849,10 +3849,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, · 1760 unmodified lines
38493849 if (!mlx5e_is_valid_eswitch_fwd_dev(priv, out_dev)) {
38503850 NL_SET_ERR_MSG_MOD(extack,
38513851 "devices are not on same switch HW, can't offload forwarding");
3852− netdev_warn(priv->netdev,
3853− "devices %s %s not on same switch HW, can't offload forwarding\n",
3854− priv->netdev->name,
3855− out_dev->name);
38563852 return -EOPNOTSUPP;
38573853 }
38583854
@@ -4614,7 +4610,7 @@ void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv, · 755 unmodified lines
46144610 dpkts = cur_stats.rx_packets - rpriv->prev_vf_vport_stats.rx_packets;
46154611 dbytes = cur_stats.rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes;
46164612 rpriv->prev_vf_vport_stats = cur_stats;
4617− flow_stats_update(&ma->stats, dpkts, dbytes, jiffies,
4613+ flow_stats_update(&ma->stats, dbytes, dpkts, jiffies,
46184614 FLOW_ACTION_HW_STATS_DELAYED);
46194615 }
46204616
drivers/net/ethernet/mellanox/mlx5/core/main.c+18−0
@@ -1549,6 +1549,22 @@ static void shutdown(struct pci_dev *pdev) · 1548 unmodified lines
15491549 mlx5_pci_disable_device(dev);
15501550 }
15511551
1552+static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
1553+{
1554+ struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
1555+
1556+ mlx5_unload_one(dev, false);
1557+
1558+ return 0;
1559+}
1560+
1561+static int mlx5_resume(struct pci_dev *pdev)
1562+{
1563+ struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
1564+
1565+ return mlx5_load_one(dev, false);
1566+}
1567+
15521568 static const struct pci_device_id mlx5_core_pci_table[] = {
15531569 { PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) },
15541570 { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */
@@ -1592,6 +1608,8 @@ static struct pci_driver mlx5_core_driver = { · 37 unmodified lines
15921608 .id_table = mlx5_core_pci_table,
15931609 .probe = init_one,
15941610 .remove = remove_one,
1611+ .suspend = mlx5_suspend,
1612+ .resume = mlx5_resume,
15951613 .shutdown = shutdown,
15961614 .err_handler = &mlx5_err_handler,
15971615 .sriov_configure = mlx5_core_sriov_configure,
drivers/net/ethernet/netronome/nfp/flower/offload.c+2−1
@@ -1440,7 +1440,8 @@ __nfp_flower_update_merge_stats(struct nfp_app *app, · 1439 unmodified lines
14401440 ctx_id = be32_to_cpu(sub_flow->meta.host_ctx_id);
14411441 priv->stats[ctx_id].pkts += pkts;
14421442 priv->stats[ctx_id].bytes += bytes;
1443− max_t(u64, priv->stats[ctx_id].used, used);
1443+ priv->stats[ctx_id].used = max_t(u64, used,
1444+ priv->stats[ctx_id].used);
14441445 }
14451446 }
14461447
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+3−1
@@ -3651,7 +3651,7 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) · 3650 unmodified lines
36513651 ahw->diag_cnt = 0;
36523652 ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INTRPT_TEST);
36533653 if (ret)
3654− goto fail_diag_irq;
3654+ goto fail_mbx_args;
36553655
36563656 if (adapter->flags & QLCNIC_MSIX_ENABLED)
36573657 intrpt_id = ahw->intr_tbl[0].id;
@@ -3681,6 +3681,8 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) · 23 unmodified lines
36813681
36823682 done:
36833683 qlcnic_free_mbx_args(&cmd);
3684+
3685+fail_mbx_args:
36843686 qlcnic_83xx_diag_free_res(netdev, drv_sds_rings);
36853687
36863688 fail_diag_irq:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+2−1
@@ -630,7 +630,8 @@ static int stmmac_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) · 629 unmodified lines
630630 config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
631631 ptp_v2 = PTP_TCR_TSVER2ENA;
632632 snap_type_sel = PTP_TCR_SNAPTYPSEL_1;
633− ts_event_en = PTP_TCR_TSEVNTENA;
633+ if (priv->synopsys_id != DWMAC_CORE_5_10)
634+ ts_event_en = PTP_TCR_TSEVNTENA;
634635 ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA;
635636 ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA;
636637 ptp_over_ethernet = PTP_TCR_TSIPENA;
drivers/net/usb/qmi_wwan.c+1−0
@@ -1324,6 +1324,7 @@ static const struct usb_device_id products[] = { · 1323 unmodified lines
13241324 {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
13251325 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
13261326 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
1327+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */
13271328 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
13281329 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
13291330 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
drivers/nfc/st21nfca/dep.c+3−1
@@ -173,8 +173,10 @@ static int st21nfca_tm_send_atr_res(struct nfc_hci_dev *hdev, · 172 unmodified lines
173173 memcpy(atr_res->gbi, atr_req->gbi, gb_len);
174174 r = nfc_set_remote_general_bytes(hdev->ndev, atr_res->gbi,
175175 gb_len);
176− if (r < 0)
176+ if (r < 0) {
177+ kfree_skb(skb);
177178 return r;
179+ }
178180 }
179181
180182 info->dep_info.curr_nfc_dep_pni = 0;
include/linux/ieee80211.h+1−1
@@ -2047,7 +2047,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info) · 2046 unmodified lines
20472047 }
20482048
20492049 /* HE Operation defines */
2050−#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000003
2050+#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000007
20512051 #define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000008
20522052 #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x00003ff0
20532053 #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 4
include/linux/netfilter/nf_conntrack_pptp.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #include <net/netfilter/nf_conntrack_expect.h>
1111 #include <uapi/linux/netfilter/nf_conntrack_tuple_common.h>
1212
13−extern const char *const pptp_msg_name[];
13+const char *pptp_msg_name(u_int16_t msg);
1414
1515 /* state of the control session */
1616 enum pptp_ctrlsess_state {
include/linux/virtio_net.h+18−7
@@ -31,6 +31,7 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · 30 unmodified lines
3131 {
3232 unsigned int gso_type = 0;
3333 unsigned int thlen = 0;
34+ unsigned int p_off = 0;
3435 unsigned int ip_proto;
3536
3637 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
@@ -68,7 +69,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · 31 unmodified lines
6869 if (!skb_partial_csum_set(skb, start, off))
6970 return -EINVAL;
7071
71− if (skb_transport_offset(skb) + thlen > skb_headlen(skb))
72+ p_off = skb_transport_offset(skb) + thlen;
73+ if (p_off > skb_headlen(skb))
7274 return -EINVAL;
7375 } else {
7476 /* gso packets without NEEDS_CSUM do not set transport_offset.
@@ -92,23 +94,32 @@ retry: · 17 unmodified lines
9294 return -EINVAL;
9395 }
9496
95− if (keys.control.thoff + thlen > skb_headlen(skb) ||
97+ p_off = keys.control.thoff + thlen;
98+ if (p_off > skb_headlen(skb) ||
9699 keys.basic.ip_proto != ip_proto)
97100 return -EINVAL;
98101
99102 skb_set_transport_header(skb, keys.control.thoff);
103+ } else if (gso_type) {
104+ p_off = thlen;
105+ if (p_off > skb_headlen(skb))
106+ return -EINVAL;
100107 }
101108 }
102109
103110 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
104111 u16 gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size);
112+ struct skb_shared_info *shinfo = skb_shinfo(skb);
105113
106− skb_shinfo(skb)->gso_size = gso_size;
107− skb_shinfo(skb)->gso_type = gso_type;
114+ /* Too small packets are not really GSO ones. */
115+ if (skb->len - p_off > gso_size) {
116+ shinfo->gso_size = gso_size;
117+ shinfo->gso_type = gso_type;
108118
109− /* Header must be checked, and gso_segs computed. */
110− skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY;
111− skb_shinfo(skb)->gso_segs = 0;
119+ /* Header must be checked, and gso_segs computed. */
120+ shinfo->gso_type |= SKB_GSO_DODGY;
121+ shinfo->gso_segs = 0;
122+ }
112123 }
113124
114125 return 0;
include/net/espintcp.h+1−0
@@ -25,6 +25,7 @@ struct espintcp_ctx { · 24 unmodified lines
2525 struct espintcp_msg partial;
2626 void (*saved_data_ready)(struct sock *sk);
2727 void (*saved_write_space)(struct sock *sk);
28+ void (*saved_destruct)(struct sock *sk);
2829 struct work_struct work;
2930 bool tx_running;
3031 };
include/net/ip_fib.h+12−0
@@ -447,6 +447,16 @@ static inline int fib_num_tclassid_users(struct net *net) · 446 unmodified lines
447447 #endif
448448 int fib_unmerge(struct net *net);
449449
450+static inline bool nhc_l3mdev_matches_dev(const struct fib_nh_common *nhc,
451+const struct net_device *dev)
452+{
453+ if (nhc->nhc_dev == dev ||
454+ l3mdev_master_ifindex_rcu(nhc->nhc_dev) == dev->ifindex)
455+ return true;
456+
457+ return false;
458+}
459+
450460 /* Exported by fib_semantics.c */
451461 int ip_fib_check_default(__be32 gw, struct net_device *dev);
452462 int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force);
@@ -479,6 +489,8 @@ void fib_nh_common_release(struct fib_nh_common *nhc); · 26 unmodified lines
479489 void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri);
480490 void fib_trie_init(void);
481491 struct fib_table *fib_trie_table(u32 id, struct fib_table *alias);
492+bool fib_lookup_good_nhc(const struct fib_nh_common *nhc, int fib_flags,
493+ const struct flowi4 *flp);
482494
483495 static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
484496 {
include/net/nexthop.h+84−16
@@ -70,6 +70,7 @@ struct nh_grp_entry { · 69 unmodified lines
7070 };
7171
7272 struct nh_group {
73+ struct nh_group *spare; /* spare group for removals */
7374 u16 num_nh;
7475 bool mpath;
7576 bool has_v4;
@@ -136,21 +137,20 @@ static inline unsigned int nexthop_num_path(const struct nexthop *nh) · 60 unmodified lines
136137 {
137138 unsigned int rc = 1;
138139
139− if (nexthop_is_multipath(nh)) {
140+ if (nh->is_group) {
140141 struct nh_group *nh_grp;
141142
142143 nh_grp = rcu_dereference_rtnl(nh->nh_grp);
143− rc = nh_grp->num_nh;
144+ if (nh_grp->mpath)
145+ rc = nh_grp->num_nh;
144146 }
145147
146148 return rc;
147149 }
148150
149151 static inline
150−struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
152+struct nexthop *nexthop_mpath_select(const struct nh_group *nhg, int nhsel)
151153 {
152− const struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp);
153−
154154 /* for_nexthops macros in fib_semantics.c grabs a pointer to
155155 * the nexthop before checking nhsel
156156 */
@@ -185,12 +185,14 @@ static inline bool nexthop_is_blackhole(const struct nexthop *nh) · 28 unmodified lines
185185 {
186186 const struct nh_info *nhi;
187187
188− if (nexthop_is_multipath(nh)) {
189− if (nexthop_num_path(nh) > 1)
190− return false;
191− nh = nexthop_mpath_select(nh, 0);
192− if (!nh)
188+ if (nh->is_group) {
189+ struct nh_group *nh_grp;
190+
191+ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
192+ if (nh_grp->num_nh > 1)
193193 return false;
194+
195+ nh = nh_grp->nh_entries[0].nh;
194196 }
195197
196198 nhi = rcu_dereference_rtnl(nh->nh_info);
@@ -216,16 +218,79 @@ struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel) · 19 unmodified lines
216218 BUILD_BUG_ON(offsetof(struct fib_nh, nh_common) != 0);
217219 BUILD_BUG_ON(offsetof(struct fib6_nh, nh_common) != 0);
218220
219− if (nexthop_is_multipath(nh)) {
220− nh = nexthop_mpath_select(nh, nhsel);
221− if (!nh)
222− return NULL;
221+ if (nh->is_group) {
222+ struct nh_group *nh_grp;
223+
224+ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
225+ if (nh_grp->mpath) {
226+ nh = nexthop_mpath_select(nh_grp, nhsel);
227+ if (!nh)
228+ return NULL;
229+ }
223230 }
224231
225232 nhi = rcu_dereference_rtnl(nh->nh_info);
226233 return &nhi->fib_nhc;
227234 }
228235
236+/* called from fib_table_lookup with rcu_lock */
237+static inline
238+struct fib_nh_common *nexthop_get_nhc_lookup(const struct nexthop *nh,
239+ int fib_flags,
240+ const struct flowi4 *flp,
241+ int *nhsel)
242+{
243+ struct nh_info *nhi;
244+
245+ if (nh->is_group) {
246+ struct nh_group *nhg = rcu_dereference(nh->nh_grp);
247+ int i;
248+
249+ for (i = 0; i < nhg->num_nh; i++) {
250+ struct nexthop *nhe = nhg->nh_entries[i].nh;
251+
252+ nhi = rcu_dereference(nhe->nh_info);
253+ if (fib_lookup_good_nhc(&nhi->fib_nhc, fib_flags, flp)) {
254+ *nhsel = i;
255+ return &nhi->fib_nhc;
256+ }
257+ }
258+ } else {
259+ nhi = rcu_dereference(nh->nh_info);
260+ if (fib_lookup_good_nhc(&nhi->fib_nhc, fib_flags, flp)) {
261+ *nhsel = 0;
262+ return &nhi->fib_nhc;
263+ }
264+ }
265+
266+ return NULL;
267+}
268+
269+static inline bool nexthop_uses_dev(const struct nexthop *nh,
270+ const struct net_device *dev)
271+{
272+ struct nh_info *nhi;
273+
274+ if (nh->is_group) {
275+ struct nh_group *nhg = rcu_dereference(nh->nh_grp);
276+ int i;
277+
278+ for (i = 0; i < nhg->num_nh; i++) {
279+ struct nexthop *nhe = nhg->nh_entries[i].nh;
280+
281+ nhi = rcu_dereference(nhe->nh_info);
282+ if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
283+ return true;
284+ }
285+ } else {
286+ nhi = rcu_dereference(nh->nh_info);
287+ if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
288+ return true;
289+ }
290+
291+ return false;
292+}
293+
229294 static inline unsigned int fib_info_num_path(const struct fib_info *fi)
230295 {
231296 if (unlikely(fi->nh))
@@ -263,8 +328,11 @@ static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh) · 31 unmodified lines
263328 {
264329 struct nh_info *nhi;
265330
266− if (nexthop_is_multipath(nh)) {
267− nh = nexthop_mpath_select(nh, 0);
331+ if (nh->is_group) {
332+ struct nh_group *nh_grp;
333+
334+ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
335+ nh = nexthop_mpath_select(nh_grp, 0);
268336 if (!nh)
269337 return NULL;
270338 }
include/net/tls.h+4−0
@@ -135,6 +135,8 @@ struct tls_sw_context_tx { · 134 unmodified lines
135135 struct tls_rec *open_rec;
136136 struct list_head tx_list;
137137 atomic_t encrypt_pending;
138+ /* protect crypto_wait with encrypt_pending */
139+ spinlock_t encrypt_compl_lock;
138140 int async_notify;
139141 u8 async_capable:1;
140142
@@ -155,6 +157,8 @@ struct tls_sw_context_rx { · 14 unmodified lines
155157 u8 async_capable:1;
156158 u8 decrypted:1;
157159 atomic_t decrypt_pending;
160+ /* protect crypto_wait with decrypt_pending*/
161+ spinlock_t decrypt_compl_lock;
158162 bool async_notify;
159163 };
160164
include/uapi/linux/xfrm.h+1−1
@@ -304,7 +304,7 @@ enum xfrm_attr_type_t { · 303 unmodified lines
304304 XFRMA_PROTO, /* __u8 */
305305 XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
306306 XFRMA_PAD,
307− XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */
307+ XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */
308308 XFRMA_SET_MARK, /* __u32 */
309309 XFRMA_SET_MARK_MASK, /* __u32 */
310310 XFRMA_IF_ID, /* __u32 */
kernel/bpf/verifier.c+16−18
@@ -1168,14 +1168,14 @@ static void __reg_assign_32_into_64(struct bpf_reg_state *reg) · 1167 unmodified lines
11681168 * but must be positive otherwise set to worse case bounds
11691169 * and refine later from tnum.
11701170 */
1171− if (reg->s32_min_value > 0)
1172− reg->smin_value = reg->s32_min_value;
1173− else
1174− reg->smin_value = 0;
1175− if (reg->s32_max_value > 0)
1171+ if (reg->s32_min_value >= 0 && reg->s32_max_value >= 0)
11761172 reg->smax_value = reg->s32_max_value;
11771173 else
11781174 reg->smax_value = U32_MAX;
1175+ if (reg->s32_min_value >= 0)
1176+ reg->smin_value = reg->s32_min_value;
1177+ else
1178+ reg->smin_value = 0;
11791179 }
11801180
11811181 static void __reg_combine_32_into_64(struct bpf_reg_state *reg)
@@ -10428,22 +10428,13 @@ static int check_struct_ops_btf_id(struct bpf_verifier_env *env) · 9246 unmodified lines
1042810428 }
1042910429 #define SECURITY_PREFIX "security_"
1043010430
10431−static int check_attach_modify_return(struct bpf_verifier_env *env)
10431+static int check_attach_modify_return(struct bpf_prog *prog, unsigned long addr)
1043210432 {
10433− struct bpf_prog *prog = env->prog;
10434− unsigned long addr = (unsigned long) prog->aux->trampoline->func.addr;
10435−
10436− /* This is expected to be cleaned up in the future with the KRSI effort
10437− * introducing the LSM_HOOK macro for cleaning up lsm_hooks.h.
10438− */
1043910433 if (within_error_injection_list(addr) ||
1044010434 !strncmp(SECURITY_PREFIX, prog->aux->attach_func_name,
1044110435 sizeof(SECURITY_PREFIX) - 1))
1044210436 return 0;
1044310437
10444− verbose(env, "fmod_ret attach_btf_id %u (%s) is not modifiable\n",
10445− prog->aux->attach_btf_id, prog->aux->attach_func_name);
10446−
1044710438 return -EINVAL;
1044810439 }
1044910440
@@ -10654,11 +10645,18 @@ static int check_attach_btf_id(struct bpf_verifier_env *env) · 204 unmodified lines
1065410645 goto out;
1065510646 }
1065610647 }
10648+
10649+ if (prog->expected_attach_type == BPF_MODIFY_RETURN) {
10650+ ret = check_attach_modify_return(prog, addr);
10651+ if (ret)
10652+ verbose(env, "%s() is not modifiable\n",
10653+ prog->aux->attach_func_name);
10654+ }
10655+
10656+ if (ret)
10657+ goto out;
1065710658 tr->func.addr = (void *)addr;
1065810659 prog->aux->trampoline = tr;
10659−
10660− if (prog->expected_attach_type == BPF_MODIFY_RETURN)
10661− ret = check_attach_modify_return(env);
1066210660 out:
1066310661 mutex_unlock(&tr->mutex);
1066410662 if (ret)
net/bridge/br_multicast.c+2−1
@@ -2413,7 +2413,8 @@ void br_multicast_uninit_stats(struct net_bridge *br) · 2412 unmodified lines
24132413 free_percpu(br->mcast_stats);
24142414 }
24152415
2416−static void mcast_stats_add_dir(u64 *dst, u64 *src)
2416+/* noinline for https://bugs.llvm.org/show_bug.cgi?id=45802#c9 */
2417+static noinline_for_stack void mcast_stats_add_dir(u64 *dst, u64 *src)
24172418 {
24182419 dst[BR_MCAST_DIR_RX] += src[BR_MCAST_DIR_RX];
24192420 dst[BR_MCAST_DIR_TX] += src[BR_MCAST_DIR_TX];
net/bridge/netfilter/nft_reject_bridge.c+6−0
@@ -31,6 +31,12 @@ static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb, · 30 unmodified lines
3131 ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source);
3232 eth->h_proto = eth_hdr(oldskb)->h_proto;
3333 skb_pull(nskb, ETH_HLEN);
34+
35+ if (skb_vlan_tag_present(oldskb)) {
36+ u16 vid = skb_vlan_tag_get(oldskb);
37+
38+ __vlan_hwaccel_put_tag(nskb, oldskb->vlan_proto, vid);
39+ }
3440 }
3541
3642 static int nft_bridge_iphdr_validate(struct sk_buff *skb)
net/core/neighbour.c+2−2
@@ -1082,8 +1082,8 @@ static void neigh_timer_handler(struct timer_list *t) · 1081 unmodified lines
10821082 }
10831083
10841084 if (neigh->nud_state & NUD_IN_TIMER) {
1085− if (time_before(next, jiffies + HZ/2))
1086− next = jiffies + HZ/2;
1085+ if (time_before(next, jiffies + HZ/100))
1086+ next = jiffies + HZ/100;
10871087 if (!mod_timer(&neigh->timer, next))
10881088 neigh_hold(neigh);
10891089 }
net/dsa/slave.c+1−0
@@ -1736,6 +1736,7 @@ int dsa_slave_create(struct dsa_port *port) · 1735 unmodified lines
17361736 if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
17371737 slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
17381738 slave_dev->hw_features |= NETIF_F_HW_TC;
1739+ slave_dev->features |= NETIF_F_LLTX;
17391740 slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
17401741 if (!IS_ERR_OR_NULL(port->mac))
17411742 ether_addr_copy(slave_dev->dev_addr, port->mac);
net/ipv4/devinet.c+1−0
@@ -276,6 +276,7 @@ static struct in_device *inetdev_init(struct net_device *dev) · 275 unmodified lines
276276 err = devinet_sysctl_register(in_dev);
277277 if (err) {
278278 in_dev->dead = 1;
279+ neigh_parms_release(&arp_tbl, in_dev->arp_parms);
279280 in_dev_put(in_dev);
280281 in_dev = NULL;
281282 goto out;
net/ipv4/esp4_offload.c+18−12
@@ -63,10 +63,8 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head, · 62 unmodified lines
6363 sp->olen++;
6464
6565 xo = xfrm_offload(skb);
66− if (!xo) {
67− xfrm_state_put(x);
66+ if (!xo)
6867 goto out_reset;
69− }
7068 }
7169
7270 xo->flags |= XFRM_GRO;
@@ -139,19 +137,27 @@ static struct sk_buff *xfrm4_beet_gso_segment(struct xfrm_state *x, · 66 unmodified lines
139137 struct xfrm_offload *xo = xfrm_offload(skb);
140138 struct sk_buff *segs = ERR_PTR(-EINVAL);
141139 const struct net_offload *ops;
142− int proto = xo->proto;
140+ u8 proto = xo->proto;
143141
144142 skb->transport_header += x->props.header_len;
145143
146− if (proto == IPPROTO_BEETPH) {
147− struct ip_beet_phdr *ph = (struct ip_beet_phdr *)skb->data;
144+ if (x->sel.family != AF_INET6) {
145+ if (proto == IPPROTO_BEETPH) {
146+ struct ip_beet_phdr *ph =
147+ (struct ip_beet_phdr *)skb->data;
148+
149+ skb->transport_header += ph->hdrlen * 8;
150+ proto = ph->nexthdr;
151+ } else {
152+ skb->transport_header -= IPV4_BEET_PHMAXLEN;
153+ }
154+ } else {
155+ __be16 frag;
148156
149− skb->transport_header += ph->hdrlen * 8;
150− proto = ph->nexthdr;
151− } else if (x->sel.family != AF_INET6) {
152− skb->transport_header -= IPV4_BEET_PHMAXLEN;
153− } else if (proto == IPPROTO_TCP) {
154− skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
157+ skb->transport_header +=
158+ ipv6_skip_exthdr(skb, 0, &proto, &frag);
159+ if (proto == IPPROTO_TCP)
160+ skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV4;
155161 }
156162
157163 __skb_pull(skb, skb_transport_offset(skb));
net/ipv4/fib_frontend.c+10−9
@@ -309,17 +309,18 @@ bool fib_info_nh_uses_dev(struct fib_info *fi, const struct net_device *dev) · 308 unmodified lines
309309 {
310310 bool dev_match = false;
311311 #ifdef CONFIG_IP_ROUTE_MULTIPATH
312− int ret;
312+ if (unlikely(fi->nh)) {
313+ dev_match = nexthop_uses_dev(fi->nh, dev);
314+ } else {
315+ int ret;
313316
314− for (ret = 0; ret < fib_info_num_path(fi); ret++) {
315− const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
317+ for (ret = 0; ret < fib_info_num_path(fi); ret++) {
318+ const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
316319
317− if (nhc->nhc_dev == dev) {
318− dev_match = true;
319− break;
320− } else if (l3mdev_master_ifindex_rcu(nhc->nhc_dev) == dev->ifindex) {
321− dev_match = true;
322− break;
320+ if (nhc_l3mdev_matches_dev(nhc, dev)) {
321+ dev_match = true;
322+ break;
323+ }
323324 }
324325 }
325326 #else
net/ipv4/fib_trie.c+36−15
@@ -1371,6 +1371,26 @@ static inline t_key prefix_mismatch(t_key key, struct key_vector *n) · 1370 unmodified lines
13711371 return (key ^ prefix) & (prefix | -prefix);
13721372 }
13731373
1374+bool fib_lookup_good_nhc(const struct fib_nh_common *nhc, int fib_flags,
1375+ const struct flowi4 *flp)
1376+{
1377+ if (nhc->nhc_flags & RTNH_F_DEAD)
1378+ return false;
1379+
1380+ if (ip_ignore_linkdown(nhc->nhc_dev) &&
1381+ nhc->nhc_flags & RTNH_F_LINKDOWN &&
1382+ !(fib_flags & FIB_LOOKUP_IGNORE_LINKSTATE))
1383+ return false;
1384+
1385+ if (!(flp->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF)) {
1386+ if (flp->flowi4_oif &&
1387+ flp->flowi4_oif != nhc->nhc_oif)
1388+ return false;
1389+ }
1390+
1391+ return true;
1392+}
1393+
13741394 /* should be called with rcu_read_lock */
13751395 int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
13761396 struct fib_result *res, int fib_flags)
@@ -1503,6 +1523,7 @@ found: · 126 unmodified lines
15031523 /* Step 3: Process the leaf, if that fails fall back to backtracing */
15041524 hlist_for_each_entry_rcu(fa, &n->leaf, fa_list) {
15051525 struct fib_info *fi = fa->fa_info;
1526+ struct fib_nh_common *nhc;
15061527 int nhsel, err;
15071528
15081529 if ((BITS_PER_LONG > KEYLENGTH) || (fa->fa_slen < KEYLENGTH)) {
@@ -1528,26 +1549,25 @@ out_reject: · 19 unmodified lines
15281549 if (fi->fib_flags & RTNH_F_DEAD)
15291550 continue;
15301551
1531− if (unlikely(fi->nh && nexthop_is_blackhole(fi->nh))) {
1532− err = fib_props[RTN_BLACKHOLE].error;
1533− goto out_reject;
1552+ if (unlikely(fi->nh)) {
1553+ if (nexthop_is_blackhole(fi->nh)) {
1554+ err = fib_props[RTN_BLACKHOLE].error;
1555+ goto out_reject;
1556+ }
1557+
1558+ nhc = nexthop_get_nhc_lookup(fi->nh, fib_flags, flp,
1559+ &nhsel);
1560+ if (nhc)
1561+ goto set_result;
1562+ goto miss;
15341563 }
15351564
15361565 for (nhsel = 0; nhsel < fib_info_num_path(fi); nhsel++) {
1537− struct fib_nh_common *nhc = fib_info_nhc(fi, nhsel);
1566+ nhc = fib_info_nhc(fi, nhsel);
15381567
1539− if (nhc->nhc_flags & RTNH_F_DEAD)
1568+ if (!fib_lookup_good_nhc(nhc, fib_flags, flp))
15401569 continue;
1541− if (ip_ignore_linkdown(nhc->nhc_dev) &&
1542− nhc->nhc_flags & RTNH_F_LINKDOWN &&
1543− !(fib_flags & FIB_LOOKUP_IGNORE_LINKSTATE))
1544− continue;
1545− if (!(flp->flowi4_flags & FLOWI_FLAG_SKIP_NH_OIF)) {
1546− if (flp->flowi4_oif &&
1547− flp->flowi4_oif != nhc->nhc_oif)
1548− continue;
1549− }
1550−
1570+set_result:
15511571 if (!(fib_flags & FIB_LOOKUP_NOREF))
15521572 refcount_inc(&fi->fib_clntref);
15531573
@@ -1568,6 +1588,7 @@ out_reject: · 14 unmodified lines
15681588 return err;
15691589 }
15701590 }
1591+miss:
15711592 #ifdef CONFIG_IP_FIB_TRIE_STATS
15721593 this_cpu_inc(stats->semantic_match_miss);
15731594 #endif
net/ipv4/ip_vti.c+22−1
@@ -93,7 +93,28 @@ static int vti_rcv_proto(struct sk_buff *skb) · 92 unmodified lines
9393
9494 static int vti_rcv_tunnel(struct sk_buff *skb)
9595 {
96− return vti_rcv(skb, ip_hdr(skb)->saddr, true);
96+ struct ip_tunnel_net *itn = net_generic(dev_net(skb->dev), vti_net_id);
97+ const struct iphdr *iph = ip_hdr(skb);
98+ struct ip_tunnel *tunnel;
99+
100+ tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,
101+ iph->saddr, iph->daddr, 0);
102+ if (tunnel) {
103+ struct tnl_ptk_info tpi = {
104+ .proto = htons(ETH_P_IP),
105+ };
106+
107+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
108+ goto drop;
109+ if (iptunnel_pull_header(skb, 0, tpi.proto, false))
110+ goto drop;
111+ return ip_tunnel_rcv(tunnel, skb, &tpi, NULL, false);
112+ }
113+
114+ return -EINVAL;
115+drop:
116+ kfree_skb(skb);
117+ return 0;
97118 }
98119
99120 static int vti_rcv_cb(struct sk_buff *skb, int err)
net/ipv4/netfilter/nf_nat_pptp.c+2−5
@@ -166,8 +166,7 @@ pptp_outbound_pkt(struct sk_buff *skb, · 165 unmodified lines
166166 break;
167167 default:
168168 pr_debug("unknown outbound packet 0x%04x:%s\n", msg,
169− msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
170− pptp_msg_name[0]);
169+ pptp_msg_name(msg));
171170 fallthrough;
172171 case PPTP_SET_LINK_INFO:
173172 /* only need to NAT in case PAC is behind NAT box */
@@ -268,9 +267,7 @@ pptp_inbound_pkt(struct sk_buff *skb, · 94 unmodified lines
268267 pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);
269268 break;
270269 default:
271− pr_debug("unknown inbound packet %s\n",
272− msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
273− pptp_msg_name[0]);
270+ pr_debug("unknown inbound packet %s\n", pptp_msg_name(msg));
274271 fallthrough;
275272 case PPTP_START_SESSION_REQUEST:
276273 case PPTP_START_SESSION_REPLY:
net/ipv4/nexthop.c+63−39
@@ -63,9 +63,16 @@ static void nexthop_free_mpath(struct nexthop *nh) · 62 unmodified lines
6363 int i;
6464
6565 nhg = rcu_dereference_raw(nh->nh_grp);
66− for (i = 0; i < nhg->num_nh; ++i)
67− WARN_ON(nhg->nh_entries[i].nh);
66+ for (i = 0; i < nhg->num_nh; ++i) {
67+ struct nh_grp_entry *nhge = &nhg->nh_entries[i];
68+
69+ WARN_ON(!list_empty(&nhge->nh_list));
70+ nexthop_put(nhge->nh);
71+ }
72+
73+ WARN_ON(nhg->spare == nhg);
6874
75+ kfree(nhg->spare);
6976 kfree(nhg);
7077 }
7178
@@ -694,41 +701,56 @@ static void nh_group_rebalance(struct nh_group *nhg) · 622 unmodified lines
694701 }
695702 }
696703
697−static void remove_nh_grp_entry(struct nh_grp_entry *nhge,
698− struct nh_group *nhg,
704+static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
699705 struct nl_info *nlinfo)
700706 {
707+ struct nh_grp_entry *nhges, *new_nhges;
708+ struct nexthop *nhp = nhge->nh_parent;
701709 struct nexthop *nh = nhge->nh;
702− struct nh_grp_entry *nhges;
703− bool found = false;
704− int i;
710+ struct nh_group *nhg, *newg;
711+ int i, j;
705712
706713 WARN_ON(!nh);
707714
708− nhges = nhg->nh_entries;
709− for (i = 0; i < nhg->num_nh; ++i) {
710− if (found) {
711− nhges[i-1].nh = nhges[i].nh;
712− nhges[i-1].weight = nhges[i].weight;
713− list_del(&nhges[i].nh_list);
714− list_add(&nhges[i-1].nh_list, &nhges[i-1].nh->grp_list);
715− } else if (nhg->nh_entries[i].nh == nh) {
716− found = true;
717− }
718− }
715+ nhg = rtnl_dereference(nhp->nh_grp);
716+ newg = nhg->spare;
719717
720− if (WARN_ON(!found))
718+ /* last entry, keep it visible and remove the parent */
719+ if (nhg->num_nh == 1) {
720+ remove_nexthop(net, nhp, nlinfo);
721721 return;
722+ }
723+
724+ newg->has_v4 = nhg->has_v4;
725+ newg->mpath = nhg->mpath;
726+ newg->num_nh = nhg->num_nh;
722727
723− nhg->num_nh--;
724− nhg->nh_entries[nhg->num_nh].nh = NULL;
728+ /* copy old entries to new except the one getting removed */
729+ nhges = nhg->nh_entries;
730+ new_nhges = newg->nh_entries;
731+ for (i = 0, j = 0; i < nhg->num_nh; ++i) {
732+ /* current nexthop getting removed */
733+ if (nhg->nh_entries[i].nh == nh) {
734+ newg->num_nh--;
735+ continue;
736+ }
725737
726− nh_group_rebalance(nhg);
738+ list_del(&nhges[i].nh_list);
739+ new_nhges[j].nh_parent = nhges[i].nh_parent;
740+ new_nhges[j].nh = nhges[i].nh;
741+ new_nhges[j].weight = nhges[i].weight;
742+ list_add(&new_nhges[j].nh_list, &new_nhges[j].nh->grp_list);
743+ j++;
744+ }
727745
728− nexthop_put(nh);
746+ nh_group_rebalance(newg);
747+ rcu_assign_pointer(nhp->nh_grp, newg);
748+
749+ list_del(&nhge->nh_list);
750+ nexthop_put(nhge->nh);
729751
730752 if (nlinfo)
731− nexthop_notify(RTM_NEWNEXTHOP, nhge->nh_parent, nlinfo);
753+ nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
732754 }
733755
734756 static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
@@ -736,17 +758,11 @@ static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh, · 1 unmodified line
736758 {
737759 struct nh_grp_entry *nhge, *tmp;
738760
739− list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) {
740− struct nh_group *nhg;
741−
742− list_del(&nhge->nh_list);
743− nhg = rtnl_dereference(nhge->nh_parent->nh_grp);
744− remove_nh_grp_entry(nhge, nhg, nlinfo);
761+ list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list)
762+ remove_nh_grp_entry(net, nhge, nlinfo);
745763
746− /* if this group has no more entries then remove it */
747− if (!nhg->num_nh)
748− remove_nexthop(net, nhge->nh_parent, nlinfo);
749− }
764+ /* make sure all see the newly published array before releasing rtnl */
765+ synchronize_rcu();
750766 }
751767
752768 static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo)
@@ -760,10 +776,7 @@ static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo) · 7 unmodified lines
760776 if (WARN_ON(!nhge->nh))
761777 continue;
762778
763− list_del(&nhge->nh_list);
764− nexthop_put(nhge->nh);
765− nhge->nh = NULL;
766− nhg->num_nh--;
779+ list_del_init(&nhge->nh_list);
767780 }
768781 }
769782
@@ -1086,6 +1099,7 @@ static struct nexthop *nexthop_create_group(struct net *net, · 316 unmodified lines
10861099 {
10871100 struct nlattr *grps_attr = cfg->nh_grp;
10881101 struct nexthop_grp *entry = nla_data(grps_attr);
1102+ u16 num_nh = nla_len(grps_attr) / sizeof(*entry);
10891103 struct nh_group *nhg;
10901104 struct nexthop *nh;
10911105 int i;
@@ -1096,12 +1110,21 @@ static struct nexthop *nexthop_create_group(struct net *net, · 4 unmodified lines
10961110
10971111 nh->is_group = 1;
10981112
1099− nhg = nexthop_grp_alloc(nla_len(grps_attr) / sizeof(*entry));
1113+ nhg = nexthop_grp_alloc(num_nh);
11001114 if (!nhg) {
11011115 kfree(nh);
11021116 return ERR_PTR(-ENOMEM);
11031117 }
11041118
1119+ /* spare group used for removals */
1120+ nhg->spare = nexthop_grp_alloc(num_nh);
1121+ if (!nhg) {
1122+ kfree(nhg);
1123+ kfree(nh);
1124+ return NULL;
1125+ }
1126+ nhg->spare->spare = nhg;
1127+
11051128 for (i = 0; i < nhg->num_nh; ++i) {
11061129 struct nexthop *nhe;
11071130 struct nh_info *nhi;
@@ -1133,6 +1156,7 @@ out_no_nh: · 25 unmodified lines
11331156 for (; i >= 0; --i)
11341157 nexthop_put(nhg->nh_entries[i].nh);
11351158
1159+ kfree(nhg->spare);
11361160 kfree(nhg);
11371161 kfree(nh);
11381162
net/ipv6/esp6_offload.c+25−12
@@ -85,10 +85,8 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head, · 84 unmodified lines
8585 sp->olen++;
8686
8787 xo = xfrm_offload(skb);
88− if (!xo) {
89− xfrm_state_put(x);
88+ if (!xo)
9089 goto out_reset;
91− }
9290 }
9391
9492 xo->flags |= XFRM_GRO;
@@ -123,9 +121,16 @@ static void esp6_gso_encap(struct xfrm_state *x, struct sk_buff *skb) · 28 unmodified lines
123121 struct ip_esp_hdr *esph;
124122 struct ipv6hdr *iph = ipv6_hdr(skb);
125123 struct xfrm_offload *xo = xfrm_offload(skb);
126− int proto = iph->nexthdr;
124+ u8 proto = iph->nexthdr;
127125
128126 skb_push(skb, -skb_network_offset(skb));
127+
128+ if (x->outer_mode.encap == XFRM_MODE_TRANSPORT) {
129+ __be16 frag;
130+
131+ ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &proto, &frag);
132+ }
133+
129134 esph = ip_esp_hdr(skb);
130135 *skb_mac_header(skb) = IPPROTO_ESP;
131136
@@ -166,23 +171,31 @@ static struct sk_buff *xfrm6_beet_gso_segment(struct xfrm_state *x, · 34 unmodified lines
166171 struct xfrm_offload *xo = xfrm_offload(skb);
167172 struct sk_buff *segs = ERR_PTR(-EINVAL);
168173 const struct net_offload *ops;
169− int proto = xo->proto;
174+ u8 proto = xo->proto;
170175
171176 skb->transport_header += x->props.header_len;
172177
173− if (proto == IPPROTO_BEETPH) {
174− struct ip_beet_phdr *ph = (struct ip_beet_phdr *)skb->data;
175−
176− skb->transport_header += ph->hdrlen * 8;
177− proto = ph->nexthdr;
178− }
179−
180178 if (x->sel.family != AF_INET6) {
181179 skb->transport_header -=
182180 (sizeof(struct ipv6hdr) - sizeof(struct iphdr));
183181
182+ if (proto == IPPROTO_BEETPH) {
183+ struct ip_beet_phdr *ph =
184+ (struct ip_beet_phdr *)skb->data;
185+
186+ skb->transport_header += ph->hdrlen * 8;
187+ proto = ph->nexthdr;
188+ } else {
189+ skb->transport_header -= IPV4_BEET_PHMAXLEN;
190+ }
191+
184192 if (proto == IPPROTO_TCP)
185193 skb_shinfo(skb)->gso_type |= SKB_GSO_TCPV6;
194+ } else {
195+ __be16 frag;
196+
197+ skb->transport_header +=
198+ ipv6_skip_exthdr(skb, 0, &proto, &frag);
186199 }
187200
188201 __skb_pull(skb, skb_transport_offset(skb));
net/l2tp/l2tp_core.c+3−0
@@ -1458,6 +1458,9 @@ static int l2tp_validate_socket(const struct sock *sk, const struct net *net, · 1457 unmodified lines
14581458 if (sk->sk_type != SOCK_DGRAM)
14591459 return -EPROTONOSUPPORT;
14601460
1461+ if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6)
1462+ return -EPROTONOSUPPORT;
1463+
14611464 if ((encap == L2TP_ENCAPTYPE_UDP && sk->sk_protocol != IPPROTO_UDP) ||
14621465 (encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP))
14631466 return -EPROTONOSUPPORT;
net/l2tp/l2tp_ip.c+22−7
@@ -20,7 +20,6 @@ · 19 unmodified lines
2020 #include <net/icmp.h>
2121 #include <net/udp.h>
2222 #include <net/inet_common.h>
23−#include <net/inet_hashtables.h>
2423 #include <net/tcp_states.h>
2524 #include <net/protocol.h>
2625 #include <net/xfrm.h>
@@ -209,15 +208,31 @@ discard: · 182 unmodified lines
209208 return 0;
210209 }
211210
212−static int l2tp_ip_open(struct sock *sk)
211+static int l2tp_ip_hash(struct sock *sk)
213212 {
214− /* Prevent autobind. We don't have ports. */
215− inet_sk(sk)->inet_num = IPPROTO_L2TP;
213+ if (sk_unhashed(sk)) {
214+ write_lock_bh(&l2tp_ip_lock);
215+ sk_add_node(sk, &l2tp_ip_table);
216+ write_unlock_bh(&l2tp_ip_lock);
217+ }
218+ return 0;
219+}
216220
221+static void l2tp_ip_unhash(struct sock *sk)
222+{
223+ if (sk_unhashed(sk))
224+ return;
217225 write_lock_bh(&l2tp_ip_lock);
218− sk_add_node(sk, &l2tp_ip_table);
226+ sk_del_node_init(sk);
219227 write_unlock_bh(&l2tp_ip_lock);
228+}
229+
230+static int l2tp_ip_open(struct sock *sk)
231+{
232+ /* Prevent autobind. We don't have ports. */
233+ inet_sk(sk)->inet_num = IPPROTO_L2TP;
220234
235+ l2tp_ip_hash(sk);
221236 return 0;
222237 }
223238
@@ -594,8 +609,8 @@ static struct proto l2tp_ip_prot = { · 370 unmodified lines
594609 .sendmsg = l2tp_ip_sendmsg,
595610 .recvmsg = l2tp_ip_recvmsg,
596611 .backlog_rcv = l2tp_ip_backlog_recv,
597− .hash = inet_hash,
598− .unhash = inet_unhash,
612+ .hash = l2tp_ip_hash,
613+ .unhash = l2tp_ip_unhash,
599614 .obj_size = sizeof(struct l2tp_ip_sock),
600615 #ifdef CONFIG_COMPAT
601616 .compat_setsockopt = compat_ip_setsockopt,
net/l2tp/l2tp_ip6.c+22−8
@@ -20,8 +20,6 @@ · 19 unmodified lines
2020 #include <net/icmp.h>
2121 #include <net/udp.h>
2222 #include <net/inet_common.h>
23−#include <net/inet_hashtables.h>
24−#include <net/inet6_hashtables.h>
2523 #include <net/tcp_states.h>
2624 #include <net/protocol.h>
2725 #include <net/xfrm.h>
@@ -222,15 +220,31 @@ discard: · 194 unmodified lines
222220 return 0;
223221 }
224222
225−static int l2tp_ip6_open(struct sock *sk)
223+static int l2tp_ip6_hash(struct sock *sk)
226224 {
227− /* Prevent autobind. We don't have ports. */
228− inet_sk(sk)->inet_num = IPPROTO_L2TP;
225+ if (sk_unhashed(sk)) {
226+ write_lock_bh(&l2tp_ip6_lock);
227+ sk_add_node(sk, &l2tp_ip6_table);
228+ write_unlock_bh(&l2tp_ip6_lock);
229+ }
230+ return 0;
231+}
229232
233+static void l2tp_ip6_unhash(struct sock *sk)
234+{
235+ if (sk_unhashed(sk))
236+ return;
230237 write_lock_bh(&l2tp_ip6_lock);
231− sk_add_node(sk, &l2tp_ip6_table);
238+ sk_del_node_init(sk);
232239 write_unlock_bh(&l2tp_ip6_lock);
240+}
241+
242+static int l2tp_ip6_open(struct sock *sk)
243+{
244+ /* Prevent autobind. We don't have ports. */
245+ inet_sk(sk)->inet_num = IPPROTO_L2TP;
233246
247+ l2tp_ip6_hash(sk);
234248 return 0;
235249 }
236250
@@ -728,8 +742,8 @@ static struct proto l2tp_ip6_prot = { · 491 unmodified lines
728742 .sendmsg = l2tp_ip6_sendmsg,
729743 .recvmsg = l2tp_ip6_recvmsg,
730744 .backlog_rcv = l2tp_ip6_backlog_recv,
731− .hash = inet6_hash,
732− .unhash = inet_unhash,
745+ .hash = l2tp_ip6_hash,
746+ .unhash = l2tp_ip6_unhash,
733747 .obj_size = sizeof(struct l2tp_ip6_sock),
734748 #ifdef CONFIG_COMPAT
735749 .compat_setsockopt = compat_ipv6_setsockopt,
net/mac80211/mesh_hwmp.c+7−0
@@ -1103,7 +1103,14 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) · 1102 unmodified lines
11031103 mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, ifmsh->sn,
11041104 target_flags, mpath->dst, mpath->sn, da, 0,
11051105 ttl, lifetime, 0, ifmsh->preq_id++, sdata);
1106+
1107+ spin_lock_bh(&mpath->state_lock);
1108+ if (mpath->flags & MESH_PATH_DELETED) {
1109+ spin_unlock_bh(&mpath->state_lock);
1110+ goto enddiscovery;
1111+ }
11061112 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
1113+ spin_unlock_bh(&mpath->state_lock);
11071114
11081115 enddiscovery:
11091116 rcu_read_unlock();
net/mptcp/protocol.c+48−19
@@ -954,7 +954,8 @@ fallback: · 953 unmodified lines
954954
955955 pr_debug("block timeout %ld", timeo);
956956 mptcp_wait_data(sk, &timeo);
957− if (unlikely(__mptcp_tcp_fallback(msk)))
957+ ssock = __mptcp_tcp_fallback(msk);
958+ if (unlikely(ssock))
958959 goto fallback;
959960 }
960961
@@ -1262,11 +1263,14 @@ static void mptcp_close(struct sock *sk, long timeout) · 301 unmodified lines
12621263
12631264 lock_sock(sk);
12641265
1265− mptcp_token_destroy(msk->token);
12661266 inet_sk_state_store(sk, TCP_CLOSE);
12671267
1268− __mptcp_flush_join_list(msk);
1269−
1268+ /* be sure to always acquire the join list lock, to sync vs
1269+ * mptcp_finish_join().
1270+ */
1271+ spin_lock_bh(&msk->join_list_lock);
1272+ list_splice_tail_init(&msk->join_list, &msk->conn_list);
1273+ spin_unlock_bh(&msk->join_list_lock);
12701274 list_splice_init(&msk->conn_list, &conn_list);
12711275
12721276 data_fin_tx_seq = msk->write_seq;
@@ -1456,6 +1460,7 @@ static void mptcp_destroy(struct sock *sk) · 183 unmodified lines
14561460 {
14571461 struct mptcp_sock *msk = mptcp_sk(sk);
14581462
1463+ mptcp_token_destroy(msk->token);
14591464 if (msk->cached_ext)
14601465 __skb_ext_put(msk->cached_ext);
14611466
@@ -1622,22 +1627,30 @@ bool mptcp_finish_join(struct sock *sk) · 160 unmodified lines
16221627 if (!msk->pm.server_side)
16231628 return true;
16241629
1625− /* passive connection, attach to msk socket */
1630+ if (!mptcp_pm_allow_new_subflow(msk))
1631+ return false;
1632+
1633+ /* active connections are already on conn_list, and we can't acquire
1634+ * msk lock here.
1635+ * use the join list lock as synchronization point and double-check
1636+ * msk status to avoid racing with mptcp_close()
1637+ */
1638+ spin_lock_bh(&msk->join_list_lock);
1639+ ret = inet_sk_state_load(parent) == TCP_ESTABLISHED;
1640+ if (ret && !WARN_ON_ONCE(!list_empty(&subflow->node)))
1641+ list_add_tail(&subflow->node, &msk->join_list);
1642+ spin_unlock_bh(&msk->join_list_lock);
1643+ if (!ret)
1644+ return false;
1645+
1646+ /* attach to msk socket only after we are sure he will deal with us
1647+ * at close time
1648+ */
16261649 parent_sock = READ_ONCE(parent->sk_socket);
16271650 if (parent_sock && !sk->sk_socket)
16281651 mptcp_sock_graft(sk, parent_sock);
1629−
1630− ret = mptcp_pm_allow_new_subflow(msk);
1631− if (ret) {
1632− subflow->map_seq = msk->ack_seq;
1633−
1634− /* active connections are already on conn_list */
1635− spin_lock_bh(&msk->join_list_lock);
1636− if (!WARN_ON_ONCE(!list_empty(&subflow->node)))
1637− list_add_tail(&subflow->node, &msk->join_list);
1638− spin_unlock_bh(&msk->join_list_lock);
1639− }
1640− return ret;
1652+ subflow->map_seq = msk->ack_seq;
1653+ return true;
16411654 }
16421655
16431656 bool mptcp_sk_is_subflow(const struct sock *sk)
@@ -1711,6 +1724,14 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, · 67 unmodified lines
17111724 int err;
17121725
17131726 lock_sock(sock->sk);
1727+ if (sock->state != SS_UNCONNECTED && msk->subflow) {
1728+ /* pending connection or invalid state, let existing subflow
1729+ * cope with that
1730+ */
1731+ ssock = msk->subflow;
1732+ goto do_connect;
1733+ }
1734+
17141735 ssock = __mptcp_socket_create(msk, TCP_SYN_SENT);
17151736 if (IS_ERR(ssock)) {
17161737 err = PTR_ERR(ssock);
@@ -1725,9 +1746,17 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, · 8 unmodified lines
17251746 mptcp_subflow_ctx(ssock->sk)->request_mptcp = 0;
17261747 #endif
17271748
1749+do_connect:
17281750 err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
1729− inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
1730− mptcp_copy_inaddrs(sock->sk, ssock->sk);
1751+ sock->state = ssock->state;
1752+
1753+ /* on successful connect, the msk state will be moved to established by
1754+ * subflow_finish_connect()
1755+ */
1756+ if (!err || err == EINPROGRESS)
1757+ mptcp_copy_inaddrs(sock->sk, ssock->sk);
1758+ else
1759+ inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
17311760
17321761 unlock:
17331762 release_sock(sock->sk);
net/netfilter/ipset/ip_set_list_set.c+1−1
@@ -59,7 +59,7 @@ list_set_ktest(struct ip_set *set, const struct sk_buff *skb, · 58 unmodified lines
5959 /* Don't lookup sub-counters at all */
6060 opt->cmdflags &= ~IPSET_FLAG_MATCH_COUNTERS;
6161 if (opt->cmdflags & IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE)
62− opt->cmdflags &= ~IPSET_FLAG_SKIP_COUNTER_UPDATE;
62+ opt->cmdflags |= IPSET_FLAG_SKIP_COUNTER_UPDATE;
6363 list_for_each_entry_rcu(e, &map->members, list) {
6464 ret = ip_set_test(e->id, skb, par, opt);
6565 if (ret <= 0)
net/netfilter/nf_conntrack_core.c+73−7
@@ -2016,22 +2016,18 @@ static void nf_conntrack_attach(struct sk_buff *nskb, const struct sk_buff *skb) · 2015 unmodified lines
20162016 nf_conntrack_get(skb_nfct(nskb));
20172017 }
20182018
2019−static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
2019+static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
2020+ struct nf_conn *ct,
2021+ enum ip_conntrack_info ctinfo)
20202022 {
20212023 struct nf_conntrack_tuple_hash *h;
20222024 struct nf_conntrack_tuple tuple;
2023− enum ip_conntrack_info ctinfo;
20242025 struct nf_nat_hook *nat_hook;
20252026 unsigned int status;
2026− struct nf_conn *ct;
20272027 int dataoff;
20282028 u16 l3num;
20292029 u8 l4num;
20302030
2031− ct = nf_ct_get(skb, &ctinfo);
2032− if (!ct || nf_ct_is_confirmed(ct))
2033− return 0;
2034−
20352031 l3num = nf_ct_l3num(ct);
20362032
20372033 dataoff = get_l4proto(skb, skb_network_offset(skb), l3num, &l4num);
@@ -2088,6 +2084,76 @@ static int nf_conntrack_update(struct net *net, struct sk_buff *skb) · 50 unmodified lines
20882084 return 0;
20892085 }
20902086
2087+/* This packet is coming from userspace via nf_queue, complete the packet
2088+ * processing after the helper invocation in nf_confirm().
2089+ */
2090+static int nf_confirm_cthelper(struct sk_buff *skb, struct nf_conn *ct,
2091+ enum ip_conntrack_info ctinfo)
2092+{
2093+ const struct nf_conntrack_helper *helper;
2094+ const struct nf_conn_help *help;
2095+ int protoff;
2096+
2097+ help = nfct_help(ct);
2098+ if (!help)
2099+ return 0;
2100+
2101+ helper = rcu_dereference(help->helper);
2102+ if (!(helper->flags & NF_CT_HELPER_F_USERSPACE))
2103+ return 0;
2104+
2105+ switch (nf_ct_l3num(ct)) {
2106+ case NFPROTO_IPV4:
2107+ protoff = skb_network_offset(skb) + ip_hdrlen(skb);
2108+ break;
2109+#if IS_ENABLED(CONFIG_IPV6)
2110+ case NFPROTO_IPV6: {
2111+ __be16 frag_off;
2112+ u8 pnum;
2113+
2114+ pnum = ipv6_hdr(skb)->nexthdr;
2115+ protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum,
2116+ &frag_off);
2117+ if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
2118+ return 0;
2119+ break;
2120+ }
2121+#endif
2122+ default:
2123+ return 0;
2124+ }
2125+
2126+ if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
2127+ !nf_is_loopback_packet(skb)) {
2128+ if (!nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) {
2129+ NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
2130+ return -1;
2131+ }
2132+ }
2133+
2134+ /* We've seen it coming out the other side: confirm it */
2135+ return nf_conntrack_confirm(skb) == NF_DROP ? - 1 : 0;
2136+}
2137+
2138+static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
2139+{
2140+ enum ip_conntrack_info ctinfo;
2141+ struct nf_conn *ct;
2142+ int err;
2143+
2144+ ct = nf_ct_get(skb, &ctinfo);
2145+ if (!ct)
2146+ return 0;
2147+
2148+ if (!nf_ct_is_confirmed(ct)) {
2149+ err = __nf_conntrack_update(net, skb, ct, ctinfo);
2150+ if (err < 0)
2151+ return err;
2152+ }
2153+
2154+ return nf_confirm_cthelper(skb, ct, ctinfo);
2155+}
2156+
20912157 static bool nf_conntrack_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
20922158 const struct sk_buff *skb)
20932159 {
net/netfilter/nf_conntrack_pptp.c+35−27
@@ -72,24 +72,32 @@ EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); · 71 unmodified lines
7272
7373 #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
7474 /* PptpControlMessageType names */
75−const char *const pptp_msg_name[] = {
76− "UNKNOWN_MESSAGE",
77− "START_SESSION_REQUEST",
78− "START_SESSION_REPLY",
79− "STOP_SESSION_REQUEST",
80− "STOP_SESSION_REPLY",
81− "ECHO_REQUEST",
82− "ECHO_REPLY",
83− "OUT_CALL_REQUEST",
84− "OUT_CALL_REPLY",
85− "IN_CALL_REQUEST",
86− "IN_CALL_REPLY",
87− "IN_CALL_CONNECT",
88− "CALL_CLEAR_REQUEST",
89− "CALL_DISCONNECT_NOTIFY",
90− "WAN_ERROR_NOTIFY",
91− "SET_LINK_INFO"
75+static const char *const pptp_msg_name_array[PPTP_MSG_MAX + 1] = {
76+ [0] = "UNKNOWN_MESSAGE",
77+ [PPTP_START_SESSION_REQUEST] = "START_SESSION_REQUEST",
78+ [PPTP_START_SESSION_REPLY] = "START_SESSION_REPLY",
79+ [PPTP_STOP_SESSION_REQUEST] = "STOP_SESSION_REQUEST",
80+ [PPTP_STOP_SESSION_REPLY] = "STOP_SESSION_REPLY",
81+ [PPTP_ECHO_REQUEST] = "ECHO_REQUEST",
82+ [PPTP_ECHO_REPLY] = "ECHO_REPLY",
83+ [PPTP_OUT_CALL_REQUEST] = "OUT_CALL_REQUEST",
84+ [PPTP_OUT_CALL_REPLY] = "OUT_CALL_REPLY",
85+ [PPTP_IN_CALL_REQUEST] = "IN_CALL_REQUEST",
86+ [PPTP_IN_CALL_REPLY] = "IN_CALL_REPLY",
87+ [PPTP_IN_CALL_CONNECT] = "IN_CALL_CONNECT",
88+ [PPTP_CALL_CLEAR_REQUEST] = "CALL_CLEAR_REQUEST",
89+ [PPTP_CALL_DISCONNECT_NOTIFY] = "CALL_DISCONNECT_NOTIFY",
90+ [PPTP_WAN_ERROR_NOTIFY] = "WAN_ERROR_NOTIFY",
91+ [PPTP_SET_LINK_INFO] = "SET_LINK_INFO"
9292 };
93+
94+const char *pptp_msg_name(u_int16_t msg)
95+{
96+ if (msg > PPTP_MSG_MAX)
97+ return pptp_msg_name_array[0];
98+
99+ return pptp_msg_name_array[msg];
100+}
93101 EXPORT_SYMBOL(pptp_msg_name);
94102 #endif
95103
@@ -276,7 +284,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 180 unmodified lines
276284 typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound;
277285
278286 msg = ntohs(ctlh->messageType);
279− pr_debug("inbound control message %s\n", pptp_msg_name[msg]);
287+ pr_debug("inbound control message %s\n", pptp_msg_name(msg));
280288
281289 switch (msg) {
282290 case PPTP_START_SESSION_REPLY:
@@ -311,7 +319,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 28 unmodified lines
311319 pcid = pptpReq->ocack.peersCallID;
312320 if (info->pns_call_id != pcid)
313321 goto invalid;
314− pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg],
322+ pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name(msg),
315323 ntohs(cid), ntohs(pcid));
316324
317325 if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) {
@@ -328,7 +336,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 10 unmodified lines
328336 goto invalid;
329337
330338 cid = pptpReq->icreq.callID;
331− pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
339+ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
332340 info->cstate = PPTP_CALL_IN_REQ;
333341 info->pac_call_id = cid;
334342 break;
@@ -347,7 +355,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 12 unmodified lines
347355 if (info->pns_call_id != pcid)
348356 goto invalid;
349357
350− pr_debug("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(pcid));
358+ pr_debug("%s, PCID=%X\n", pptp_msg_name(msg), ntohs(pcid));
351359 info->cstate = PPTP_CALL_IN_CONF;
352360
353361 /* we expect a GRE connection from PAC to PNS */
@@ -357,7 +365,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 3 unmodified lines
357365 case PPTP_CALL_DISCONNECT_NOTIFY:
358366 /* server confirms disconnect */
359367 cid = pptpReq->disc.callID;
360− pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
368+ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
361369 info->cstate = PPTP_CALL_NONE;
362370
363371 /* untrack this call id, unexpect GRE packets */
@@ -384,7 +392,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff, · 20 unmodified lines
384392 invalid:
385393 pr_debug("invalid %s: type=%d cid=%u pcid=%u "
386394 "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n",
387− msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0],
395+ pptp_msg_name(msg),
388396 msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate,
389397 ntohs(info->pns_call_id), ntohs(info->pac_call_id));
390398 return NF_ACCEPT;
@@ -404,7 +412,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff, · 13 unmodified lines
404412 typeof(nf_nat_pptp_hook_outbound) nf_nat_pptp_outbound;
405413
406414 msg = ntohs(ctlh->messageType);
407− pr_debug("outbound control message %s\n", pptp_msg_name[msg]);
415+ pr_debug("outbound control message %s\n", pptp_msg_name(msg));
408416
409417 switch (msg) {
410418 case PPTP_START_SESSION_REQUEST:
@@ -426,7 +434,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff, · 15 unmodified lines
426434 info->cstate = PPTP_CALL_OUT_REQ;
427435 /* track PNS call id */
428436 cid = pptpReq->ocreq.callID;
429− pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
437+ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
430438 info->pns_call_id = cid;
431439 break;
432440
@@ -440,7 +448,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff, · 7 unmodified lines
440448 pcid = pptpReq->icack.peersCallID;
441449 if (info->pac_call_id != pcid)
442450 goto invalid;
443− pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name[msg],
451+ pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name(msg),
444452 ntohs(cid), ntohs(pcid));
445453
446454 if (pptpReq->icack.resultCode == PPTP_INCALL_ACCEPT) {
@@ -480,7 +488,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff, · 33 unmodified lines
480488 invalid:
481489 pr_debug("invalid %s: type=%d cid=%u pcid=%u "
482490 "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n",
483− msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0],
491+ pptp_msg_name(msg),
484492 msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate,
485493 ntohs(info->pns_call_id), ntohs(info->pac_call_id));
486494 return NF_ACCEPT;
net/netfilter/nfnetlink_cthelper.c+2−1
@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) · 102 unmodified lines
103103 if (help->helper->data_len == 0)
104104 return -EINVAL;
105105
106− nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
106+ nla_memcpy(help->data, attr, sizeof(help->data));
107107 return 0;
108108 }
109109
@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[], · 130 unmodified lines
240240 ret = -ENOMEM;
241241 goto err2;
242242 }
243+ helper->data_len = size;
243244
244245 helper->flags |= NF_CT_HELPER_F_USERSPACE;
245246 memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));
net/qrtr/ns.c+5−5
@@ -712,6 +712,10 @@ void qrtr_ns_init(void) · 711 unmodified lines
712712 goto err_sock;
713713 }
714714
715+ qrtr_ns.workqueue = alloc_workqueue("qrtr_ns_handler", WQ_UNBOUND, 1);
716+ if (!qrtr_ns.workqueue)
717+ goto err_sock;
718+
715719 qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready;
716720
717721 sq.sq_port = QRTR_PORT_CTRL;
@@ -720,17 +724,13 @@ void qrtr_ns_init(void) · 2 unmodified lines
720724 ret = kernel_bind(qrtr_ns.sock, (struct sockaddr *)&sq, sizeof(sq));
721725 if (ret < 0) {
722726 pr_err("failed to bind to socket\n");
723− goto err_sock;
727+ goto err_wq;
724728 }
725729
726730 qrtr_ns.bcast_sq.sq_family = AF_QIPCRTR;
727731 qrtr_ns.bcast_sq.sq_node = QRTR_NODE_BCAST;
728732 qrtr_ns.bcast_sq.sq_port = QRTR_PORT_CTRL;
729733
730− qrtr_ns.workqueue = alloc_workqueue("qrtr_ns_handler", WQ_UNBOUND, 1);
731− if (!qrtr_ns.workqueue)
732− goto err_sock;
733−
734734 ret = say_hello(&qrtr_ns.bcast_sq);
735735 if (ret < 0)
736736 goto err_wq;
net/sched/act_ct.c+3−0
@@ -199,6 +199,9 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net, · 198 unmodified lines
199199 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
200200 struct nf_conntrack_tuple target;
201201
202+ if (!(ct->status & IPS_NAT_MASK))
203+ return 0;
204+
202205 nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
203206
204207 switch (tuple->src.l3num) {
net/sched/sch_fq_pie.c+2−2
@@ -297,9 +297,9 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt, · 296 unmodified lines
297297 goto flow_error;
298298 }
299299 q->flows_cnt = nla_get_u32(tb[TCA_FQ_PIE_FLOWS]);
300− if (!q->flows_cnt || q->flows_cnt > 65536) {
300+ if (!q->flows_cnt || q->flows_cnt >= 65536) {
301301 NL_SET_ERR_MSG_MOD(extack,
302− "Number of flows must be < 65536");
302+ "Number of flows must range in [1..65535]");
303303 goto flow_error;
304304 }
305305 }
net/sctp/Kconfig+1−1
@@ -31,7 +31,7 @@ menuconfig IP_SCTP · 30 unmodified lines
3131 homing at either or both ends of an association."
3232
3333 To compile this protocol support as a module, choose M here: the
34− module will be called sctp. Debug messages are handeled by the
34+ module will be called sctp. Debug messages are handled by the
3535 kernel's dynamic debugging framework.
3636
3737 If in doubt, say N.
net/sctp/ulpevent.c+3−0
@@ -343,6 +343,9 @@ void sctp_ulpevent_nofity_peer_addr_change(struct sctp_transport *transport, · 342 unmodified lines
343343 struct sockaddr_storage addr;
344344 struct sctp_ulpevent *event;
345345
346+ if (asoc->state < SCTP_STATE_ESTABLISHED)
347+ return;
348+
346349 memset(&addr, 0, sizeof(struct sockaddr_storage));
347350 memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len);
348351
net/tls/tls_sw.c+27−6
@@ -206,10 +206,12 @@ static void tls_decrypt_done(struct crypto_async_request *req, int err) · 205 unmodified lines
206206
207207 kfree(aead_req);
208208
209+ spin_lock_bh(&ctx->decrypt_compl_lock);
209210 pending = atomic_dec_return(&ctx->decrypt_pending);
210211
211− if (!pending && READ_ONCE(ctx->async_notify))
212+ if (!pending && ctx->async_notify)
212213 complete(&ctx->async_wait.completion);
214+ spin_unlock_bh(&ctx->decrypt_compl_lock);
213215 }
214216
215217 static int tls_do_decryption(struct sock *sk,
@@ -467,10 +469,12 @@ static void tls_encrypt_done(struct crypto_async_request *req, int err) · 251 unmodified lines
467469 ready = true;
468470 }
469471
472+ spin_lock_bh(&ctx->encrypt_compl_lock);
470473 pending = atomic_dec_return(&ctx->encrypt_pending);
471474
472− if (!pending && READ_ONCE(ctx->async_notify))
475+ if (!pending && ctx->async_notify)
473476 complete(&ctx->async_wait.completion);
477+ spin_unlock_bh(&ctx->encrypt_compl_lock);
474478
475479 if (!ready)
476480 return;
@@ -929,6 +933,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) · 452 unmodified lines
929933 int num_zc = 0;
930934 int orig_size;
931935 int ret = 0;
936+ int pending;
932937
933938 if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
934939 return -EOPNOTSUPP;
@@ -1095,13 +1100,19 @@ trim_sgl: · 160 unmodified lines
10951100 goto send_end;
10961101 } else if (num_zc) {
10971102 /* Wait for pending encryptions to get completed */
1098− smp_store_mb(ctx->async_notify, true);
1103+ spin_lock_bh(&ctx->encrypt_compl_lock);
1104+ ctx->async_notify = true;
10991105
1100− if (atomic_read(&ctx->encrypt_pending))
1106+ pending = atomic_read(&ctx->encrypt_pending);
1107+ spin_unlock_bh(&ctx->encrypt_compl_lock);
1108+ if (pending)
11011109 crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
11021110 else
11031111 reinit_completion(&ctx->async_wait.completion);
11041112
1113+ /* There can be no concurrent accesses, since we have no
1114+ * pending encrypt operations
1115+ */
11051116 WRITE_ONCE(ctx->async_notify, false);
11061117
11071118 if (ctx->async_wait.err) {
@@ -1732,6 +1743,7 @@ int tls_sw_recvmsg(struct sock *sk, · 624 unmodified lines
17321743 bool is_kvec = iov_iter_is_kvec(&msg->msg_iter);
17331744 bool is_peek = flags & MSG_PEEK;
17341745 int num_async = 0;
1746+ int pending;
17351747
17361748 flags |= nonblock;
17371749
@@ -1894,8 +1906,11 @@ pick_next_record: · 156 unmodified lines
18941906 recv_end:
18951907 if (num_async) {
18961908 /* Wait for all previously submitted records to be decrypted */
1897− smp_store_mb(ctx->async_notify, true);
1898− if (atomic_read(&ctx->decrypt_pending)) {
1909+ spin_lock_bh(&ctx->decrypt_compl_lock);
1910+ ctx->async_notify = true;
1911+ pending = atomic_read(&ctx->decrypt_pending);
1912+ spin_unlock_bh(&ctx->decrypt_compl_lock);
1913+ if (pending) {
18991914 err = crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
19001915 if (err) {
19011916 /* one of async decrypt failed */
@@ -1907,6 +1922,10 @@ recv_end: · 5 unmodified lines
19071922 } else {
19081923 reinit_completion(&ctx->async_wait.completion);
19091924 }
1925+
1926+ /* There can be no concurrent accesses, since we have no
1927+ * pending decrypt operations
1928+ */
19101929 WRITE_ONCE(ctx->async_notify, false);
19111930
19121931 /* Drain records from the rx_list & copy if required */
@@ -2293,6 +2312,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) · 380 unmodified lines
22932312
22942313 if (tx) {
22952314 crypto_init_wait(&sw_ctx_tx->async_wait);
2315+ spin_lock_init(&sw_ctx_tx->encrypt_compl_lock);
22962316 crypto_info = &ctx->crypto_send.info;
22972317 cctx = &ctx->tx;
22982318 aead = &sw_ctx_tx->aead_send;
@@ -2301,6 +2321,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx) · 2 unmodified lines
23012321 sw_ctx_tx->tx_work.sk = sk;
23022322 } else {
23032323 crypto_init_wait(&sw_ctx_rx->async_wait);
2324+ spin_lock_init(&sw_ctx_rx->decrypt_compl_lock);
23042325 crypto_info = &ctx->crypto_recv.info;
23052326 cctx = &ctx->rx;
23062327 skb_queue_head_init(&sw_ctx_rx->rx_list);
net/vmw_vsock/af_vsock.c+1−1
@@ -1408,7 +1408,7 @@ static int vsock_accept(struct socket *sock, struct socket *newsock, int flags, · 1407 unmodified lines
14081408 /* Wait for children sockets to appear; these are the new sockets
14091409 * created upon connection establishment.
14101410 */
1411− timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
1411+ timeout = sock_rcvtimeo(listener, flags & O_NONBLOCK);
14121412 prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
14131413
14141414 while ((connected = vsock_dequeue_accept(listener)) == NULL &&
net/vmw_vsock/virtio_transport_common.c+8−0
@@ -1132,6 +1132,14 @@ void virtio_transport_recv_pkt(struct virtio_transport *t, · 1131 unmodified lines
11321132
11331133 lock_sock(sk);
11341134
1135+ /* Check if sk has been released before lock_sock */
1136+ if (sk->sk_shutdown == SHUTDOWN_MASK) {
1137+ (void)virtio_transport_reset_no_sock(t, pkt);
1138+ release_sock(sk);
1139+ sock_put(sk);
1140+ goto free_pkt;
1141+ }
1142+
11351143 /* Update CID in case it has changed after a transport reset event */
11361144 vsk->local_addr.svm_cid = dst.svm_cid;
11371145
net/wireless/core.c+1−1
@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, · 141 unmodified lines
142142 if (result)
143143 return result;
144144
145− if (rdev->wiphy.debugfsdir)
145+ if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
146146 debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
147147 rdev->wiphy.debugfsdir,
148148 rdev->wiphy.debugfsdir->d_parent, newname);
net/xdp/xdp_umem.c+6−2
@@ -341,8 +341,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) · 340 unmodified lines
341341 {
342342 bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
343343 u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
344+ u64 npgs, addr = mr->addr, size = mr->len;
344345 unsigned int chunks, chunks_per_page;
345− u64 addr = mr->addr, size = mr->len;
346346 int err;
347347
348348 if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
@@ -372,6 +372,10 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) · 23 unmodified lines
372372 if ((addr + size) < addr)
373373 return -EINVAL;
374374
375+ npgs = div_u64(size, PAGE_SIZE);
376+ if (npgs > U32_MAX)
377+ return -EINVAL;
378+
375379 chunks = (unsigned int)div_u64(size, chunk_size);
376380 if (chunks == 0)
377381 return -EINVAL;
@@ -391,7 +395,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) · 13 unmodified lines
391395 umem->size = size;
392396 umem->headroom = headroom;
393397 umem->chunk_size_nohr = chunk_size - headroom;
394− umem->npgs = size / PAGE_SIZE;
398+ umem->npgs = (u32)npgs;
395399 umem->pgs = NULL;
396400 umem->user = NULL;
397401 umem->flags = mr->flags;
net/xfrm/espintcp.c+2−0
@@ -379,6 +379,7 @@ static void espintcp_destruct(struct sock *sk) · 378 unmodified lines
379379 {
380380 struct espintcp_ctx *ctx = espintcp_getctx(sk);
381381
382+ ctx->saved_destruct(sk);
382383 kfree(ctx);
383384 }
384385
@@ -419,6 +420,7 @@ static int espintcp_init_sk(struct sock *sk) · 34 unmodified lines
419420 sk->sk_socket->ops = &espintcp_ops;
420421 ctx->saved_data_ready = sk->sk_data_ready;
421422 ctx->saved_write_space = sk->sk_write_space;
423+ ctx->saved_destruct = sk->sk_destruct;
422424 sk->sk_data_ready = espintcp_data_ready;
423425 sk->sk_write_space = espintcp_write_space;
424426 sk->sk_destruct = espintcp_destruct;
net/xfrm/xfrm_device.c+3−5
@@ -25,12 +25,10 @@ static void __xfrm_transport_prep(struct xfrm_state *x, struct sk_buff *skb, · 24 unmodified lines
2525 struct xfrm_offload *xo = xfrm_offload(skb);
2626
2727 skb_reset_mac_len(skb);
28− pskb_pull(skb, skb->mac_len + hsize + x->props.header_len);
29−
30− if (xo->flags & XFRM_GSO_SEGMENT) {
31− skb_reset_transport_header(skb);
28+ if (xo->flags & XFRM_GSO_SEGMENT)
3229 skb->transport_header -= x->props.header_len;
33− }
30+
31+ pskb_pull(skb, skb_transport_offset(skb) + x->props.header_len);
3432 }
3533
3634 static void __xfrm_mode_tunnel_prep(struct xfrm_state *x, struct sk_buff *skb,
net/xfrm/xfrm_input.c+1−1
@@ -644,7 +644,7 @@ resume: · 643 unmodified lines
644644 dev_put(skb->dev);
645645
646646 spin_lock(&x->lock);
647− if (nexthdr <= 0) {
647+ if (nexthdr < 0) {
648648 if (nexthdr == -EBADMSG) {
649649 xfrm_audit_state_icvfail(x, skb,
650650 x->type->proto);
net/xfrm/xfrm_interface.c+21−0
@@ -750,7 +750,28 @@ static struct rtnl_link_ops xfrmi_link_ops __read_mostly = { · 749 unmodified lines
750750 .get_link_net = xfrmi_get_link_net,
751751 };
752752
753+static void __net_exit xfrmi_exit_batch_net(struct list_head *net_exit_list)
754+{
755+ struct net *net;
756+ LIST_HEAD(list);
757+
758+ rtnl_lock();
759+ list_for_each_entry(net, net_exit_list, exit_list) {
760+ struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
761+ struct xfrm_if __rcu **xip;
762+ struct xfrm_if *xi;
763+
764+ for (xip = &xfrmn->xfrmi[0];
765+ (xi = rtnl_dereference(*xip)) != NULL;
766+ xip = &xi->next)
767+ unregister_netdevice_queue(xi->dev, &list);
768+ }
769+ unregister_netdevice_many(&list);
770+ rtnl_unlock();
771+}
772+
753773 static struct pernet_operations xfrmi_net_ops = {
774+ .exit_batch = xfrmi_exit_batch_net,
754775 .id = &xfrmi_net_id,
755776 .size = sizeof(struct xfrmi_net),
756777 };
net/xfrm/xfrm_output.c+9−6
@@ -583,18 +583,20 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb) · 582 unmodified lines
583583 xfrm_state_hold(x);
584584
585585 if (skb_is_gso(skb)) {
586− skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
586+ if (skb->inner_protocol)
587+ return xfrm_output_gso(net, sk, skb);
587588
588− return xfrm_output2(net, sk, skb);
589+ skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
590+ goto out;
589591 }
590592
591593 if (x->xso.dev && x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)
592594 goto out;
595+ } else {
596+ if (skb_is_gso(skb))
597+ return xfrm_output_gso(net, sk, skb);
593598 }
594599
595− if (skb_is_gso(skb))
596− return xfrm_output_gso(net, sk, skb);
597−
598600 if (skb->ip_summed == CHECKSUM_PARTIAL) {
599601 err = skb_checksum_help(skb);
600602 if (err) {
@@ -640,7 +642,8 @@ void xfrm_local_error(struct sk_buff *skb, int mtu) · 39 unmodified lines
640642
641643 if (skb->protocol == htons(ETH_P_IP))
642644 proto = AF_INET;
643− else if (skb->protocol == htons(ETH_P_IPV6))
645+ else if (skb->protocol == htons(ETH_P_IPV6) &&
646+ skb->sk->sk_family == AF_INET6)
644647 proto = AF_INET6;
645648 else
646649 return;
net/xfrm/xfrm_policy.c+1−6
@@ -1436,12 +1436,7 @@ static void xfrm_policy_requeue(struct xfrm_policy *old, · 1435 unmodified lines
14361436 static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
14371437 struct xfrm_policy *pol)
14381438 {
1439− u32 mark = policy->mark.v & policy->mark.m;
1440−
1441− if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
1442− return true;
1443−
1444− if ((mark & pol->mark.m) == pol->mark.v &&
1439+ if (policy->mark.v == pol->mark.v &&
14451440 policy->priority == pol->priority)
14461441 return true;
14471442
tools/testing/selftests/bpf/verifier/bounds.c+32−14
@@ -238,7 +238,7 @@ · 237 unmodified lines
238238 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
239239 BPF_LD_MAP_FD(BPF_REG_1, 0),
240240 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
241− BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
241+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 8),
242242 /* r1 = [0x00, 0xff] */
243243 BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
244244 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0xffffff80 >> 1),
@@ -253,10 +253,6 @@ · 8 unmodified lines
253253 * [0xffff'ffff'0000'0080, 0xffff'ffff'ffff'ffff]
254254 */
255255 BPF_ALU64_IMM(BPF_SUB, BPF_REG_1, 0xffffff80 >> 1),
256− /* r1 = 0 or
257− * [0x00ff'ffff'ff00'0000, 0x00ff'ffff'ffff'ffff]
258− */
259− BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 8),
260256 /* error on OOB pointer computation */
261257 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
262258 /* exit */
@@ -265,8 +261,10 @@ · 2 unmodified lines
265261 },
266262 .fixup_map_hash_8b = { 3 },
267263 /* not actually fully unbounded, but the bound is very high */
268− .errstr = "value 72057594021150720 makes map_value pointer be out of bounds",
269− .result = REJECT
264+ .errstr_unpriv = "R1 has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root",
265+ .result_unpriv = REJECT,
266+ .errstr = "value -4294967168 makes map_value pointer be out of bounds",
267+ .result = REJECT,
270268 },
271269 {
272270 "bounds check after truncation of boundary-crossing range (2)",
@@ -276,7 +274,7 @@ · 3 unmodified lines
276274 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
277275 BPF_LD_MAP_FD(BPF_REG_1, 0),
278276 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
279− BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
277+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 8),
280278 /* r1 = [0x00, 0xff] */
281279 BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_0, 0),
282280 BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 0xffffff80 >> 1),
@@ -293,10 +291,6 @@ · 10 unmodified lines
293291 * [0xffff'ffff'0000'0080, 0xffff'ffff'ffff'ffff]
294292 */
295293 BPF_ALU64_IMM(BPF_SUB, BPF_REG_1, 0xffffff80 >> 1),
296− /* r1 = 0 or
297− * [0x00ff'ffff'ff00'0000, 0x00ff'ffff'ffff'ffff]
298− */
299− BPF_ALU64_IMM(BPF_RSH, BPF_REG_1, 8),
300294 /* error on OOB pointer computation */
301295 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
302296 /* exit */
@@ -305,8 +299,10 @@ · 2 unmodified lines
305299 },
306300 .fixup_map_hash_8b = { 3 },
307301 /* not actually fully unbounded, but the bound is very high */
308− .errstr = "value 72057594021150720 makes map_value pointer be out of bounds",
309− .result = REJECT
302+ .errstr_unpriv = "R1 has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root",
303+ .result_unpriv = REJECT,
304+ .errstr = "value -4294967168 makes map_value pointer be out of bounds",
305+ .result = REJECT,
310306 },
311307 {
312308 "bounds check after wrapping 32-bit addition",
@@ -539,3 +535,25 @@ · 226 unmodified lines
539535 },
540536 .result = ACCEPT
541537 },
538+{
539+ "assigning 32bit bounds to 64bit for wA = 0, wB = wA",
540+ .insns = {
541+ BPF_LDX_MEM(BPF_W, BPF_REG_8, BPF_REG_1,
542+ offsetof(struct __sk_buff, data_end)),
543+ BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_1,
544+ offsetof(struct __sk_buff, data)),
545+ BPF_MOV32_IMM(BPF_REG_9, 0),
546+ BPF_MOV32_REG(BPF_REG_2, BPF_REG_9),
547+ BPF_MOV64_REG(BPF_REG_6, BPF_REG_7),
548+ BPF_ALU64_REG(BPF_ADD, BPF_REG_6, BPF_REG_2),
549+ BPF_MOV64_REG(BPF_REG_3, BPF_REG_6),
550+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 8),
551+ BPF_JMP_REG(BPF_JGT, BPF_REG_3, BPF_REG_8, 1),
552+ BPF_LDX_MEM(BPF_W, BPF_REG_5, BPF_REG_6, 0),
553+ BPF_MOV64_IMM(BPF_REG_0, 0),
554+ BPF_EXIT_INSN(),
555+ },
556+ .prog_type = BPF_PROG_TYPE_SCHED_CLS,
557+ .result = ACCEPT,
558+ .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
559+},
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_pie.json+21−0
@@ -0,0 +1,21 @@
1+[
2+ {
3+ "id": "83be",
4+ "name": "Create FQ-PIE with invalid number of flows",
5+ "category": [
6+ "qdisc",
7+ "fq_pie"
8+ ],
9+ "setup": [
10+ "$IP link add dev $DUMMY type dummy || /bin/true"
11+ ],
12+ "cmdUnderTest": "$TC qdisc add dev $DUMMY root fq_pie flows 65536",
13+ "expExitCode": "2",
14+ "verifyCmd": "$TC qdisc show dev $DUMMY",
15+ "matchPattern": "qdisc",
16+ "matchCount": "0",
17+ "teardown": [
18+ "$IP link del dev $DUMMY"
19+ ]
20+ }
21+]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t