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

Configure Feed

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

Merge tag 'net-6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Paolo Abeni:
"Including fixes from netfilter and CAN.

Current release - regressions:

- netfilter: nf_conncount: fix leaked ct in error paths

- sched: act_mirred: fix loop detection

- sctp: fix potential deadlock in sctp_clone_sock()

- can: fix build dependency

- eth: mlx5e: do not update BQL of old txqs during channel
reconfiguration

Previous releases - regressions:

- sched: ets: always remove class from active list before deleting it

- inet: frags: flush pending skbs in fqdir_pre_exit()

- netfilter: nf_nat: remove bogus direction check

- mptcp:
- schedule rtx timer only after pushing data
- avoid deadlock on fallback while reinjecting

- can: gs_usb: fix error handling

- eth:
- mlx5e:
- avoid unregistering PSP twice
- fix double unregister of HCA_PORTS component
- bnxt_en: fix XDP_TX path
- mlxsw: fix use-after-free when updating multicast route stats

Previous releases - always broken:

- ethtool: avoid overflowing userspace buffer on stats query

- openvswitch: fix middle attribute validation in push_nsh() action

- eth:
- mlx5: fw_tracer, validate format string parameters
- mlxsw: spectrum_router: fix neighbour use-after-free
- ipvlan: ignore PACKET_LOOPBACK in handle_mode_l2()

Misc:

- Jozsef Kadlecsik retires from maintaining netfilter

- tools: ynl: fix build on systems with old kernel headers"

* tag 'net-6.19-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (83 commits)
net: hns3: add VLAN id validation before using
net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx
net: hns3: using the num_tqps in the vf driver to apply for resources
net: enetc: do not transmit redirected XDP frames when the link is down
selftests/tc-testing: Test case exercising potential mirred redirect deadlock
net/sched: act_mirred: fix loop detection
sctp: Clear inet_opt in sctp_v6_copy_ip_options().
sctp: Fetch inet6_sk() after setting ->pinet6 in sctp_clone_sock().
net/handshake: duplicate handshake cancellations leak socket
net/mlx5e: Don't include PSP in the hard MTU calculations
net/mlx5e: Do not update BQL of old txqs during channel reconfiguration
net/mlx5e: Trigger neighbor resolution for unresolved destinations
net/mlx5e: Use ip6_dst_lookup instead of ipv6_dst_lookup_flow for MAC init
net/mlx5: Serialize firmware reset with devlink
net/mlx5: fw_tracer, Handle escaped percent properly
net/mlx5: fw_tracer, Validate format string parameters
net/mlx5: Drain firmware reset in shutdown callback
net/mlx5: fw reset, clear reset requested on drain_fw_reset
net: dsa: mxl-gsw1xx: manually clear RANEG bit
net: dsa: mxl-gsw1xx: fix .shutdown driver operation
...

+769 -269
+1
CREDITS
··· 1987 1987 D: netfilter: raw table 1988 1988 D: netfilter: iprange match 1989 1989 D: netfilter: new logging interfaces 1990 + D: netfilter: ipset 1990 1991 D: netfilter: various other hacks 1991 1992 S: Tata 1992 1993 S: Hungary
-1
MAINTAINERS
··· 18028 18028 18029 18029 NETFILTER 18030 18030 M: Pablo Neira Ayuso <pablo@netfilter.org> 18031 - M: Jozsef Kadlecsik <kadlec@netfilter.org> 18032 18031 M: Florian Westphal <fw@strlen.de> 18033 18032 R: Phil Sutter <phil@nwl.cc> 18034 18033 L: netfilter-devel@vger.kernel.org
+2 -5
drivers/net/can/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 menuconfig CAN_DEV 4 - tristate "CAN Device Drivers" 4 + bool "CAN Device Drivers" 5 5 default y 6 6 depends on CAN 7 7 help ··· 17 17 virtual ones. If you own such devices or plan to use the virtual CAN 18 18 interfaces to develop applications, say Y here. 19 19 20 - To compile as a module, choose M here: the module will be called 21 - can-dev. 22 - 23 - if CAN_DEV 20 + if CAN_DEV && CAN 24 21 25 22 config CAN_VCAN 26 23 tristate "Virtual Local CAN Interface (vcan)"
+1 -1
drivers/net/can/Makefile
··· 7 7 obj-$(CONFIG_CAN_VXCAN) += vxcan.o 8 8 obj-$(CONFIG_CAN_SLCAN) += slcan/ 9 9 10 - obj-y += dev/ 10 + obj-$(CONFIG_CAN_DEV) += dev/ 11 11 obj-y += esd/ 12 12 obj-y += rcar/ 13 13 obj-y += rockchip/
+2 -3
drivers/net/can/dev/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 3 - obj-$(CONFIG_CAN_DEV) += can-dev.o 3 + obj-$(CONFIG_CAN) += can-dev.o 4 4 5 - can-dev-y += skb.o 6 - 5 + can-dev-$(CONFIG_CAN_DEV) += skb.o 7 6 can-dev-$(CONFIG_CAN_CALC_BITTIMING) += calc_bittiming.o 8 7 can-dev-$(CONFIG_CAN_NETLINK) += bittiming.o 9 8 can-dev-$(CONFIG_CAN_NETLINK) += dev.o
+1 -1
drivers/net/can/usb/gs_usb.c
··· 1074 1074 usb_free_urb(urb); 1075 1075 out_usb_kill_anchored_urbs: 1076 1076 if (!parent->active_channels) { 1077 - usb_kill_anchored_urbs(&dev->tx_submitted); 1077 + usb_kill_anchored_urbs(&parent->rx_submitted); 1078 1078 1079 1079 if (dev->feature & GS_CAN_FEATURE_HW_TIMESTAMP) 1080 1080 gs_usb_timestamp_stop(parent);
-3
drivers/net/dsa/lantiq/lantiq_gswip.c
··· 444 444 if (!priv) 445 445 return; 446 446 447 - /* disable the switch */ 448 - gswip_disable_switch(priv); 449 - 450 447 dsa_unregister_switch(priv->ds); 451 448 452 449 for (i = 0; i < priv->num_gphy_fw; i++)
-2
drivers/net/dsa/lantiq/lantiq_gswip.h
··· 294 294 u16 version; 295 295 }; 296 296 297 - void gswip_disable_switch(struct gswip_priv *priv); 298 - 299 297 int gswip_probe_common(struct gswip_priv *priv, u32 version); 300 298 301 299 #endif /* __LANTIQ_GSWIP_H */
+10 -9
drivers/net/dsa/lantiq/lantiq_gswip_common.c
··· 752 752 return 0; 753 753 } 754 754 755 + static void gswip_teardown(struct dsa_switch *ds) 756 + { 757 + struct gswip_priv *priv = ds->priv; 758 + 759 + regmap_clear_bits(priv->mdio, GSWIP_MDIO_GLOB, GSWIP_MDIO_GLOB_ENABLE); 760 + } 761 + 755 762 static enum dsa_tag_protocol gswip_get_tag_protocol(struct dsa_switch *ds, 756 763 int port, 757 764 enum dsa_tag_protocol mp) ··· 1636 1629 static const struct dsa_switch_ops gswip_switch_ops = { 1637 1630 .get_tag_protocol = gswip_get_tag_protocol, 1638 1631 .setup = gswip_setup, 1632 + .teardown = gswip_teardown, 1639 1633 .port_setup = gswip_port_setup, 1640 1634 .port_enable = gswip_port_enable, 1641 1635 .port_disable = gswip_port_disable, ··· 1663 1655 .port_hsr_join = dsa_port_simple_hsr_join, 1664 1656 .port_hsr_leave = dsa_port_simple_hsr_leave, 1665 1657 }; 1666 - 1667 - void gswip_disable_switch(struct gswip_priv *priv) 1668 - { 1669 - regmap_clear_bits(priv->mdio, GSWIP_MDIO_GLOB, GSWIP_MDIO_GLOB_ENABLE); 1670 - } 1671 - EXPORT_SYMBOL_GPL(gswip_disable_switch); 1672 1658 1673 1659 static int gswip_validate_cpu_port(struct dsa_switch *ds) 1674 1660 { ··· 1720 1718 1721 1719 err = gswip_validate_cpu_port(priv->ds); 1722 1720 if (err) 1723 - goto disable_switch; 1721 + goto unregister_switch; 1724 1722 1725 1723 dev_info(priv->dev, "probed GSWIP version %lx mod %lx\n", 1726 1724 GSWIP_VERSION_REV(version), GSWIP_VERSION_MOD(version)); 1727 1725 1728 1726 return 0; 1729 1727 1730 - disable_switch: 1731 - gswip_disable_switch(priv); 1728 + unregister_switch: 1732 1729 dsa_unregister_switch(priv->ds); 1733 1730 1734 1731 return err;
+41 -5
drivers/net/dsa/lantiq/mxl-gsw1xx.c
··· 11 11 12 12 #include <linux/bits.h> 13 13 #include <linux/delay.h> 14 + #include <linux/jiffies.h> 14 15 #include <linux/module.h> 15 16 #include <linux/of_device.h> 16 17 #include <linux/of_mdio.h> 17 18 #include <linux/regmap.h> 19 + #include <linux/workqueue.h> 18 20 #include <net/dsa.h> 19 21 20 22 #include "lantiq_gswip.h" ··· 31 29 struct regmap *clk; 32 30 struct regmap *shell; 33 31 struct phylink_pcs pcs; 32 + struct delayed_work clear_raneg; 34 33 phy_interface_t tbi_interface; 35 34 struct gswip_priv gswip; 36 35 }; ··· 148 145 { 149 146 struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs); 150 147 151 - /* Assert SGMII shell reset */ 148 + cancel_delayed_work_sync(&priv->clear_raneg); 149 + 150 + /* Assert SGMII shell reset (will also clear RANEG bit) */ 152 151 regmap_set_bits(priv->shell, GSW1XX_SHELL_RST_REQ, 153 152 GSW1XX_RST_REQ_SGMII_SHELL); 154 153 ··· 260 255 FIELD_PREP(GSW1XX_SGMII_PHY_RX0_CFG2_FILT_CNT, 261 256 GSW1XX_SGMII_PHY_RX0_CFG2_FILT_CNT_DEF); 262 257 263 - /* TODO: Take care of inverted RX pair once generic property is 258 + /* RX lane seems to be inverted internally, so bit 259 + * GSW1XX_SGMII_PHY_RX0_CFG2_INVERT needs to be set for normal 260 + * (ie. non-inverted) operation. 261 + * 262 + * TODO: Take care of inverted RX pair once generic property is 264 263 * available 265 264 */ 265 + 266 + val |= GSW1XX_SGMII_PHY_RX0_CFG2_INVERT; 266 267 267 268 ret = regmap_write(priv->sgmii, GSW1XX_SGMII_PHY_RX0_CFG2, val); 268 269 if (ret < 0) ··· 433 422 return 0; 434 423 } 435 424 425 + static void gsw1xx_pcs_clear_raneg(struct work_struct *work) 426 + { 427 + struct gsw1xx_priv *priv = 428 + container_of(work, struct gsw1xx_priv, clear_raneg.work); 429 + 430 + regmap_clear_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL, 431 + GSW1XX_SGMII_TBI_ANEGCTL_RANEG); 432 + } 433 + 436 434 static void gsw1xx_pcs_an_restart(struct phylink_pcs *pcs) 437 435 { 438 436 struct gsw1xx_priv *priv = pcs_to_gsw1xx(pcs); 439 437 438 + cancel_delayed_work_sync(&priv->clear_raneg); 439 + 440 440 regmap_set_bits(priv->sgmii, GSW1XX_SGMII_TBI_ANEGCTL, 441 441 GSW1XX_SGMII_TBI_ANEGCTL_RANEG); 442 + 443 + /* despite being documented as self-clearing, the RANEG bit 444 + * sometimes remains set, preventing auto-negotiation from happening. 445 + * MaxLinear advises to manually clear the bit after 10ms. 446 + */ 447 + schedule_delayed_work(&priv->clear_raneg, msecs_to_jiffies(10)); 442 448 } 443 449 444 450 static void gsw1xx_pcs_link_up(struct phylink_pcs *pcs, ··· 658 630 if (ret) 659 631 return ret; 660 632 633 + INIT_DELAYED_WORK(&priv->clear_raneg, gsw1xx_pcs_clear_raneg); 634 + 661 635 ret = gswip_probe_common(&priv->gswip, version); 662 636 if (ret) 663 637 return ret; ··· 672 642 static void gsw1xx_remove(struct mdio_device *mdiodev) 673 643 { 674 644 struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev); 645 + struct gsw1xx_priv *gsw1xx_priv; 675 646 676 647 if (!priv) 677 648 return; 678 649 679 - gswip_disable_switch(priv); 680 - 681 650 dsa_unregister_switch(priv->ds); 651 + 652 + gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip); 653 + cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg); 682 654 } 683 655 684 656 static void gsw1xx_shutdown(struct mdio_device *mdiodev) 685 657 { 686 658 struct gswip_priv *priv = dev_get_drvdata(&mdiodev->dev); 659 + struct gsw1xx_priv *gsw1xx_priv; 687 660 688 661 if (!priv) 689 662 return; 690 663 664 + dsa_switch_shutdown(priv->ds); 665 + 691 666 dev_set_drvdata(&mdiodev->dev, NULL); 692 667 693 - gswip_disable_switch(priv); 668 + gsw1xx_priv = container_of(priv, struct gsw1xx_priv, gswip); 669 + cancel_delayed_work_sync(&gsw1xx_priv->clear_raneg); 694 670 } 695 671 696 672 static const struct gswip_hw_info gsw12x_data = {
+3
drivers/net/ethernet/broadcom/b44.c
··· 1790 1790 u32 bmcr; 1791 1791 int r; 1792 1792 1793 + if (bp->flags & B44_FLAG_EXTERNAL_PHY) 1794 + return phy_ethtool_nway_reset(dev); 1795 + 1793 1796 spin_lock_irq(&bp->lock); 1794 1797 b44_readphy(bp, MII_BMCR, &bmcr); 1795 1798 b44_readphy(bp, MII_BMCR, &bmcr);
+1 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
··· 268 268 case XDP_TX: 269 269 rx_buf = &rxr->rx_buf_ring[cons]; 270 270 mapping = rx_buf->mapping - bp->rx_dma_offset; 271 - *event &= BNXT_TX_CMP_EVENT; 272 271 273 272 if (unlikely(xdp_buff_has_frags(xdp))) { 274 273 struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); 275 274 276 275 tx_needed += sinfo->nr_frags; 277 - *event = BNXT_AGG_EVENT; 278 276 } 279 277 280 278 if (tx_avail < tx_needed) { ··· 285 287 dma_sync_single_for_device(&pdev->dev, mapping + offset, *len, 286 288 bp->rx_dir); 287 289 290 + *event &= ~BNXT_RX_EVENT; 288 291 *event |= BNXT_TX_EVENT; 289 292 __bnxt_xmit_xdp(bp, txr, mapping + offset, *len, 290 293 NEXT_RX(rxr->rx_prod), xdp);
+2 -1
drivers/net/ethernet/freescale/enetc/enetc.c
··· 1787 1787 int xdp_tx_bd_cnt, i, k; 1788 1788 int xdp_tx_frm_cnt = 0; 1789 1789 1790 - if (unlikely(test_bit(ENETC_TX_DOWN, &priv->flags))) 1790 + if (unlikely(test_bit(ENETC_TX_DOWN, &priv->flags) || 1791 + !netif_carrier_ok(ndev))) 1791 1792 return -ENETDOWN; 1792 1793 1793 1794 enetc_lock_mdio();
+6 -1
drivers/net/ethernet/freescale/fec_main.c
··· 3933 3933 txq->bd.cur = bdp; 3934 3934 3935 3935 /* Trigger transmission start */ 3936 - writel(0, txq->bd.reg_desc_active); 3936 + if (!(fep->quirks & FEC_QUIRK_ERR007885) || 3937 + !readl(txq->bd.reg_desc_active) || 3938 + !readl(txq->bd.reg_desc_active) || 3939 + !readl(txq->bd.reg_desc_active) || 3940 + !readl(txq->bd.reg_desc_active)) 3941 + writel(0, txq->bd.reg_desc_active); 3937 3942 3938 3943 return 0; 3939 3944 }
+10 -7
drivers/net/ethernet/google/gve/gve_main.c
··· 647 647 err = gve_alloc_counter_array(priv); 648 648 if (err) 649 649 goto abort_with_rss_config_cache; 650 - err = gve_init_clock(priv); 651 - if (err) 652 - goto abort_with_counter; 653 650 err = gve_alloc_notify_blocks(priv); 654 651 if (err) 655 - goto abort_with_clock; 652 + goto abort_with_counter; 656 653 err = gve_alloc_stats_report(priv); 657 654 if (err) 658 655 goto abort_with_ntfy_blocks; ··· 680 683 } 681 684 } 682 685 686 + err = gve_init_clock(priv); 687 + if (err) { 688 + dev_err(&priv->pdev->dev, "Failed to init clock"); 689 + goto abort_with_ptype_lut; 690 + } 691 + 683 692 err = gve_init_rss_config(priv, priv->rx_cfg.num_queues); 684 693 if (err) { 685 694 dev_err(&priv->pdev->dev, "Failed to init RSS config"); 686 - goto abort_with_ptype_lut; 695 + goto abort_with_clock; 687 696 } 688 697 689 698 err = gve_adminq_report_stats(priv, priv->stats_report_len, ··· 701 698 gve_set_device_resources_ok(priv); 702 699 return 0; 703 700 701 + abort_with_clock: 702 + gve_teardown_clock(priv); 704 703 abort_with_ptype_lut: 705 704 kvfree(priv->ptype_lut_dqo); 706 705 priv->ptype_lut_dqo = NULL; ··· 710 705 gve_free_stats_report(priv); 711 706 abort_with_ntfy_blocks: 712 707 gve_free_notify_blocks(priv); 713 - abort_with_clock: 714 - gve_teardown_clock(priv); 715 708 abort_with_counter: 716 709 gve_free_counter_array(priv); 717 710 abort_with_rss_config_cache:
+3
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 10555 10555 bool writen_to_tbl = false; 10556 10556 int ret = 0; 10557 10557 10558 + if (vlan_id >= VLAN_N_VID) 10559 + return -EINVAL; 10560 + 10558 10561 /* When device is resetting or reset failed, firmware is unable to 10559 10562 * handle mailbox. Just record the vlan id, and remove it after 10560 10563 * reset finished.
+2 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 193 193 return -EINVAL; 194 194 195 195 for (i = 0; i < ring_num; i++) { 196 - if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) { 196 + if (req->msg.param[i].tqp_index >= vport->nic.kinfo.num_tqps) { 197 197 dev_err(&hdev->pdev->dev, "tqp index(%u) is out of range(0-%u)\n", 198 198 req->msg.param[i].tqp_index, 199 - vport->nic.kinfo.rss_size - 1U); 199 + vport->nic.kinfo.num_tqps - 1U); 200 200 return -EINVAL; 201 201 } 202 202 }
+2 -2
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 368 368 new_tqps = kinfo->rss_size * num_tc; 369 369 kinfo->num_tqps = min(new_tqps, hdev->num_tqps); 370 370 371 - kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, kinfo->num_tqps, 371 + kinfo->tqp = devm_kcalloc(&hdev->pdev->dev, hdev->num_tqps, 372 372 sizeof(struct hnae3_queue *), GFP_KERNEL); 373 373 if (!kinfo->tqp) 374 374 return -ENOMEM; 375 375 376 - for (i = 0; i < kinfo->num_tqps; i++) { 376 + for (i = 0; i < hdev->num_tqps; i++) { 377 377 hdev->htqp[i].q.handle = &hdev->nic; 378 378 hdev->htqp[i].q.tqp_index = i; 379 379 kinfo->tqp[i] = &hdev->htqp[i].q;
+5
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 197 197 struct pci_dev *pdev = dev->pdev; 198 198 int ret = 0; 199 199 200 + if (mlx5_fw_reset_in_progress(dev)) { 201 + NL_SET_ERR_MSG_MOD(extack, "Can't reload during firmware reset"); 202 + return -EBUSY; 203 + } 204 + 200 205 if (mlx5_dev_is_lightweight(dev)) { 201 206 if (action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT) 202 207 return -EOPNOTSUPP;
+84 -13
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c
··· 33 33 #include "lib/eq.h" 34 34 #include "fw_tracer.h" 35 35 #include "fw_tracer_tracepoint.h" 36 + #include <linux/ctype.h> 36 37 37 38 static int mlx5_query_mtrc_caps(struct mlx5_fw_tracer *tracer) 38 39 { ··· 359 358 static const char *REPLACE_64_VAL_PARM = "%x%x"; 360 359 static const char *PARAM_CHAR = "%"; 361 360 361 + static bool mlx5_is_valid_spec(const char *str) 362 + { 363 + /* Parse format specifiers to find the actual type. 364 + * Structure: %[flags][width][.precision][length]type 365 + * Skip flags, width, precision & length. 366 + */ 367 + while (isdigit(*str) || *str == '#' || *str == '.' || *str == 'l') 368 + str++; 369 + 370 + /* Check if it's a valid integer/hex specifier or %%: 371 + * Valid formats: %x, %d, %i, %u, etc. 372 + */ 373 + if (*str != 'x' && *str != 'X' && *str != 'd' && *str != 'i' && 374 + *str != 'u' && *str != 'c' && *str != '%') 375 + return false; 376 + 377 + return true; 378 + } 379 + 380 + static bool mlx5_tracer_validate_params(const char *str) 381 + { 382 + const char *substr = str; 383 + 384 + if (!str) 385 + return false; 386 + 387 + substr = strstr(substr, PARAM_CHAR); 388 + while (substr) { 389 + if (!mlx5_is_valid_spec(substr + 1)) 390 + return false; 391 + 392 + if (*(substr + 1) == '%') 393 + substr = strstr(substr + 2, PARAM_CHAR); 394 + else 395 + substr = strstr(substr + 1, PARAM_CHAR); 396 + 397 + } 398 + 399 + return true; 400 + } 401 + 362 402 static int mlx5_tracer_message_hash(u32 message_id) 363 403 { 364 404 return jhash_1word(message_id, 0) & (MESSAGE_HASH_SIZE - 1); ··· 461 419 char *substr, *pstr = str; 462 420 int num_of_params = 0; 463 421 422 + /* Validate that all parameters are valid before processing */ 423 + if (!mlx5_tracer_validate_params(str)) 424 + return -EINVAL; 425 + 464 426 /* replace %llx with %x%x */ 465 427 substr = strstr(pstr, VAL_PARM); 466 428 while (substr) { ··· 473 427 substr = strstr(pstr, VAL_PARM); 474 428 } 475 429 476 - /* count all the % characters */ 430 + /* count all the % characters, but skip %% (escaped percent) */ 477 431 substr = strstr(str, PARAM_CHAR); 478 432 while (substr) { 479 - num_of_params += 1; 480 - str = substr + 1; 433 + if (*(substr + 1) != '%') { 434 + num_of_params += 1; 435 + str = substr + 1; 436 + } else { 437 + str = substr + 2; 438 + } 481 439 substr = strstr(str, PARAM_CHAR); 482 440 } 483 441 ··· 620 570 { 621 571 char tmp[512]; 622 572 623 - snprintf(tmp, sizeof(tmp), str_frmt->string, 624 - str_frmt->params[0], 625 - str_frmt->params[1], 626 - str_frmt->params[2], 627 - str_frmt->params[3], 628 - str_frmt->params[4], 629 - str_frmt->params[5], 630 - str_frmt->params[6]); 573 + if (str_frmt->invalid_string) 574 + snprintf(tmp, sizeof(tmp), "BAD_FORMAT: %s", str_frmt->string); 575 + else 576 + snprintf(tmp, sizeof(tmp), str_frmt->string, 577 + str_frmt->params[0], 578 + str_frmt->params[1], 579 + str_frmt->params[2], 580 + str_frmt->params[3], 581 + str_frmt->params[4], 582 + str_frmt->params[5], 583 + str_frmt->params[6]); 631 584 632 585 trace_mlx5_fw(dev->tracer, trace_timestamp, str_frmt->lost, 633 586 str_frmt->event_id, tmp); ··· 662 609 return 0; 663 610 } 664 611 612 + static void mlx5_tracer_handle_bad_format_string(struct mlx5_fw_tracer *tracer, 613 + struct tracer_string_format *cur_string) 614 + { 615 + cur_string->invalid_string = true; 616 + list_add_tail(&cur_string->list, &tracer->ready_strings_list); 617 + } 618 + 665 619 static int mlx5_tracer_handle_string_trace(struct mlx5_fw_tracer *tracer, 666 620 struct tracer_event *tracer_event) 667 621 { ··· 679 619 if (!cur_string) 680 620 return mlx5_tracer_handle_raw_string(tracer, tracer_event); 681 621 682 - cur_string->num_of_params = mlx5_tracer_get_num_of_params(cur_string->string); 683 - cur_string->last_param_num = 0; 684 622 cur_string->event_id = tracer_event->event_id; 685 623 cur_string->tmsn = tracer_event->string_event.tmsn; 686 624 cur_string->timestamp = tracer_event->string_event.timestamp; 687 625 cur_string->lost = tracer_event->lost_event; 626 + cur_string->last_param_num = 0; 627 + cur_string->num_of_params = mlx5_tracer_get_num_of_params(cur_string->string); 628 + if (cur_string->num_of_params < 0) { 629 + pr_debug("%s Invalid format string parameters\n", 630 + __func__); 631 + mlx5_tracer_handle_bad_format_string(tracer, cur_string); 632 + return 0; 633 + } 688 634 if (cur_string->num_of_params == 0) /* trace with no params */ 689 635 list_add_tail(&cur_string->list, &tracer->ready_strings_list); 690 636 } else { ··· 699 633 pr_debug("%s Got string event for unknown string tmsn: %d\n", 700 634 __func__, tracer_event->string_event.tmsn); 701 635 return mlx5_tracer_handle_raw_string(tracer, tracer_event); 636 + } 637 + if (cur_string->num_of_params < 0) { 638 + pr_debug("%s string parameter of invalid string, dumping\n", 639 + __func__); 640 + return 0; 702 641 } 703 642 cur_string->last_param_num += 1; 704 643 if (cur_string->last_param_num > TRACER_MAX_PARAMS) {
+1
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.h
··· 125 125 struct list_head list; 126 126 u32 timestamp; 127 127 bool lost; 128 + bool invalid_string; 128 129 }; 129 130 130 131 enum mlx5_fw_tracer_ownership_state {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 69 69 #define MLX5E_METADATA_ETHER_TYPE (0x8CE4) 70 70 #define MLX5E_METADATA_ETHER_LEN 8 71 71 72 - #define MLX5E_ETH_HARD_MTU (ETH_HLEN + PSP_ENCAP_HLEN + PSP_TRL_SIZE + VLAN_HLEN + ETH_FCS_LEN) 72 + #define MLX5E_ETH_HARD_MTU (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN) 73 73 74 74 #define MLX5E_HW2SW_MTU(params, hwmtu) ((hwmtu) - ((params)->hard_mtu)) 75 75 #define MLX5E_SW2HW_MTU(params, swmtu) ((swmtu) + ((params)->hard_mtu))
+5 -3
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
··· 342 342 rt_dst_entry = &rt->dst; 343 343 break; 344 344 case AF_INET6: 345 - rt_dst_entry = ipv6_stub->ipv6_dst_lookup_flow( 346 - dev_net(netdev), NULL, &fl6, NULL); 347 - if (IS_ERR(rt_dst_entry)) 345 + if (!IS_ENABLED(CONFIG_IPV6) || 346 + ip6_dst_lookup(dev_net(netdev), NULL, &rt_dst_entry, &fl6)) 348 347 goto neigh; 349 348 break; 350 349 default: ··· 358 359 359 360 neigh_ha_snapshot(addr, n, netdev); 360 361 ether_addr_copy(dst, addr); 362 + if (attrs->dir == XFRM_DEV_OFFLOAD_OUT && 363 + is_zero_ether_addr(addr)) 364 + neigh_event_send(n, NULL); 361 365 dst_release(rt_dst_entry); 362 366 neigh_release(n); 363 367 return;
-1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 6825 6825 * is already unregistered before changing to NIC profile. 6826 6826 */ 6827 6827 if (priv->netdev->reg_state == NETREG_REGISTERED) { 6828 - mlx5e_psp_unregister(priv); 6829 6828 unregister_netdev(priv->netdev); 6830 6829 _mlx5e_suspend(adev, false); 6831 6830 } else {
+5 -1
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
··· 939 939 sq->dma_fifo_cc = dma_fifo_cc; 940 940 sq->cc = sqcc; 941 941 942 - netdev_tx_completed_queue(sq->txq, npkts, nbytes); 942 + /* Do not update BQL for TXQs that got replaced by new active ones, as 943 + * netdev_tx_reset_queue() is called for them in mlx5e_activate_txqsq(). 944 + */ 945 + if (sq == sq->priv->txq2sq[sq->txq_ix]) 946 + netdev_tx_completed_queue(sq->txq, npkts, nbytes); 943 947 } 944 948 945 949 #ifdef CONFIG_MLX5_CORE_IPOIB
+6
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 52 52 #include "devlink.h" 53 53 #include "lag/lag.h" 54 54 #include "en/tc/post_meter.h" 55 + #include "fw_reset.h" 55 56 56 57 /* There are two match-all miss flows, one for unicast dst mac and 57 58 * one for multicast. ··· 3991 3990 esw = mlx5_devlink_eswitch_get(devlink); 3992 3991 if (IS_ERR(esw)) 3993 3992 return PTR_ERR(esw); 3993 + 3994 + if (mlx5_fw_reset_in_progress(esw->dev)) { 3995 + NL_SET_ERR_MSG_MOD(extack, "Can't change eswitch mode during firmware reset"); 3996 + return -EBUSY; 3997 + } 3994 3998 3995 3999 if (esw_mode_from_devlink(mode, &mlx5_mode)) 3996 4000 return -EINVAL;
+43 -5
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c
··· 15 15 MLX5_FW_RESET_FLAGS_DROP_NEW_REQUESTS, 16 16 MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED, 17 17 MLX5_FW_RESET_FLAGS_UNLOAD_EVENT, 18 + MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, 18 19 }; 19 20 20 21 struct mlx5_fw_reset { ··· 127 126 int mlx5_fw_reset_query(struct mlx5_core_dev *dev, u8 *reset_level, u8 *reset_type) 128 127 { 129 128 return mlx5_reg_mfrl_query(dev, reset_level, reset_type, NULL, NULL); 129 + } 130 + 131 + bool mlx5_fw_reset_in_progress(struct mlx5_core_dev *dev) 132 + { 133 + struct mlx5_fw_reset *fw_reset = dev->priv.fw_reset; 134 + 135 + if (!fw_reset) 136 + return false; 137 + 138 + return test_bit(MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, &fw_reset->reset_flags); 130 139 } 131 140 132 141 static int mlx5_fw_reset_get_reset_method(struct mlx5_core_dev *dev, ··· 254 243 BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE)); 255 244 devl_unlock(devlink); 256 245 } 246 + 247 + clear_bit(MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, &fw_reset->reset_flags); 257 248 } 258 249 259 250 static void mlx5_stop_sync_reset_poll(struct mlx5_core_dev *dev) ··· 475 462 struct mlx5_fw_reset *fw_reset = container_of(work, struct mlx5_fw_reset, 476 463 reset_request_work); 477 464 struct mlx5_core_dev *dev = fw_reset->dev; 465 + bool nack_request = false; 466 + struct devlink *devlink; 478 467 int err; 479 468 480 469 err = mlx5_fw_reset_get_reset_method(dev, &fw_reset->reset_method); 481 - if (err) 470 + if (err) { 471 + nack_request = true; 482 472 mlx5_core_warn(dev, "Failed reading MFRL, err %d\n", err); 473 + } else if (!mlx5_is_reset_now_capable(dev, fw_reset->reset_method) || 474 + test_bit(MLX5_FW_RESET_FLAGS_NACK_RESET_REQUEST, 475 + &fw_reset->reset_flags)) { 476 + nack_request = true; 477 + } 483 478 484 - if (err || test_bit(MLX5_FW_RESET_FLAGS_NACK_RESET_REQUEST, &fw_reset->reset_flags) || 485 - !mlx5_is_reset_now_capable(dev, fw_reset->reset_method)) { 479 + devlink = priv_to_devlink(dev); 480 + /* For external resets, try to acquire devl_lock. Skip if devlink reset is 481 + * pending (lock already held) 482 + */ 483 + if (nack_request || 484 + (!test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, 485 + &fw_reset->reset_flags) && 486 + !devl_trylock(devlink))) { 486 487 err = mlx5_fw_reset_set_reset_sync_nack(dev); 487 488 mlx5_core_warn(dev, "PCI Sync FW Update Reset Nack %s", 488 489 err ? "Failed" : "Sent"); 489 490 return; 490 491 } 492 + 491 493 if (mlx5_sync_reset_set_reset_requested(dev)) 492 - return; 494 + goto unlock; 495 + 496 + set_bit(MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, &fw_reset->reset_flags); 493 497 494 498 err = mlx5_fw_reset_set_reset_sync_ack(dev); 495 499 if (err) 496 500 mlx5_core_warn(dev, "PCI Sync FW Update Reset Ack Failed. Error code: %d\n", err); 497 501 else 498 502 mlx5_core_warn(dev, "PCI Sync FW Update Reset Ack. Device reset is expected.\n"); 503 + 504 + unlock: 505 + if (!test_bit(MLX5_FW_RESET_FLAGS_PENDING_COMP, &fw_reset->reset_flags)) 506 + devl_unlock(devlink); 499 507 } 500 508 501 509 static int mlx5_pci_link_toggle(struct mlx5_core_dev *dev, u16 dev_id) ··· 756 722 757 723 if (mlx5_sync_reset_clear_reset_requested(dev, true)) 758 724 return; 725 + 726 + clear_bit(MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, &fw_reset->reset_flags); 759 727 mlx5_core_warn(dev, "PCI Sync FW Update Reset Aborted.\n"); 760 728 } 761 729 ··· 794 758 795 759 if (mlx5_sync_reset_clear_reset_requested(dev, true)) 796 760 return; 761 + clear_bit(MLX5_FW_RESET_FLAGS_RESET_IN_PROGRESS, &fw_reset->reset_flags); 797 762 mlx5_core_warn(dev, "PCI Sync FW Update Reset Timeout.\n"); 798 763 } 799 764 ··· 881 844 cancel_work_sync(&fw_reset->reset_reload_work); 882 845 cancel_work_sync(&fw_reset->reset_now_work); 883 846 cancel_work_sync(&fw_reset->reset_abort_work); 884 - cancel_delayed_work(&fw_reset->reset_timeout_work); 847 + if (test_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags)) 848 + mlx5_sync_reset_clear_reset_requested(dev, true); 885 849 } 886 850 887 851 static const struct devlink_param mlx5_fw_reset_devlink_params[] = {
+1
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.h
··· 10 10 int mlx5_fw_reset_set_reset_sync(struct mlx5_core_dev *dev, u8 reset_type_sel, 11 11 struct netlink_ext_ack *extack); 12 12 int mlx5_fw_reset_set_live_patch(struct mlx5_core_dev *dev); 13 + bool mlx5_fw_reset_in_progress(struct mlx5_core_dev *dev); 13 14 14 15 int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev); 15 16 void mlx5_sync_reset_unload_flow(struct mlx5_core_dev *dev, bool locked);
+1
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
··· 1413 1413 static void mlx5_lag_unregister_hca_devcom_comp(struct mlx5_core_dev *dev) 1414 1414 { 1415 1415 mlx5_devcom_unregister_component(dev->priv.hca_devcom_comp); 1416 + dev->priv.hca_devcom_comp = NULL; 1416 1417 } 1417 1418 1418 1419 static int mlx5_lag_register_hca_devcom_comp(struct mlx5_core_dev *dev)
+9 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
··· 67 67 68 68 static int enable_mpesw(struct mlx5_lag *ldev) 69 69 { 70 - int idx = mlx5_lag_get_dev_index_by_seq(ldev, MLX5_LAG_P1); 71 70 struct mlx5_core_dev *dev0; 72 71 int err; 72 + int idx; 73 73 int i; 74 74 75 - if (idx < 0 || ldev->mode != MLX5_LAG_MODE_NONE) 75 + if (ldev->mode == MLX5_LAG_MODE_MPESW) 76 + return 0; 77 + 78 + if (ldev->mode != MLX5_LAG_MODE_NONE) 79 + return -EINVAL; 80 + 81 + idx = mlx5_lag_get_dev_index_by_seq(ldev, MLX5_LAG_P1); 82 + if (idx < 0) 76 83 return -EINVAL; 77 84 78 85 dev0 = ldev->pf[idx].dev;
+1
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 2231 2231 2232 2232 mlx5_core_info(dev, "Shutdown was called\n"); 2233 2233 set_bit(MLX5_BREAK_FW_WAIT, &dev->intf_state); 2234 + mlx5_drain_fw_reset(dev); 2234 2235 mlx5_drain_health_wq(dev); 2235 2236 err = mlx5_try_fast_unload(dev); 2236 2237 if (err)
+2
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
··· 440 440 rhashtable_remove_fast(&mr_table->route_ht, 441 441 &mr_orig_route->ht_node, 442 442 mlxsw_sp_mr_route_ht_params); 443 + mutex_lock(&mr_table->route_list_lock); 443 444 list_del(&mr_orig_route->node); 445 + mutex_unlock(&mr_table->route_list_lock); 444 446 mlxsw_sp_mr_route_destroy(mr_table, mr_orig_route); 445 447 } 446 448
+14 -13
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 2265 2265 if (!neigh_entry) 2266 2266 return NULL; 2267 2267 2268 + neigh_hold(n); 2268 2269 neigh_entry->key.n = n; 2269 2270 neigh_entry->rif = rif; 2270 2271 INIT_LIST_HEAD(&neigh_entry->nexthop_list); ··· 2275 2274 2276 2275 static void mlxsw_sp_neigh_entry_free(struct mlxsw_sp_neigh_entry *neigh_entry) 2277 2276 { 2277 + neigh_release(neigh_entry->key.n); 2278 2278 kfree(neigh_entry); 2279 2279 } 2280 2280 ··· 2860 2858 if (!net_work) 2861 2859 return NOTIFY_BAD; 2862 2860 2861 + /* Take a reference to ensure the neighbour won't be destructed until 2862 + * we drop the reference in the work item. 2863 + */ 2864 + neigh_clone(n); 2865 + 2863 2866 INIT_WORK(&net_work->work, cb); 2864 2867 net_work->mlxsw_sp = router->mlxsw_sp; 2865 2868 net_work->n = n; ··· 2888 2881 struct net *net; 2889 2882 2890 2883 net = neigh_parms_net(n->parms); 2891 - 2892 - /* Take a reference to ensure the neighbour won't be destructed until we 2893 - * drop the reference in delayed work. 2894 - */ 2895 - neigh_clone(n); 2896 2884 return mlxsw_sp_router_schedule_work(net, router, n, 2897 2885 mlxsw_sp_router_neigh_event_work); 2898 2886 } ··· 4322 4320 if (err) 4323 4321 goto err_neigh_entry_insert; 4324 4322 4323 + neigh_release(old_n); 4324 + 4325 4325 read_lock_bh(&n->lock); 4326 4326 nud_state = n->nud_state; 4327 4327 dead = n->dead; ··· 4332 4328 4333 4329 list_for_each_entry(nh, &neigh_entry->nexthop_list, 4334 4330 neigh_list_node) { 4335 - neigh_release(old_n); 4336 - neigh_clone(n); 4337 4331 __mlxsw_sp_nexthop_neigh_update(nh, !entry_connected); 4338 4332 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); 4339 4333 } 4340 - 4341 - neigh_release(n); 4342 4334 4343 4335 return 0; 4344 4336 ··· 4428 4428 } 4429 4429 } 4430 4430 4431 + /* Release the reference taken by neigh_lookup() / neigh_create() since 4432 + * neigh_entry already holds one. 4433 + */ 4434 + neigh_release(n); 4435 + 4431 4436 /* If that is the first nexthop connected to that neigh, add to 4432 4437 * nexthop_neighs_list 4433 4438 */ ··· 4459 4454 struct mlxsw_sp_nexthop *nh) 4460 4455 { 4461 4456 struct mlxsw_sp_neigh_entry *neigh_entry = nh->neigh_entry; 4462 - struct neighbour *n; 4463 4457 4464 4458 if (!neigh_entry) 4465 4459 return; 4466 - n = neigh_entry->key.n; 4467 4460 4468 4461 __mlxsw_sp_nexthop_neigh_update(nh, true); 4469 4462 list_del(&nh->neigh_list_node); ··· 4475 4472 4476 4473 if (!neigh_entry->connected && list_empty(&neigh_entry->nexthop_list)) 4477 4474 mlxsw_sp_neigh_entry_destroy(mlxsw_sp, neigh_entry); 4478 - 4479 - neigh_release(n); 4480 4475 } 4481 4476 4482 4477 static bool mlxsw_sp_ipip_netdev_ul_up(struct net_device *ol_dev)
+1 -4
drivers/net/ethernet/realtek/r8169_main.c
··· 2655 2655 2656 2656 static void rtl_prepare_power_down(struct rtl8169_private *tp) 2657 2657 { 2658 - if (tp->dash_enabled) 2659 - return; 2660 - 2661 2658 if (tp->mac_version == RTL_GIGA_MAC_VER_32 || 2662 2659 tp->mac_version == RTL_GIGA_MAC_VER_33) 2663 2660 rtl_ephy_write(tp, 0x19, 0xff64); ··· 4809 4812 rtl_disable_exit_l1(tp); 4810 4813 rtl_prepare_power_down(tp); 4811 4814 4812 - if (tp->dash_type != RTL_DASH_NONE) 4815 + if (tp->dash_type != RTL_DASH_NONE && !tp->saved_wolopts) 4813 4816 rtl8168_driver_stop(tp); 4814 4817 } 4815 4818
+2 -1
drivers/net/ethernet/ti/Kconfig
··· 209 209 depends on PRU_REMOTEPROC 210 210 depends on NET_SWITCHDEV 211 211 depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER 212 + depends on PTP_1588_CLOCK_OPTIONAL 212 213 help 213 214 Support dual Gigabit Ethernet ports over the ICSSG PRU Subsystem. 214 215 This subsystem is available on the AM65 SR1.0 platform. ··· 235 234 depends on PRU_REMOTEPROC 236 235 depends on NET_SWITCHDEV 237 236 select TI_ICSS_IEP 238 - imply PTP_1588_CLOCK 237 + depends on PTP_1588_CLOCK_OPTIONAL 239 238 help 240 239 Some TI SoCs has Programmable Realtime Unit (PRU) cores which can 241 240 support Single or Dual Ethernet ports with the help of firmware code
+3
drivers/net/ipvlan/ipvlan_core.c
··· 737 737 struct ethhdr *eth = eth_hdr(skb); 738 738 rx_handler_result_t ret = RX_HANDLER_PASS; 739 739 740 + if (unlikely(skb->pkt_type == PACKET_LOOPBACK)) 741 + return RX_HANDLER_PASS; 742 + 740 743 if (is_multicast_ether_addr(eth->h_dest)) { 741 744 if (ipvlan_external_frame(skb, port)) { 742 745 struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
+1 -1
drivers/net/phy/marvell-88q2xxx.c
··· 698 698 699 699 switch (attr) { 700 700 case hwmon_temp_max: 701 - clamp_val(val, -75000, 180000); 701 + val = clamp(val, -75000, 180000); 702 702 val = (val / 1000) + 75; 703 703 val = FIELD_PREP(MDIO_MMD_PCS_MV_TEMP_SENSOR3_INT_THRESH_MASK, 704 704 val);
-4
drivers/net/phy/realtek/realtek_main.c
··· 691 691 692 692 static int rtl8211f_config_phy_eee(struct phy_device *phydev) 693 693 { 694 - /* RTL8211FVD has no PHYCR2 register */ 695 - if (phydev->drv->phy_id == RTL_8211FVD_PHYID) 696 - return 0; 697 - 698 694 /* Disable PHY-mode EEE so LPI is passed to the MAC */ 699 695 return phy_modify_paged(phydev, RTL8211F_PHYCR_PAGE, RTL8211F_PHYCR2, 700 696 RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
+2
drivers/net/phy/sfp.c
··· 497 497 SFP_QUIRK("ALCATELLUCENT", "3FE46541AA", sfp_quirk_2500basex, 498 498 sfp_fixup_nokia), 499 499 500 + SFP_QUIRK_F("BIDB", "X-ONU-SFPP", sfp_fixup_potron), 501 + 500 502 // FLYPRO SFP-10GT-CS-30M uses Rollball protocol to talk to the PHY. 501 503 SFP_QUIRK_F("FLYPRO", "SFP-10GT-CS-30M", sfp_fixup_rollball), 502 504
+1 -1
drivers/nfc/pn533/usb.c
··· 406 406 if (rc || (transferred != sizeof(cmd))) { 407 407 nfc_err(&phy->udev->dev, 408 408 "Reader power on cmd error %d\n", rc); 409 - return rc; 409 + return rc ?: -EINVAL; 410 410 } 411 411 412 412 rc = usb_submit_urb(phy->in_urb, GFP_KERNEL);
+3 -15
include/net/inet_frag.h
··· 123 123 124 124 int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f, struct net *net); 125 125 126 - static inline void fqdir_pre_exit(struct fqdir *fqdir) 127 - { 128 - /* Prevent creation of new frags. 129 - * Pairs with READ_ONCE() in inet_frag_find(). 130 - */ 131 - WRITE_ONCE(fqdir->high_thresh, 0); 132 - 133 - /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() 134 - * and ip6frag_expire_frag_queue(). 135 - */ 136 - WRITE_ONCE(fqdir->dead, true); 137 - } 126 + void fqdir_pre_exit(struct fqdir *fqdir); 138 127 void fqdir_exit(struct fqdir *fqdir); 139 128 140 129 void inet_frag_kill(struct inet_frag_queue *q, int *refs); 141 130 void inet_frag_destroy(struct inet_frag_queue *q); 142 131 struct inet_frag_queue *inet_frag_find(struct fqdir *fqdir, void *key); 143 132 144 - /* Free all skbs in the queue; return the sum of their truesizes. */ 145 - unsigned int inet_frag_rbtree_purge(struct rb_root *root, 146 - enum skb_drop_reason reason); 133 + void inet_frag_queue_flush(struct inet_frag_queue *q, 134 + enum skb_drop_reason reason); 147 135 148 136 static inline void inet_frag_putn(struct inet_frag_queue *q, int refs) 149 137 {
+6 -3
include/net/ipv6_frag.h
··· 69 69 int refs = 1; 70 70 71 71 rcu_read_lock(); 72 - /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ 73 - if (READ_ONCE(fq->q.fqdir->dead)) 74 - goto out_rcu_unlock; 75 72 spin_lock(&fq->q.lock); 76 73 77 74 if (fq->q.flags & INET_FRAG_COMPLETE) ··· 76 79 77 80 fq->q.flags |= INET_FRAG_DROP; 78 81 inet_frag_kill(&fq->q, &refs); 82 + 83 + /* Paired with the WRITE_ONCE() in fqdir_pre_exit(). */ 84 + if (READ_ONCE(fq->q.fqdir->dead)) { 85 + inet_frag_queue_flush(&fq->q, 0); 86 + goto out; 87 + } 79 88 80 89 dev = dev_get_by_index_rcu(net, fq->iif); 81 90 if (!dev)
+26 -8
include/net/netfilter/nf_tables.h
··· 1091 1091 __attribute__((aligned(__alignof__(struct nft_rule_dp)))); 1092 1092 }; 1093 1093 1094 + enum nft_chain_types { 1095 + NFT_CHAIN_T_DEFAULT = 0, 1096 + NFT_CHAIN_T_ROUTE, 1097 + NFT_CHAIN_T_NAT, 1098 + NFT_CHAIN_T_MAX 1099 + }; 1100 + 1101 + /** 1102 + * struct nft_chain_validate_state - validation state 1103 + * 1104 + * If a chain is encountered again during table validation it is 1105 + * possible to avoid revalidation provided the calling context is 1106 + * compatible. This structure stores relevant calling context of 1107 + * previous validations. 1108 + * 1109 + * @hook_mask: the hook numbers and locations the chain is linked to 1110 + * @depth: the deepest call chain level the chain is linked to 1111 + */ 1112 + struct nft_chain_validate_state { 1113 + u8 hook_mask[NFT_CHAIN_T_MAX]; 1114 + u8 depth; 1115 + }; 1116 + 1094 1117 /** 1095 1118 * struct nft_chain - nf_tables chain 1096 1119 * ··· 1132 1109 * @udlen: user data length 1133 1110 * @udata: user data in the chain 1134 1111 * @blob_next: rule blob pointer to the next in the chain 1112 + * @vstate: validation state 1135 1113 */ 1136 1114 struct nft_chain { 1137 1115 struct nft_rule_blob __rcu *blob_gen_0; ··· 1152 1128 1153 1129 /* Only used during control plane commit phase: */ 1154 1130 struct nft_rule_blob *blob_next; 1131 + struct nft_chain_validate_state vstate; 1155 1132 }; 1156 1133 1157 - int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain); 1134 + int nft_chain_validate(const struct nft_ctx *ctx, struct nft_chain *chain); 1158 1135 int nft_setelem_validate(const struct nft_ctx *ctx, struct nft_set *set, 1159 1136 const struct nft_set_iter *iter, 1160 1137 struct nft_elem_priv *elem_priv); 1161 1138 int nft_set_catchall_validate(const struct nft_ctx *ctx, struct nft_set *set); 1162 1139 int nf_tables_bind_chain(const struct nft_ctx *ctx, struct nft_chain *chain); 1163 1140 void nf_tables_unbind_chain(const struct nft_ctx *ctx, struct nft_chain *chain); 1164 - 1165 - enum nft_chain_types { 1166 - NFT_CHAIN_T_DEFAULT = 0, 1167 - NFT_CHAIN_T_ROUTE, 1168 - NFT_CHAIN_T_NAT, 1169 - NFT_CHAIN_T_MAX 1170 - }; 1171 1141 1172 1142 /** 1173 1143 * struct nft_chain_type - nf_tables chain type info
+1
include/uapi/linux/energy_model.h
··· 2 2 /* Do not edit directly, auto-generated from: */ 3 3 /* Documentation/netlink/specs/em.yaml */ 4 4 /* YNL-GEN uapi header */ 5 + /* To regenerate run: tools/net/ynl/ynl-regen.sh */ 5 6 6 7 #ifndef _UAPI_LINUX_ENERGY_MODEL_H 7 8 #define _UAPI_LINUX_ENERGY_MODEL_H
+1
include/uapi/linux/mptcp.h
··· 40 40 #define MPTCP_PM_ADDR_FLAG_FULLMESH _BITUL(3) 41 41 #define MPTCP_PM_ADDR_FLAG_IMPLICIT _BITUL(4) 42 42 #define MPTCP_PM_ADDR_FLAG_LAMINAR _BITUL(5) 43 + #define MPTCP_PM_ADDR_FLAGS_MASK GENMASK(5, 0) 43 44 44 45 struct mptcp_info { 45 46 __u8 mptcpi_subflows;
+8 -1
net/caif/cffrml.c
··· 92 92 len = le16_to_cpu(tmp); 93 93 94 94 /* Subtract for FCS on length if FCS is not used. */ 95 - if (!this->dofcs) 95 + if (!this->dofcs) { 96 + if (len < 2) { 97 + ++cffrml_rcv_error; 98 + pr_err("Invalid frame length (%d)\n", len); 99 + cfpkt_destroy(pkt); 100 + return -EPROTO; 101 + } 96 102 len -= 2; 103 + } 97 104 98 105 if (cfpkt_setlen(pkt, len) < 0) { 99 106 ++cffrml_rcv_error;
-1
net/can/Kconfig
··· 5 5 6 6 menuconfig CAN 7 7 tristate "CAN bus subsystem support" 8 - select CAN_DEV 9 8 help 10 9 Controller Area Network (CAN) is a slow (up to 1Mbit/s) serial 11 10 communications protocol. Development of the CAN bus started in
+6
net/can/j1939/socket.c
··· 482 482 goto out_release_sock; 483 483 } 484 484 485 + if (ndev->reg_state != NETREG_REGISTERED) { 486 + dev_put(ndev); 487 + ret = -ENODEV; 488 + goto out_release_sock; 489 + } 490 + 485 491 can_ml = can_get_ml_priv(ndev); 486 492 if (!can_ml) { 487 493 dev_put(ndev);
+2
net/can/j1939/transport.c
··· 1567 1567 if (active) { 1568 1568 j1939_session_put(active); 1569 1569 ret = -EAGAIN; 1570 + } else if (priv->ndev->reg_state != NETREG_REGISTERED) { 1571 + ret = -ENODEV; 1570 1572 } else { 1571 1573 WARN_ON_ONCE(session->state != J1939_SESSION_NEW); 1572 1574 list_add_tail(&session->active_session_list_entry,
+24 -6
net/ethtool/ioctl.c
··· 2383 2383 return -ENOMEM; 2384 2384 WARN_ON_ONCE(!ret); 2385 2385 2386 - gstrings.len = ret; 2386 + if (gstrings.len && gstrings.len != ret) 2387 + gstrings.len = 0; 2388 + else 2389 + gstrings.len = ret; 2387 2390 2388 2391 if (gstrings.len) { 2389 2392 data = vzalloc(array_size(gstrings.len, ETH_GSTRING_LEN)); ··· 2512 2509 if (copy_from_user(&stats, useraddr, sizeof(stats))) 2513 2510 return -EFAULT; 2514 2511 2515 - stats.n_stats = n_stats; 2512 + if (stats.n_stats && stats.n_stats != n_stats) 2513 + stats.n_stats = 0; 2514 + else 2515 + stats.n_stats = n_stats; 2516 2516 2517 - if (n_stats) { 2518 - data = vzalloc(array_size(n_stats, sizeof(u64))); 2517 + if (stats.n_stats) { 2518 + data = vzalloc(array_size(stats.n_stats, sizeof(u64))); 2519 2519 if (!data) 2520 2520 return -ENOMEM; 2521 2521 ops->get_ethtool_stats(dev, &stats, data); ··· 2530 2524 if (copy_to_user(useraddr, &stats, sizeof(stats))) 2531 2525 goto out; 2532 2526 useraddr += sizeof(stats); 2533 - if (n_stats && copy_to_user(useraddr, data, array_size(n_stats, sizeof(u64)))) 2527 + if (stats.n_stats && 2528 + copy_to_user(useraddr, data, 2529 + array_size(stats.n_stats, sizeof(u64)))) 2534 2530 goto out; 2535 2531 ret = 0; 2536 2532 ··· 2568 2560 return -EOPNOTSUPP; 2569 2561 2570 2562 n_stats = phy_ops->get_sset_count(phydev); 2563 + if (stats->n_stats && stats->n_stats != n_stats) { 2564 + stats->n_stats = 0; 2565 + return 0; 2566 + } 2571 2567 2572 2568 ret = ethtool_vzalloc_stats_array(n_stats, data); 2573 2569 if (ret) ··· 2592 2580 return -EOPNOTSUPP; 2593 2581 2594 2582 n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS); 2583 + if (stats->n_stats && stats->n_stats != n_stats) { 2584 + stats->n_stats = 0; 2585 + return 0; 2586 + } 2595 2587 2596 2588 ret = ethtool_vzalloc_stats_array(n_stats, data); 2597 2589 if (ret) ··· 2632 2616 } 2633 2617 2634 2618 useraddr += sizeof(stats); 2635 - if (copy_to_user(useraddr, data, array_size(stats.n_stats, sizeof(u64)))) 2619 + if (stats.n_stats && 2620 + copy_to_user(useraddr, data, 2621 + array_size(stats.n_stats, sizeof(u64)))) 2636 2622 ret = -EFAULT; 2637 2623 2638 2624 out:
+7 -1
net/handshake/request.c
··· 276 276 out_unlock: 277 277 spin_unlock(&hn->hn_lock); 278 278 out_err: 279 + /* Restore original destructor so socket teardown still runs on failure */ 280 + req->hr_sk->sk_destruct = req->hr_odestruct; 279 281 trace_handshake_submit_err(net, req, req->hr_sk, ret); 280 282 handshake_req_destroy(req); 281 283 return ret; ··· 326 324 327 325 hn = handshake_pernet(net); 328 326 if (hn && remove_pending(hn, req)) { 329 - /* Request hadn't been accepted */ 327 + /* Request hadn't been accepted - mark cancelled */ 328 + if (test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED, &req->hr_flags)) { 329 + trace_handshake_cancel_busy(net, req, sk); 330 + return false; 331 + } 330 332 goto out_true; 331 333 } 332 334 if (test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED, &req->hr_flags)) {
+2
net/hsr/hsr_forward.c
··· 205 205 __pskb_copy(frame->skb_prp, 206 206 skb_headroom(frame->skb_prp), 207 207 GFP_ATOMIC); 208 + if (!frame->skb_std) 209 + return NULL; 208 210 } else { 209 211 /* Unexpected */ 210 212 WARN_ONCE(1, "%s:%d: Unexpected frame received (port_src %s)\n",
+51 -4
net/ipv4/inet_fragment.c
··· 218 218 219 219 pure_initcall(inet_frag_wq_init); 220 220 221 + void fqdir_pre_exit(struct fqdir *fqdir) 222 + { 223 + struct inet_frag_queue *fq; 224 + struct rhashtable_iter hti; 225 + 226 + /* Prevent creation of new frags. 227 + * Pairs with READ_ONCE() in inet_frag_find(). 228 + */ 229 + WRITE_ONCE(fqdir->high_thresh, 0); 230 + 231 + /* Pairs with READ_ONCE() in inet_frag_kill(), ip_expire() 232 + * and ip6frag_expire_frag_queue(). 233 + */ 234 + WRITE_ONCE(fqdir->dead, true); 235 + 236 + rhashtable_walk_enter(&fqdir->rhashtable, &hti); 237 + rhashtable_walk_start(&hti); 238 + 239 + while ((fq = rhashtable_walk_next(&hti))) { 240 + if (IS_ERR(fq)) { 241 + if (PTR_ERR(fq) != -EAGAIN) 242 + break; 243 + continue; 244 + } 245 + spin_lock_bh(&fq->lock); 246 + if (!(fq->flags & INET_FRAG_COMPLETE)) 247 + inet_frag_queue_flush(fq, 0); 248 + spin_unlock_bh(&fq->lock); 249 + } 250 + 251 + rhashtable_walk_stop(&hti); 252 + rhashtable_walk_exit(&hti); 253 + } 254 + EXPORT_SYMBOL(fqdir_pre_exit); 255 + 221 256 void fqdir_exit(struct fqdir *fqdir) 222 257 { 223 258 INIT_WORK(&fqdir->destroy_work, fqdir_work_fn); ··· 298 263 kmem_cache_free(f->frags_cachep, q); 299 264 } 300 265 301 - unsigned int inet_frag_rbtree_purge(struct rb_root *root, 302 - enum skb_drop_reason reason) 266 + static unsigned int 267 + inet_frag_rbtree_purge(struct rb_root *root, enum skb_drop_reason reason) 303 268 { 304 269 struct rb_node *p = rb_first(root); 305 270 unsigned int sum = 0; ··· 319 284 } 320 285 return sum; 321 286 } 322 - EXPORT_SYMBOL(inet_frag_rbtree_purge); 287 + 288 + void inet_frag_queue_flush(struct inet_frag_queue *q, 289 + enum skb_drop_reason reason) 290 + { 291 + unsigned int sum; 292 + 293 + reason = reason ?: SKB_DROP_REASON_FRAG_REASM_TIMEOUT; 294 + sum = inet_frag_rbtree_purge(&q->rb_fragments, reason); 295 + sub_frag_mem_limit(q->fqdir, sum); 296 + } 297 + EXPORT_SYMBOL(inet_frag_queue_flush); 323 298 324 299 void inet_frag_destroy(struct inet_frag_queue *q) 325 300 { ··· 372 327 373 328 timer_setup(&q->timer, f->frag_expire, 0); 374 329 spin_lock_init(&q->lock); 375 - /* One reference for the timer, one for the hash table. */ 330 + /* One reference for the timer, one for the hash table. 331 + * We never take any extra references, only decrement this field. 332 + */ 376 333 refcount_set(&q->refcnt, 2); 377 334 378 335 return q;
+9 -13
net/ipv4/ip_fragment.c
··· 134 134 net = qp->q.fqdir->net; 135 135 136 136 rcu_read_lock(); 137 - 138 - /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ 139 - if (READ_ONCE(qp->q.fqdir->dead)) 140 - goto out_rcu_unlock; 141 - 142 137 spin_lock(&qp->q.lock); 143 138 144 139 if (qp->q.flags & INET_FRAG_COMPLETE) ··· 141 146 142 147 qp->q.flags |= INET_FRAG_DROP; 143 148 inet_frag_kill(&qp->q, &refs); 149 + 150 + /* Paired with WRITE_ONCE() in fqdir_pre_exit(). */ 151 + if (READ_ONCE(qp->q.fqdir->dead)) { 152 + inet_frag_queue_flush(&qp->q, 0); 153 + goto out; 154 + } 155 + 144 156 __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS); 145 157 __IP_INC_STATS(net, IPSTATS_MIB_REASMTIMEOUT); 146 158 ··· 242 240 243 241 static int ip_frag_reinit(struct ipq *qp) 244 242 { 245 - unsigned int sum_truesize = 0; 246 - 247 - if (!mod_timer(&qp->q.timer, jiffies + qp->q.fqdir->timeout)) { 248 - refcount_inc(&qp->q.refcnt); 243 + if (!mod_timer_pending(&qp->q.timer, jiffies + qp->q.fqdir->timeout)) 249 244 return -ETIMEDOUT; 250 - } 251 245 252 - sum_truesize = inet_frag_rbtree_purge(&qp->q.rb_fragments, 253 - SKB_DROP_REASON_FRAG_TOO_FAR); 254 - sub_frag_mem_limit(qp->q.fqdir, sum_truesize); 246 + inet_frag_queue_flush(&qp->q, SKB_DROP_REASON_FRAG_TOO_FAR); 255 247 256 248 qp->q.flags = 0; 257 249 qp->q.len = 0;
+1 -1
net/mptcp/Kconfig
··· 4 4 depends on INET 5 5 select SKB_EXTENSIONS 6 6 select CRYPTO_LIB_SHA256 7 - select CRYPTO 7 + select CRYPTO_LIB_UTILS 8 8 help 9 9 Multipath TCP (MPTCP) connections send and receive data over multiple 10 10 subflows in order to utilize multiple network paths. Each subflow
+2 -1
net/mptcp/pm_netlink.c
··· 119 119 } 120 120 121 121 if (tb[MPTCP_PM_ADDR_ATTR_FLAGS]) 122 - entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]); 122 + entry->flags = nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]) & 123 + MPTCP_PM_ADDR_FLAGS_MASK; 123 124 124 125 if (tb[MPTCP_PM_ADDR_ATTR_PORT]) 125 126 entry->addr.port = htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT]));
+14 -8
net/mptcp/protocol.c
··· 1623 1623 struct mptcp_sendmsg_info info = { 1624 1624 .flags = flags, 1625 1625 }; 1626 - bool do_check_data_fin = false; 1626 + bool copied = false; 1627 1627 int push_count = 1; 1628 1628 1629 1629 while (mptcp_send_head(sk) && (push_count > 0)) { ··· 1665 1665 push_count--; 1666 1666 continue; 1667 1667 } 1668 - do_check_data_fin = true; 1668 + copied = true; 1669 1669 } 1670 1670 } 1671 1671 } ··· 1674 1674 if (ssk) 1675 1675 mptcp_push_release(ssk, &info); 1676 1676 1677 - /* ensure the rtx timer is running */ 1678 - if (!mptcp_rtx_timer_pending(sk)) 1679 - mptcp_reset_rtx_timer(sk); 1680 - if (do_check_data_fin) 1677 + /* Avoid scheduling the rtx timer if no data has been pushed; the timer 1678 + * will be updated on positive acks by __mptcp_cleanup_una(). 1679 + */ 1680 + if (copied) { 1681 + if (!mptcp_rtx_timer_pending(sk)) 1682 + mptcp_reset_rtx_timer(sk); 1681 1683 mptcp_check_send_data_fin(sk); 1684 + } 1682 1685 } 1683 1686 1684 1687 static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) ··· 2769 2766 2770 2767 /* 2771 2768 * make the whole retrans decision, xmit, disallow 2772 - * fallback atomic 2769 + * fallback atomic, note that we can't retrans even 2770 + * when an infinite fallback is in progress, i.e. new 2771 + * subflows are disallowed. 2773 2772 */ 2774 2773 spin_lock_bh(&msk->fallback_lock); 2775 - if (__mptcp_check_fallback(msk)) { 2774 + if (__mptcp_check_fallback(msk) || 2775 + !msk->allow_subflows) { 2776 2776 spin_unlock_bh(&msk->fallback_lock); 2777 2777 release_sock(ssk); 2778 2778 goto clear_scheduled;
+3
net/netfilter/ipvs/ip_vs_xmit.c
··· 408 408 return -1; 409 409 410 410 err_unreach: 411 + if (!skb->dev) 412 + skb->dev = skb_dst(skb)->dev; 413 + 411 414 dst_link_failure(skb); 412 415 return -1; 413 416 }
+14 -11
net/netfilter/nf_conncount.c
··· 172 172 struct nf_conn *found_ct; 173 173 unsigned int collect = 0; 174 174 bool refcounted = false; 175 + int err = 0; 175 176 176 177 if (!get_ct_or_tuple_from_skb(net, skb, l3num, &ct, &tuple, &zone, &refcounted)) 177 178 return -ENOENT; 178 179 179 180 if (ct && nf_ct_is_confirmed(ct)) { 180 - if (refcounted) 181 - nf_ct_put(ct); 182 - return -EEXIST; 181 + err = -EEXIST; 182 + goto out_put; 183 183 } 184 184 185 185 if ((u32)jiffies == list->last_gc) ··· 231 231 } 232 232 233 233 add_new_node: 234 - if (WARN_ON_ONCE(list->count > INT_MAX)) 235 - return -EOVERFLOW; 234 + if (WARN_ON_ONCE(list->count > INT_MAX)) { 235 + err = -EOVERFLOW; 236 + goto out_put; 237 + } 236 238 237 239 conn = kmem_cache_alloc(conncount_conn_cachep, GFP_ATOMIC); 238 - if (conn == NULL) 239 - return -ENOMEM; 240 + if (conn == NULL) { 241 + err = -ENOMEM; 242 + goto out_put; 243 + } 240 244 241 245 conn->tuple = tuple; 242 246 conn->zone = *zone; ··· 253 249 out_put: 254 250 if (refcounted) 255 251 nf_ct_put(ct); 256 - return 0; 252 + return err; 257 253 } 258 254 259 255 int nf_conncount_add_skb(struct net *net, ··· 460 456 461 457 rb_link_node_rcu(&rbconn->node, parent, rbnode); 462 458 rb_insert_color(&rbconn->node, root); 463 - 464 - if (refcounted) 465 - nf_ct_put(ct); 466 459 } 467 460 out_unlock: 461 + if (refcounted) 462 + nf_ct_put(ct); 468 463 spin_unlock_bh(&nf_conncount_locks[hash]); 469 464 return count; 470 465 }
+3
net/netfilter/nf_conntrack_core.c
··· 2487 2487 void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list) 2488 2488 { 2489 2489 struct nf_ct_iter_data iter_data = {}; 2490 + unsigned long start = jiffies; 2490 2491 struct net *net; 2491 2492 int busy; 2492 2493 ··· 2508 2507 busy = 1; 2509 2508 } 2510 2509 if (busy) { 2510 + DEBUG_NET_WARN_ONCE(time_after(jiffies, start + 60 * HZ), 2511 + "conntrack cleanup blocked for 60s"); 2511 2512 schedule(); 2512 2513 goto i_see_dead_people; 2513 2514 }
+3 -1
net/netfilter/nf_flow_table_path.c
··· 250 250 if (nft_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) >= 0) 251 251 nft_dev_path_info(&stack, &info, ha, &ft->data); 252 252 253 + if (info.outdev) 254 + route->tuple[dir].out.ifindex = info.outdev->ifindex; 255 + 253 256 if (!info.indev || !nft_flowtable_find_dev(info.indev, ft)) 254 257 return; 255 258 ··· 272 269 273 270 route->tuple[!dir].in.num_encaps = info.num_encaps; 274 271 route->tuple[!dir].in.ingress_vlans = info.ingress_vlans; 275 - route->tuple[dir].out.ifindex = info.outdev->ifindex; 276 272 277 273 if (info.xmit_type == FLOW_OFFLOAD_XMIT_DIRECT) { 278 274 memcpy(route->tuple[dir].out.h_source, info.h_source, ETH_ALEN);
+1 -13
net/netfilter/nf_nat_core.c
··· 294 294 295 295 ct = nf_ct_tuplehash_to_ctrack(thash); 296 296 297 - /* NB: IP_CT_DIR_ORIGINAL should be impossible because 298 - * nf_nat_used_tuple() handles origin collisions. 299 - * 300 - * Handle remote chance other CPU confirmed its ct right after. 301 - */ 302 - if (thash->tuple.dst.dir != IP_CT_DIR_REPLY) 303 - goto out; 304 - 305 297 /* clashing connection subject to NAT? Retry with new tuple. */ 306 298 if (READ_ONCE(ct->status) & uses_nat) 307 299 goto out; 308 300 309 301 if (nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 310 - &ignored_ct->tuplehash[IP_CT_DIR_REPLY].tuple) && 311 - nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_REPLY].tuple, 312 - &ignored_ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple)) { 302 + &ignored_ct->tuplehash[IP_CT_DIR_REPLY].tuple)) 313 303 taken = false; 314 - goto out; 315 - } 316 304 out: 317 305 nf_ct_put(ct); 318 306 return taken;
+67 -17
net/netfilter/nf_tables_api.c
··· 123 123 124 124 table->validate_state = new_validate_state; 125 125 } 126 + 127 + static bool nft_chain_vstate_valid(const struct nft_ctx *ctx, 128 + const struct nft_chain *chain) 129 + { 130 + const struct nft_base_chain *base_chain; 131 + enum nft_chain_types type; 132 + u8 hooknum; 133 + 134 + if (WARN_ON_ONCE(!nft_is_base_chain(ctx->chain))) 135 + return false; 136 + 137 + base_chain = nft_base_chain(ctx->chain); 138 + hooknum = base_chain->ops.hooknum; 139 + type = base_chain->type->type; 140 + 141 + /* chain is already validated for this call depth */ 142 + if (chain->vstate.depth >= ctx->level && 143 + chain->vstate.hook_mask[type] & BIT(hooknum)) 144 + return true; 145 + 146 + return false; 147 + } 148 + 126 149 static void nf_tables_trans_destroy_work(struct work_struct *w); 127 150 128 151 static void nft_trans_gc_work(struct work_struct *work); ··· 4102 4079 nf_tables_rule_destroy(ctx, rule); 4103 4080 } 4104 4081 4082 + static void nft_chain_vstate_update(const struct nft_ctx *ctx, struct nft_chain *chain) 4083 + { 4084 + const struct nft_base_chain *base_chain; 4085 + enum nft_chain_types type; 4086 + u8 hooknum; 4087 + 4088 + /* ctx->chain must hold the calling base chain. */ 4089 + if (WARN_ON_ONCE(!nft_is_base_chain(ctx->chain))) { 4090 + memset(&chain->vstate, 0, sizeof(chain->vstate)); 4091 + return; 4092 + } 4093 + 4094 + base_chain = nft_base_chain(ctx->chain); 4095 + hooknum = base_chain->ops.hooknum; 4096 + type = base_chain->type->type; 4097 + 4098 + BUILD_BUG_ON(BIT(NF_INET_NUMHOOKS) > U8_MAX); 4099 + 4100 + chain->vstate.hook_mask[type] |= BIT(hooknum); 4101 + if (chain->vstate.depth < ctx->level) 4102 + chain->vstate.depth = ctx->level; 4103 + } 4104 + 4105 4105 /** nft_chain_validate - loop detection and hook validation 4106 4106 * 4107 4107 * @ctx: context containing call depth and base chain ··· 4134 4088 * and set lookups until either the jump limit is hit or all reachable 4135 4089 * chains have been validated. 4136 4090 */ 4137 - int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) 4091 + int nft_chain_validate(const struct nft_ctx *ctx, struct nft_chain *chain) 4138 4092 { 4139 4093 struct nft_expr *expr, *last; 4140 4094 struct nft_rule *rule; 4141 4095 int err; 4142 4096 4097 + BUILD_BUG_ON(NFT_JUMP_STACK_SIZE > 255); 4143 4098 if (ctx->level == NFT_JUMP_STACK_SIZE) 4144 4099 return -EMLINK; 4100 + 4101 + if (ctx->level > 0) { 4102 + /* jumps to base chains are not allowed. */ 4103 + if (nft_is_base_chain(chain)) 4104 + return -ELOOP; 4105 + 4106 + if (nft_chain_vstate_valid(ctx, chain)) 4107 + return 0; 4108 + } 4145 4109 4146 4110 list_for_each_entry(rule, &chain->rules, list) { 4147 4111 if (fatal_signal_pending(current)) ··· 4171 4115 if (err < 0) 4172 4116 return err; 4173 4117 } 4118 + 4119 + cond_resched(); 4174 4120 } 4175 4121 4122 + nft_chain_vstate_update(ctx, chain); 4176 4123 return 0; 4177 4124 } 4178 4125 EXPORT_SYMBOL_GPL(nft_chain_validate); ··· 4187 4128 .net = net, 4188 4129 .family = table->family, 4189 4130 }; 4190 - int err; 4131 + int err = 0; 4191 4132 4192 4133 list_for_each_entry(chain, &table->chains, list) { 4193 4134 if (!nft_is_base_chain(chain)) ··· 4196 4137 ctx.chain = chain; 4197 4138 err = nft_chain_validate(&ctx, chain); 4198 4139 if (err < 0) 4199 - return err; 4200 - 4201 - cond_resched(); 4140 + goto err; 4202 4141 } 4203 4142 4204 - return 0; 4143 + err: 4144 + list_for_each_entry(chain, &table->chains, list) 4145 + memset(&chain->vstate, 0, sizeof(chain->vstate)); 4146 + 4147 + return err; 4205 4148 } 4206 4149 4207 4150 int nft_setelem_validate(const struct nft_ctx *ctx, struct nft_set *set, ··· 11737 11676 enum nft_data_types type, 11738 11677 unsigned int len) 11739 11678 { 11740 - int err; 11741 - 11742 11679 switch (reg) { 11743 11680 case NFT_REG_VERDICT: 11744 11681 if (type != NFT_DATA_VERDICT) 11745 11682 return -EINVAL; 11746 - 11747 - if (data != NULL && 11748 - (data->verdict.code == NFT_GOTO || 11749 - data->verdict.code == NFT_JUMP)) { 11750 - err = nft_chain_validate(ctx, data->verdict.chain); 11751 - if (err < 0) 11752 - return err; 11753 - } 11754 - 11755 11683 break; 11756 11684 default: 11757 11685 if (type != NFT_DATA_VALUE)
+3 -1
net/netrom/nr_out.c
··· 43 43 frontlen = skb_headroom(skb); 44 44 45 45 while (skb->len > 0) { 46 - if ((skbn = sock_alloc_send_skb(sk, frontlen + NR_MAX_PACKET_SIZE, 0, &err)) == NULL) 46 + if ((skbn = sock_alloc_send_skb(sk, frontlen + NR_MAX_PACKET_SIZE, 0, &err)) == NULL) { 47 + kfree_skb(skb); 47 48 return; 49 + } 48 50 49 51 skb_reserve(skbn, frontlen); 50 52
+10 -3
net/openvswitch/flow_netlink.c
··· 2802 2802 return err; 2803 2803 } 2804 2804 2805 - static bool validate_push_nsh(const struct nlattr *attr, bool log) 2805 + static bool validate_push_nsh(const struct nlattr *a, bool log) 2806 2806 { 2807 + struct nlattr *nsh_key = nla_data(a); 2807 2808 struct sw_flow_match match; 2808 2809 struct sw_flow_key key; 2809 2810 2811 + /* There must be one and only one NSH header. */ 2812 + if (!nla_ok(nsh_key, nla_len(a)) || 2813 + nla_total_size(nla_len(nsh_key)) != nla_len(a) || 2814 + nla_type(nsh_key) != OVS_KEY_ATTR_NSH) 2815 + return false; 2816 + 2810 2817 ovs_match_init(&match, &key, true, NULL); 2811 - return !nsh_key_put_from_nlattr(attr, &match, false, true, log); 2818 + return !nsh_key_put_from_nlattr(nsh_key, &match, false, true, log); 2812 2819 } 2813 2820 2814 2821 /* Return false if there are any non-masked bits set. ··· 3396 3389 return -EINVAL; 3397 3390 } 3398 3391 mac_proto = MAC_PROTO_NONE; 3399 - if (!validate_push_nsh(nla_data(a), log)) 3392 + if (!validate_push_nsh(a, log)) 3400 3393 return -EINVAL; 3401 3394 break; 3402 3395
+9
net/sched/act_mirred.c
··· 281 281 282 282 want_ingress = tcf_mirred_act_wants_ingress(m_eaction); 283 283 284 + if (dev == skb->dev && want_ingress == at_ingress) { 285 + pr_notice_once("tc mirred: Loop (%s:%s --> %s:%s)\n", 286 + netdev_name(skb->dev), 287 + at_ingress ? "ingress" : "egress", 288 + netdev_name(dev), 289 + want_ingress ? "ingress" : "egress"); 290 + goto err_cant_do; 291 + } 292 + 284 293 /* All mirred/redirected skbs should clear previous ct info */ 285 294 nf_reset_ct(skb_to_send); 286 295 if (want_ingress && !at_ingress) /* drop dst for egress -> ingress */
+5 -1
net/sched/sch_ets.c
··· 652 652 sch_tree_lock(sch); 653 653 654 654 for (i = nbands; i < oldbands; i++) { 655 - if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) 655 + if (cl_is_active(&q->classes[i])) 656 656 list_del_init(&q->classes[i].alist); 657 657 qdisc_purge_queue(q->classes[i].qdisc); 658 658 } ··· 663 663 list_add_tail(&q->classes[i].alist, &q->active); 664 664 q->classes[i].deficit = quanta[i]; 665 665 } 666 + } 667 + for (i = q->nstrict; i < nstrict; i++) { 668 + if (cl_is_active(&q->classes[i])) 669 + list_del_init(&q->classes[i].alist); 666 670 } 667 671 WRITE_ONCE(q->nstrict, nstrict); 668 672 memcpy(q->prio2band, priomap, sizeof(priomap));
+2
net/sctp/ipv6.c
··· 492 492 struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 493 493 struct ipv6_txoptions *opt; 494 494 495 + inet_sk(newsk)->inet_opt = NULL; 496 + 495 497 newnp = inet6_sk(newsk); 496 498 497 499 rcu_read_lock();
+4 -3
net/sctp/socket.c
··· 4863 4863 4864 4864 newsp->pf->to_sk_daddr(&asoc->peer.primary_addr, newsk); 4865 4865 newinet->inet_dport = htons(asoc->peer.port); 4866 - 4867 - newsp->pf->copy_ip_options(sk, newsk); 4868 4866 atomic_set(&newinet->inet_id, get_random_u16()); 4869 4867 4870 4868 inet_set_bit(MC_LOOP, newsk); ··· 4872 4874 4873 4875 #if IS_ENABLED(CONFIG_IPV6) 4874 4876 if (sk->sk_family == AF_INET6) { 4875 - struct ipv6_pinfo *newnp = inet6_sk(newsk); 4877 + struct ipv6_pinfo *newnp; 4876 4878 4877 4879 newinet->pinet6 = &((struct sctp6_sock *)newsk)->inet6; 4878 4880 newinet->ipv6_fl_list = NULL; 4879 4881 4882 + newnp = inet6_sk(newsk); 4880 4883 memcpy(newnp, inet6_sk(sk), sizeof(struct ipv6_pinfo)); 4881 4884 newnp->ipv6_mc_list = NULL; 4882 4885 newnp->ipv6_ac_list = NULL; 4883 4886 } 4884 4887 #endif 4888 + 4889 + newsp->pf->copy_ip_options(sk, newsk); 4885 4890 4886 4891 newsp->do_auto_asconf = 0; 4887 4892 skb_queue_head_init(&newsp->pd_lobby);
+1 -1
net/unix/garbage.c
··· 199 199 } 200 200 } 201 201 202 - static DEFINE_SPINLOCK(unix_gc_lock); 202 + static __cacheline_aligned_in_smp DEFINE_SPINLOCK(unix_gc_lock); 203 203 204 204 void unix_add_edges(struct scm_fp_list *fpl, struct unix_sock *receiver) 205 205 {
+2
tools/net/ynl/Makefile.deps
··· 13 13 # need the explicit -D matching what's in /usr, to avoid multiple definitions. 14 14 15 15 get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2) 16 + get_hdr_inc2=-D$(1) -D$(2) -include $(UAPI_PATH)/linux/$(3) 16 17 17 18 CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h) 18 19 CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h) ··· 49 48 $(call get_hdr_inc,_TC_SKBEDIT_H,tc_act/tc_skbedit.h) \ 50 49 $(call get_hdr_inc,_TC_TUNNEL_KEY_H,tc_act/tc_tunnel_key.h) 51 50 CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h) 51 + CFLAGS_wireguard:=$(call get_hdr_inc2,_LINUX_WIREGUARD_H,_WG_UAPI_WIREGUARD_H,wireguard.h)
+6 -1
tools/testing/selftests/net/af_unix/Makefile
··· 1 - CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end 1 + top_srcdir := ../../../../.. 2 + include $(top_srcdir)/scripts/Makefile.compiler 3 + 4 + cc-option = $(call __cc-option, $(CC),,$(1),$(2)) 5 + 6 + CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end) 2 7 3 8 TEST_GEN_PROGS := \ 4 9 diag_uid \
+1
tools/testing/selftests/net/forwarding/config
··· 29 29 CONFIG_NET_CLS_BASIC=m 30 30 CONFIG_NET_CLS_FLOWER=m 31 31 CONFIG_NET_CLS_MATCHALL=m 32 + CONFIG_NET_CLS_U32=m 32 33 CONFIG_NET_EMATCH=y 33 34 CONFIG_NET_EMATCH_META=m 34 35 CONFIG_NETFILTER=y
+31 -45
tools/testing/selftests/net/forwarding/vxlan_bridge_1q_mc_ul.sh
··· 138 138 defer tc qdisc del dev "$dev" clsact 139 139 140 140 tc filter add dev "$dev" ingress proto ip pref 104 \ 141 - flower skip_hw ip_proto udp dst_port "$VXPORT" \ 142 - action pass 141 + u32 match ip protocol 0x11 0xff \ 142 + match u16 "$VXPORT" 0xffff at 0x16 \ 143 + match u16 0x0800 0xffff at 0x30 \ 144 + action pass 143 145 defer tc filter del dev "$dev" ingress proto ip pref 104 144 146 145 147 tc filter add dev "$dev" ingress proto ipv6 pref 106 \ 146 - flower skip_hw ip_proto udp dst_port "$VXPORT" \ 147 - action pass 148 + u32 match ip6 protocol 0x11 0xff \ 149 + match u16 "$VXPORT" 0xffff at 0x2a \ 150 + match u16 0x86dd 0xffff at 0x44 \ 151 + match u8 0x11 0xff at 0x4c \ 152 + action pass 148 153 defer tc filter del dev "$dev" ingress proto ipv6 pref 106 149 154 } 150 155 ··· 253 248 } 254 249 export -f vx_create 255 250 256 - vx_wait() 257 - { 258 - # Wait for all the ARP, IGMP etc. noise to settle down so that the 259 - # tunnel is clear for measurements. 260 - sleep 10 261 - } 262 - 263 251 vx10_create() 264 252 { 265 253 vx_create vx10 10 id 1000 "$@" ··· 264 266 vx_create vx20 20 id 2000 "$@" 265 267 } 266 268 export -f vx20_create 267 - 268 - vx10_create_wait() 269 - { 270 - vx10_create "$@" 271 - vx_wait 272 - } 273 - 274 - vx20_create_wait() 275 - { 276 - vx20_create "$@" 277 - vx_wait 278 - } 279 269 280 270 ns_init_common() 281 271 { ··· 540 554 # Install a misleading (S,G) rule to attempt to trick the system into 541 555 # pushing the packets elsewhere. 542 556 adf_install_broken_sg 543 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$swp2" 557 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$swp2" 544 558 do_test 4 10 0 "IPv4 nomcroute" 545 559 } 546 560 ··· 548 562 { 549 563 # Like for IPv4, install a misleading (S,G). 550 564 adf_install_broken_sg 551 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$swp2" 565 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$swp2" 552 566 do_test 6 10 0 "IPv6 nomcroute" 553 567 } 554 568 ··· 567 581 ipv4_mcroute() 568 582 { 569 583 adf_install_sg 570 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 584 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 571 585 do_test 4 10 10 "IPv4 mcroute" 572 586 } 573 587 574 588 ipv6_mcroute() 575 589 { 576 590 adf_install_sg 577 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 591 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 578 592 do_test 6 10 10 "IPv6 mcroute" 579 593 } 580 594 581 595 ipv4_mcroute_rx() 582 596 { 583 597 adf_install_sg 584 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 598 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 585 599 ipv4_do_test_rx 0 "IPv4 mcroute ping" 586 600 } 587 601 588 602 ipv6_mcroute_rx() 589 603 { 590 604 adf_install_sg 591 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 605 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 592 606 ipv6_do_test_rx 0 "IPv6 mcroute ping" 593 607 } 594 608 595 609 ipv4_mcroute_changelink() 596 610 { 597 611 adf_install_sg 598 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" 612 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" 599 613 ip link set dev vx10 type vxlan mcroute 600 614 sleep 1 601 615 do_test 4 10 10 "IPv4 mcroute changelink" ··· 604 618 ipv6_mcroute_changelink() 605 619 { 606 620 adf_install_sg 607 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 621 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 608 622 ip link set dev vx20 type vxlan mcroute 609 623 sleep 1 610 624 do_test 6 10 10 "IPv6 mcroute changelink" ··· 613 627 ipv4_mcroute_starg() 614 628 { 615 629 adf_install_starg 616 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 630 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 617 631 do_test 4 10 10 "IPv4 mcroute (*,G)" 618 632 } 619 633 620 634 ipv6_mcroute_starg() 621 635 { 622 636 adf_install_starg 623 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 637 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 624 638 do_test 6 10 10 "IPv6 mcroute (*,G)" 625 639 } 626 640 627 641 ipv4_mcroute_starg_rx() 628 642 { 629 643 adf_install_starg 630 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 644 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 631 645 ipv4_do_test_rx 0 "IPv4 mcroute (*,G) ping" 632 646 } 633 647 634 648 ipv6_mcroute_starg_rx() 635 649 { 636 650 adf_install_starg 637 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 651 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 638 652 ipv6_do_test_rx 0 "IPv6 mcroute (*,G) ping" 639 653 } 640 654 641 655 ipv4_mcroute_noroute() 642 656 { 643 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 657 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 644 658 do_test 4 0 0 "IPv4 mcroute, no route" 645 659 } 646 660 647 661 ipv6_mcroute_noroute() 648 662 { 649 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 663 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 650 664 do_test 6 0 0 "IPv6 mcroute, no route" 651 665 } 652 666 653 667 ipv4_mcroute_fdb() 654 668 { 655 669 adf_install_sg 656 - vx10_create_wait local 192.0.2.100 dev "$IPMR" mcroute 670 + vx10_create local 192.0.2.100 dev "$IPMR" mcroute 657 671 bridge fdb add dev vx10 \ 658 672 00:00:00:00:00:00 self static dst "$GROUP4" via "$IPMR" 659 673 do_test 4 10 10 "IPv4 mcroute FDB" ··· 662 676 ipv6_mcroute_fdb() 663 677 { 664 678 adf_install_sg 665 - vx20_create_wait local 2001:db8:4::1 dev "$IPMR" mcroute 679 + vx20_create local 2001:db8:4::1 dev "$IPMR" mcroute 666 680 bridge -6 fdb add dev vx20 \ 667 681 00:00:00:00:00:00 self static dst "$GROUP6" via "$IPMR" 668 682 do_test 6 10 10 "IPv6 mcroute FDB" ··· 672 686 ipv4_mcroute_fdb_oif0() 673 687 { 674 688 adf_install_sg 675 - vx10_create_wait local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 689 + vx10_create local 192.0.2.100 group "$GROUP4" dev "$IPMR" mcroute 676 690 bridge fdb del dev vx10 00:00:00:00:00:00 677 691 bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4" 678 692 do_test 4 10 10 "IPv4 mcroute oif=0" ··· 689 703 defer ip -6 route del table local multicast "$GROUP6/128" dev "$IPMR" 690 704 691 705 adf_install_sg 692 - vx20_create_wait local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 706 + vx20_create local 2001:db8:4::1 group "$GROUP6" dev "$IPMR" mcroute 693 707 bridge -6 fdb del dev vx20 00:00:00:00:00:00 694 708 bridge -6 fdb add dev vx20 00:00:00:00:00:00 self static dst "$GROUP6" 695 709 do_test 6 10 10 "IPv6 mcroute oif=0" ··· 702 716 adf_install_sg_sep 703 717 704 718 adf_ip_addr_add lo 192.0.2.120/28 705 - vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 719 + vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 706 720 bridge fdb del dev vx10 00:00:00:00:00:00 707 721 bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4" 708 722 do_test 4 10 10 "IPv4 mcroute TX!=RX oif=0" ··· 713 727 adf_install_sg_sep_rx lo 714 728 715 729 adf_ip_addr_add lo 192.0.2.120/28 716 - vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 730 + vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 717 731 bridge fdb del dev vx10 00:00:00:00:00:00 718 732 bridge fdb add dev vx10 00:00:00:00:00:00 self static dst "$GROUP4" 719 733 ipv4_do_test_rx 0 "IPv4 mcroute TX!=RX oif=0 ping" ··· 724 738 adf_install_sg_sep_rx lo 725 739 726 740 adf_ip_addr_add lo 192.0.2.120/28 727 - vx10_create_wait local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 741 + vx10_create local 192.0.2.120 group "$GROUP4" dev "$IPMR" mcroute 728 742 bridge fdb del dev vx10 00:00:00:00:00:00 729 743 bridge fdb add \ 730 744 dev vx10 00:00:00:00:00:00 self static dst "$GROUP4" via lo ··· 736 750 adf_install_sg_sep_rx "X$IPMR" 737 751 738 752 adf_ip_addr_add "X$IPMR" 2001:db8:5::1/64 739 - vx20_create_wait local 2001:db8:5::1 group "$GROUP6" dev "$IPMR" mcroute 753 + vx20_create local 2001:db8:5::1 group "$GROUP6" dev "$IPMR" mcroute 740 754 bridge -6 fdb del dev vx20 00:00:00:00:00:00 741 755 bridge -6 fdb add dev vx20 00:00:00:00:00:00 \ 742 756 self static dst "$GROUP6" via "X$IPMR"
+2 -1
tools/testing/selftests/net/lib.sh
··· 280 280 local selector=${1:-.packets}; shift 281 281 282 282 tc -j -s filter show dev $dev $dir pref $pref \ 283 - | jq ".[1].options.actions[].stats$selector" 283 + | jq ".[] | select(.options.actions) | 284 + .options.actions[].stats$selector" 284 285 } 285 286 286 287 tc_rule_handle_stats_get()
+4 -2
tools/testing/selftests/net/lib/ksft.h
··· 24 24 fd = STDOUT_FILENO; 25 25 } 26 26 27 - write(fd, msg, sizeof(msg)); 27 + if (write(fd, msg, sizeof(msg)) < 0) 28 + perror("write()"); 28 29 if (fd != STDOUT_FILENO) 29 30 close(fd); 30 31 } ··· 49 48 fd = STDIN_FILENO; 50 49 } 51 50 52 - read(fd, &byte, sizeof(byte)); 51 + if (read(fd, &byte, sizeof(byte)) < 0) 52 + perror("read()"); 53 53 if (fd != STDIN_FILENO) 54 54 close(fd); 55 55 }
+4
tools/testing/selftests/net/mptcp/pm_netlink.sh
··· 192 192 flush_endpoint 193 193 check "show_endpoints" "" "flush addrs" 194 194 195 + add_endpoint 10.0.1.1 flags unknown 196 + check "show_endpoints" "$(format_endpoints "1,10.0.1.1")" "ignore unknown flags" 197 + flush_endpoint 198 + 195 199 set_limits 9 1 2>/dev/null 196 200 check "get_limits" "${default_limits}" "rcv addrs above hard limit" 197 201
+11
tools/testing/selftests/net/mptcp/pm_nl_ctl.c
··· 24 24 #define IPPROTO_MPTCP 262 25 25 #endif 26 26 27 + #define MPTCP_PM_ADDR_FLAG_UNKNOWN _BITUL(7) 28 + 27 29 static void syntax(char *argv[]) 28 30 { 29 31 fprintf(stderr, "%s add|ann|rem|csf|dsf|get|set|del|flush|dump|events|listen|accept [<args>]\n", argv[0]); ··· 838 836 flags |= MPTCP_PM_ADDR_FLAG_BACKUP; 839 837 else if (!strcmp(tok, "fullmesh")) 840 838 flags |= MPTCP_PM_ADDR_FLAG_FULLMESH; 839 + else if (!strcmp(tok, "unknown")) 840 + flags |= MPTCP_PM_ADDR_FLAG_UNKNOWN; 841 841 else 842 842 error(1, errno, 843 843 "unknown flag %s", argv[arg]); ··· 1048 1044 if (flags & MPTCP_PM_ADDR_FLAG_IMPLICIT) { 1049 1045 printf("implicit"); 1050 1046 flags &= ~MPTCP_PM_ADDR_FLAG_IMPLICIT; 1047 + if (flags) 1048 + printf(","); 1049 + } 1050 + 1051 + if (flags & MPTCP_PM_ADDR_FLAG_UNKNOWN) { 1052 + printf("unknown"); 1053 + flags &= ~MPTCP_PM_ADDR_FLAG_UNKNOWN; 1051 1054 if (flags) 1052 1055 printf(","); 1053 1056 }
+4 -5
tools/testing/selftests/net/netfilter/conntrack_clash.sh
··· 116 116 # not a failure: clash resolution logic did not trigger. 117 117 # With right timing, xmit completed sequentially and 118 118 # no parallel insertion occurs. 119 - return $ksft_skip 119 + return $ksft_xfail 120 120 } 121 121 122 122 run_clash_test() ··· 133 133 if [ $rv -eq 0 ];then 134 134 echo "PASS: clash resolution test for $daddr:$dport on attempt $i" 135 135 return 0 136 - elif [ $rv -eq $ksft_skip ]; then 136 + elif [ $rv -eq $ksft_xfail ]; then 137 137 softerr=1 138 138 fi 139 139 done 140 140 141 - [ $softerr -eq 1 ] && echo "SKIP: clash resolution for $daddr:$dport did not trigger" 141 + [ $softerr -eq 1 ] && echo "XFAIL: clash resolution for $daddr:$dport did not trigger" 142 142 } 143 143 144 144 ip link add veth0 netns "$nsclient1" type veth peer name veth0 netns "$nsrouter" ··· 167 167 run_clash_test "$nsclient2" "$nsclient2" 127.0.0.1 9001 168 168 169 169 if [ $clash_resolution_active -eq 0 ];then 170 - [ "$ret" -eq 0 ] && ret=$ksft_skip 171 - echo "SKIP: Clash resolution did not trigger" 170 + [ "$ret" -eq 0 ] && ret=$ksft_xfail 172 171 fi 173 172 174 173 exit $ret
+9 -4
tools/testing/selftests/net/netfilter/conntrack_reverse_clash.c
··· 33 33 exit(111); 34 34 } 35 35 36 - static void die_port(uint16_t got, uint16_t want) 36 + static void die_port(const struct sockaddr_in *sin, uint16_t want) 37 37 { 38 - fprintf(stderr, "Port number changed, wanted %d got %d\n", want, ntohs(got)); 38 + uint16_t got = ntohs(sin->sin_port); 39 + char str[INET_ADDRSTRLEN]; 40 + 41 + inet_ntop(AF_INET, &sin->sin_addr, str, sizeof(str)); 42 + 43 + fprintf(stderr, "Port number changed, wanted %d got %d from %s\n", want, got, str); 39 44 exit(1); 40 45 } 41 46 ··· 105 100 die("child recvfrom"); 106 101 107 102 if (peer.sin_port != htons(PORT)) 108 - die_port(peer.sin_port, PORT); 103 + die_port(&peer, PORT); 109 104 } else { 110 105 if (sendto(s2, buf, LEN, 0, (struct sockaddr *)&sa1, sizeof(sa1)) != LEN) 111 106 continue; ··· 114 109 die("parent recvfrom"); 115 110 116 111 if (peer.sin_port != htons((PORT + 1))) 117 - die_port(peer.sin_port, PORT + 1); 112 + die_port(&peer, PORT + 1); 118 113 } 119 114 } 120 115
+2
tools/testing/selftests/net/netfilter/conntrack_reverse_clash.sh
··· 45 45 echo "PASS: No SNAT performed for null bindings" 46 46 else 47 47 echo "ERROR: SNAT performed without any matching snat rule" 48 + ip netns exec "$ns0" conntrack -L 49 + ip netns exec "$ns0" conntrack -S 48 50 exit 1 49 51 fi 50 52
+1 -1
tools/testing/selftests/net/netfilter/packetdrill/conntrack_syn_challenge_ack.pkt
··· 26 26 27 27 +0.01 > R 643160523:643160523(0) win 0 28 28 29 - +0.01 `conntrack -f $NFCT_IP_VERSION -L -p tcp --dport 8080 2>/dev/null | grep UNREPLIED | grep -q SYN_SENT` 29 + +0.1 `conntrack -f $NFCT_IP_VERSION -L -p tcp --dport 8080 2>/dev/null | grep UNREPLIED | grep -q SYN_SENT` 30 30 31 31 // Must go through. 32 32 +0.01 > S 0:0(0) win 65535 <mss 1460,sackOK,TS val 1 ecr 0,nop,wscale 8>
+2 -1
tools/testing/selftests/net/tfo.c
··· 81 81 if (getsockopt(connfd, SOL_SOCKET, SO_INCOMING_NAPI_ID, &opt, &len) < 0) 82 82 error(1, errno, "getsockopt(SO_INCOMING_NAPI_ID)"); 83 83 84 - read(connfd, buf, 64); 84 + if (read(connfd, buf, 64) < 0) 85 + perror("read()"); 85 86 fprintf(outfile, "%d\n", opt); 86 87 87 88 fclose(outfile);
+1 -1
tools/testing/selftests/net/tls.c
··· 2786 2786 TEST_F(tls_err, poll_partial_rec_async) 2787 2787 { 2788 2788 struct pollfd pfd = { }; 2789 + char token = '\0'; 2789 2790 ssize_t rec_len; 2790 2791 char rec[256]; 2791 2792 char buf[128]; 2792 - char token; 2793 2793 int p[2]; 2794 2794 int ret; 2795 2795
+46
tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json
··· 1052 1052 "$TC qdisc del dev $DEV1 ingress_block 21 clsact", 1053 1053 "$TC actions flush action mirred" 1054 1054 ] 1055 + }, 1056 + { 1057 + "id": "7eba", 1058 + "name": "Redirect multiport: dummy egress -> dummy egress (Loop)", 1059 + "category": [ 1060 + "filter", 1061 + "mirred" 1062 + ], 1063 + "plugins": { 1064 + "requires": [ 1065 + "nsPlugin" 1066 + ] 1067 + }, 1068 + "setup": [ 1069 + "$IP link set dev $DUMMY up || true", 1070 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 1071 + "$TC qdisc add dev $DUMMY handle 1: root drr", 1072 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1" 1073 + ], 1074 + "cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1", 1075 + "expExitCode": "1", 1076 + "verifyCmd": "$TC -j -s actions get action mirred index 1", 1077 + "matchJSON": [ 1078 + { 1079 + "total acts": 0 1080 + }, 1081 + { 1082 + "actions": [ 1083 + { 1084 + "order": 1, 1085 + "kind": "mirred", 1086 + "mirred_action": "redirect", 1087 + "direction": "egress", 1088 + "index": 1, 1089 + "stats": { 1090 + "packets": 1, 1091 + "overlimits": 1 1092 + }, 1093 + "not_in_hw": true 1094 + } 1095 + ] 1096 + } 1097 + ], 1098 + "teardown": [ 1099 + "$TC qdisc del dev $DUMMY root" 1100 + ] 1055 1101 } 1056 1102 ]
+78
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
··· 1033 1033 "teardown": [ 1034 1034 "$TC qdisc del dev $DUMMY handle 1: root" 1035 1035 ] 1036 + }, 1037 + { 1038 + "id": "6e4f", 1039 + "name": "Try to delete ets drr class' qdisc while still keeping it in the active list", 1040 + "category": [ 1041 + "qdisc", 1042 + "ets", 1043 + "tbf" 1044 + ], 1045 + "plugins": { 1046 + "requires": [ 1047 + "nsPlugin", 1048 + "scapyPlugin" 1049 + ] 1050 + }, 1051 + "setup": [ 1052 + "$IP link set dev $DUMMY up || true", 1053 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 1054 + "$TC qdisc add dev $DUMMY root handle 1: ets bands 2 strict 1", 1055 + "$TC qdisc add dev $DUMMY parent 1:2 handle 20: tbf rate 8bit burst 100b latency 1s", 1056 + "$TC filter add dev $DUMMY parent 1: basic classid 1:2", 1057 + "ping -c2 -W0.01 -s 56 -I $DUMMY 10.10.11.11 || true", 1058 + "$TC qdisc change dev $DUMMY root handle 1: ets bands 2 strict 2", 1059 + "$TC qdisc change dev $DUMMY root handle 1: ets bands 1 strict 1" 1060 + ], 1061 + "cmdUnderTest": "ping -c1 -W0.01 -s 56 -I $DUMMY 10.10.11.11", 1062 + "expExitCode": "1", 1063 + "verifyCmd": "$TC -s -j qdisc ls dev $DUMMY root", 1064 + "matchJSON": [ 1065 + { 1066 + "kind": "ets", 1067 + "handle": "1:", 1068 + "bytes": 196, 1069 + "packets": 2 1070 + } 1071 + ], 1072 + "teardown": [ 1073 + "$TC qdisc del dev $DUMMY root handle 1:" 1074 + ] 1075 + }, 1076 + { 1077 + "id": "0b8f", 1078 + "name": "Try to add ets class to the active list twice", 1079 + "category": [ 1080 + "qdisc", 1081 + "ets", 1082 + "tbf" 1083 + ], 1084 + "plugins": { 1085 + "requires": [ 1086 + "nsPlugin", 1087 + "scapyPlugin" 1088 + ] 1089 + }, 1090 + "setup": [ 1091 + "$IP link set dev $DUMMY up || true", 1092 + "$IP addr add 10.10.11.10/24 dev $DUMMY || true", 1093 + "$TC qdisc add dev $DUMMY root handle 1: ets bands 2 strict 1", 1094 + "$TC qdisc add dev $DUMMY parent 1:2 handle 20: tbf rate 8bit burst 100b latency 1s", 1095 + "$TC filter add dev $DUMMY parent 1: basic classid 1:2", 1096 + "ping -c2 -W0.01 -s 56 -I $DUMMY 10.10.11.11 || true", 1097 + "$TC qdisc change dev $DUMMY root handle 1: ets bands 2 strict 2", 1098 + "$TC qdisc change dev $DUMMY root handle 1: ets bands 2 strict 1" 1099 + ], 1100 + "cmdUnderTest": "ping -c1 -W0.01 -s 56 -I $DUMMY 10.10.11.11", 1101 + "expExitCode": "1", 1102 + "verifyCmd": "$TC -s -j qdisc ls dev $DUMMY root", 1103 + "matchJSON": [ 1104 + { 1105 + "kind": "ets", 1106 + "handle": "1:", 1107 + "bytes": 98, 1108 + "packets": 1 1109 + } 1110 + ], 1111 + "teardown": [ 1112 + "$TC qdisc del dev $DUMMY root handle 1:" 1113 + ] 1036 1114 } 1037 1115 ]