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

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

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

Current release - regressions:

- core: hold instance lock during NETDEV_CHANGE

- rtnetlink: fix bad unlock balance in do_setlink()

- ipv6:
- fix null-ptr-deref in addrconf_add_ifaddr()
- align behavior across nexthops during path selection

Previous releases - regressions:

- sctp: prevent transport UaF in sendmsg

- mptcp: only inc MPJoinAckHMacFailure for HMAC failures

Previous releases - always broken:

- sched:
- make ->qlen_notify() idempotent
- ensure sufficient space when sending filter netlink notifications
- sch_sfq: really don't allow 1 packet limit

- netfilter: fix incorrect avx2 match of 5th field octet

- tls: explicitly disallow disconnect

- eth: octeontx2-pf: fix VF root node parent queue priority"

* tag 'net-6.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (38 commits)
ethtool: cmis_cdb: Fix incorrect read / write length extension
selftests: netfilter: add test case for recent mismatch bug
nft_set_pipapo: fix incorrect avx2 match of 5th field octet
net: ppp: Add bound checking for skb data on ppp_sync_txmung
net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
ipv6: Align behavior across nexthops during path selection
net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY
net: phy: move phy_link_change() prior to mdio_bus_phy_may_suspend()
selftests/tc-testing: sfq: check that a derived limit of 1 is rejected
net_sched: sch_sfq: move the limit validation
net_sched: sch_sfq: use a temporary work area for validating configuration
net: libwx: handle page_pool_dev_alloc_pages error
selftests: mptcp: validate MPJoin HMacFailure counters
mptcp: only inc MPJoinAckHMacFailure for HMAC failures
rtnetlink: Fix bad unlock balance in do_setlink().
net: ethtool: Don't call .cleanup_data when prepare_data fails
tc: Ensure we have enough buffer space when sending filter netlink notifications
net: libwx: Fix the wrong Rx descriptor field
octeontx2-pf: qos: fix VF root node parent queue index
selftests: tls: check that disconnect does nothing
...

+649 -150
+6 -4
Documentation/networking/netdevices.rst
··· 338 338 Devices drivers are encouraged to rely on the instance lock where possible. 339 339 340 340 For the (mostly software) drivers that need to interact with the core stack, 341 - there are two sets of interfaces: ``dev_xxx`` and ``netif_xxx`` (e.g., 342 - ``dev_set_mtu`` and ``netif_set_mtu``). The ``dev_xxx`` functions handle 343 - acquiring the instance lock themselves, while the ``netif_xxx`` functions 344 - assume that the driver has already acquired the instance lock. 341 + there are two sets of interfaces: ``dev_xxx``/``netdev_xxx`` and ``netif_xxx`` 342 + (e.g., ``dev_set_mtu`` and ``netif_set_mtu``). The ``dev_xxx``/``netdev_xxx`` 343 + functions handle acquiring the instance lock themselves, while the 344 + ``netif_xxx`` functions assume that the driver has already acquired 345 + the instance lock. 345 346 346 347 Notifiers and netdev instance lock 347 348 ================================== ··· 355 354 running under the lock: 356 355 * ``NETDEV_REGISTER`` 357 356 * ``NETDEV_UP`` 357 + * ``NETDEV_CHANGE`` 358 358 359 359 The following notifiers are running without the lock: 360 360 * ``NETDEV_UNREGISTER``
+5
drivers/net/ethernet/marvell/octeontx2/nic/qos.c
··· 165 165 166 166 otx2_config_sched_shaping(pfvf, node, cfg, &num_regs); 167 167 } else if (level == NIX_TXSCH_LVL_TL2) { 168 + /* configure parent txschq */ 169 + cfg->reg[num_regs] = NIX_AF_TL2X_PARENT(node->schq); 170 + cfg->regval[num_regs] = (u64)hw->tx_link << 16; 171 + num_regs++; 172 + 168 173 /* configure link cfg */ 169 174 if (level == pfvf->qos.link_cfg_lvl) { 170 175 cfg->reg[num_regs] = NIX_AF_TL3_TL2X_LINKX_CFG(node->schq, hw->tx_link);
+4 -2
drivers/net/ethernet/wangxun/libwx/wx_lib.c
··· 310 310 return true; 311 311 312 312 page = page_pool_dev_alloc_pages(rx_ring->page_pool); 313 - WARN_ON(!page); 313 + if (unlikely(!page)) 314 + return false; 314 315 dma = page_pool_get_dma_addr(page); 315 316 316 317 bi->page_dma = dma; ··· 547 546 return; 548 547 549 548 /* Hardware can't guarantee csum if IPv6 Dest Header found */ 550 - if (dptype.prot != WX_DEC_PTYPE_PROT_SCTP && WX_RXD_IPV6EX(rx_desc)) 549 + if (dptype.prot != WX_DEC_PTYPE_PROT_SCTP && 550 + wx_test_staterr(rx_desc, WX_RXD_STAT_IPV6EX)) 551 551 return; 552 552 553 553 /* if L4 checksum error */
+1 -2
drivers/net/ethernet/wangxun/libwx/wx_type.h
··· 513 513 #define WX_RXD_STAT_L4CS BIT(7) /* L4 xsum calculated */ 514 514 #define WX_RXD_STAT_IPCS BIT(8) /* IP xsum calculated */ 515 515 #define WX_RXD_STAT_OUTERIPCS BIT(10) /* Cloud IP xsum calculated*/ 516 + #define WX_RXD_STAT_IPV6EX BIT(12) /* IPv6 Dest Header */ 516 517 #define WX_RXD_STAT_TS BIT(14) /* IEEE1588 Time Stamp */ 517 518 518 519 #define WX_RXD_ERR_OUTERIPER BIT(26) /* CRC IP Header error */ ··· 590 589 591 590 #define WX_RXD_PKTTYPE(_rxd) \ 592 591 ((le32_to_cpu((_rxd)->wb.lower.lo_dword.data) >> 9) & 0xFF) 593 - #define WX_RXD_IPV6EX(_rxd) \ 594 - ((le32_to_cpu((_rxd)->wb.lower.lo_dword.data) >> 6) & 0x1) 595 592 /*********************** Transmit Descriptor Config Masks ****************/ 596 593 #define WX_TXD_STAT_DD BIT(0) /* Descriptor Done */ 597 594 #define WX_TXD_DTYP_DATA 0 /* Adv Data Descriptor */
+42 -15
drivers/net/phy/phy_device.c
··· 244 244 return wol.wolopts != 0; 245 245 } 246 246 247 + static void phy_link_change(struct phy_device *phydev, bool up) 248 + { 249 + struct net_device *netdev = phydev->attached_dev; 250 + 251 + if (up) 252 + netif_carrier_on(netdev); 253 + else 254 + netif_carrier_off(netdev); 255 + phydev->adjust_link(netdev); 256 + if (phydev->mii_ts && phydev->mii_ts->link_state) 257 + phydev->mii_ts->link_state(phydev->mii_ts, phydev); 258 + } 259 + 260 + /** 261 + * phy_uses_state_machine - test whether consumer driver uses PAL state machine 262 + * @phydev: the target PHY device structure 263 + * 264 + * Ultimately, this aims to indirectly determine whether the PHY is attached 265 + * to a consumer which uses the state machine by calling phy_start() and 266 + * phy_stop(). 267 + * 268 + * When the PHY driver consumer uses phylib, it must have previously called 269 + * phy_connect_direct() or one of its derivatives, so that phy_prepare_link() 270 + * has set up a hook for monitoring state changes. 271 + * 272 + * When the PHY driver is used by the MAC driver consumer through phylink (the 273 + * only other provider of a phy_link_change() method), using the PHY state 274 + * machine is not optional. 275 + * 276 + * Return: true if consumer calls phy_start() and phy_stop(), false otherwise. 277 + */ 278 + static bool phy_uses_state_machine(struct phy_device *phydev) 279 + { 280 + if (phydev->phy_link_change == phy_link_change) 281 + return phydev->attached_dev && phydev->adjust_link; 282 + 283 + /* phydev->phy_link_change is implicitly phylink_phy_change() */ 284 + return true; 285 + } 286 + 247 287 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) 248 288 { 249 289 struct device_driver *drv = phydev->mdio.dev.driver; ··· 350 310 * may call phy routines that try to grab the same lock, and that may 351 311 * lead to a deadlock. 352 312 */ 353 - if (phydev->attached_dev && phydev->adjust_link) 313 + if (phy_uses_state_machine(phydev)) 354 314 phy_stop_machine(phydev); 355 315 356 316 if (!mdio_bus_phy_may_suspend(phydev)) ··· 404 364 } 405 365 } 406 366 407 - if (phydev->attached_dev && phydev->adjust_link) 367 + if (phy_uses_state_machine(phydev)) 408 368 phy_start_machine(phydev); 409 369 410 370 return 0; ··· 1094 1054 return NULL; 1095 1055 } 1096 1056 EXPORT_SYMBOL(phy_find_first); 1097 - 1098 - static void phy_link_change(struct phy_device *phydev, bool up) 1099 - { 1100 - struct net_device *netdev = phydev->attached_dev; 1101 - 1102 - if (up) 1103 - netif_carrier_on(netdev); 1104 - else 1105 - netif_carrier_off(netdev); 1106 - phydev->adjust_link(netdev); 1107 - if (phydev->mii_ts && phydev->mii_ts->link_state) 1108 - phydev->mii_ts->link_state(phydev->mii_ts, phydev); 1109 - } 1110 1057 1111 1058 /** 1112 1059 * phy_prepare_link - prepares the PHY layer to monitor link status
+5
drivers/net/ppp/ppp_synctty.c
··· 506 506 unsigned char *data; 507 507 int islcp; 508 508 509 + /* Ensure we can safely access protocol field and LCP code */ 510 + if (!pskb_may_pull(skb, 3)) { 511 + kfree_skb(skb); 512 + return NULL; 513 + } 509 514 data = skb->data; 510 515 proto = get_unaligned_be16(data); 511 516
+2
include/linux/netdevice.h
··· 4429 4429 * pending work list (if queued). 4430 4430 */ 4431 4431 void linkwatch_sync_dev(struct net_device *dev); 4432 + void __linkwatch_sync_dev(struct net_device *dev); 4432 4433 4433 4434 /** 4434 4435 * netif_carrier_ok - test if carrier present ··· 4975 4974 int dev_set_promiscuity(struct net_device *dev, int inc); 4976 4975 int netif_set_allmulti(struct net_device *dev, int inc, bool notify); 4977 4976 int dev_set_allmulti(struct net_device *dev, int inc); 4977 + void netif_state_change(struct net_device *dev); 4978 4978 void netdev_state_change(struct net_device *dev); 4979 4979 void __netdev_notify_peers(struct net_device *dev); 4980 4980 void netdev_notify_peers(struct net_device *dev);
+1 -1
include/linux/rtnetlink.h
··· 240 240 return (nlflags & NLM_F_ECHO) || rtnl_has_listeners(net, group); 241 241 } 242 242 243 - void netdev_set_operstate(struct net_device *dev, int newstate); 243 + void netif_set_operstate(struct net_device *dev, int newstate); 244 244 245 245 #endif /* __LINUX_RTNETLINK_H */
+2 -1
include/net/sctp/structs.h
··· 775 775 776 776 /* Reference counting. */ 777 777 refcount_t refcnt; 778 + __u32 dead:1, 778 779 /* RTO-Pending : A flag used to track if one of the DATA 779 780 * chunks sent to this address is currently being 780 781 * used to compute a RTT. If this flag is 0, ··· 785 784 * calculation completes (i.e. the DATA chunk 786 785 * is SACK'd) clear this flag. 787 786 */ 788 - __u32 rto_pending:1, 787 + rto_pending:1, 789 788 790 789 /* 791 790 * hb_sent : a flag that signals that we have a pending
+38 -2
include/net/sock.h
··· 339 339 * @sk_txtime_unused: unused txtime flags 340 340 * @ns_tracker: tracker for netns reference 341 341 * @sk_user_frags: xarray of pages the user is holding a reference on. 342 + * @sk_owner: reference to the real owner of the socket that calls 343 + * sock_lock_init_class_and_name(). 342 344 */ 343 345 struct sock { 344 346 /* ··· 549 547 struct rcu_head sk_rcu; 550 548 netns_tracker ns_tracker; 551 549 struct xarray sk_user_frags; 550 + 551 + #if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES) 552 + struct module *sk_owner; 553 + #endif 552 554 }; 553 555 554 556 struct sock_bh_locked { ··· 1589 1583 sk_mem_reclaim(sk); 1590 1584 } 1591 1585 1586 + #if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES) 1587 + static inline void sk_owner_set(struct sock *sk, struct module *owner) 1588 + { 1589 + __module_get(owner); 1590 + sk->sk_owner = owner; 1591 + } 1592 + 1593 + static inline void sk_owner_clear(struct sock *sk) 1594 + { 1595 + sk->sk_owner = NULL; 1596 + } 1597 + 1598 + static inline void sk_owner_put(struct sock *sk) 1599 + { 1600 + module_put(sk->sk_owner); 1601 + } 1602 + #else 1603 + static inline void sk_owner_set(struct sock *sk, struct module *owner) 1604 + { 1605 + } 1606 + 1607 + static inline void sk_owner_clear(struct sock *sk) 1608 + { 1609 + } 1610 + 1611 + static inline void sk_owner_put(struct sock *sk) 1612 + { 1613 + } 1614 + #endif 1592 1615 /* 1593 1616 * Macro so as to not evaluate some arguments when 1594 1617 * lockdep is not enabled. ··· 1627 1592 */ 1628 1593 #define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ 1629 1594 do { \ 1595 + sk_owner_set(sk, THIS_MODULE); \ 1630 1596 sk->sk_lock.owned = 0; \ 1631 1597 init_waitqueue_head(&sk->sk_lock.wq); \ 1632 1598 spin_lock_init(&(sk)->sk_lock.slock); \ 1633 1599 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ 1634 - sizeof((sk)->sk_lock)); \ 1600 + sizeof((sk)->sk_lock)); \ 1635 1601 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \ 1636 - (skey), (sname)); \ 1602 + (skey), (sname)); \ 1637 1603 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1638 1604 } while (0) 1639 1605
+1 -10
net/core/dev.c
··· 1518 1518 } 1519 1519 EXPORT_SYMBOL(netdev_features_change); 1520 1520 1521 - /** 1522 - * netdev_state_change - device changes state 1523 - * @dev: device to cause notification 1524 - * 1525 - * Called to indicate a device has changed state. This function calls 1526 - * the notifier chains for netdev_chain and sends a NEWLINK message 1527 - * to the routing socket. 1528 - */ 1529 - void netdev_state_change(struct net_device *dev) 1521 + void netif_state_change(struct net_device *dev) 1530 1522 { 1531 1523 if (dev->flags & IFF_UP) { 1532 1524 struct netdev_notifier_change_info change_info = { ··· 1530 1538 rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL, 0, NULL); 1531 1539 } 1532 1540 } 1533 - EXPORT_SYMBOL(netdev_state_change); 1534 1541 1535 1542 /** 1536 1543 * __netdev_notify_peers - notify network peers about existence of @dev,
+16
net/core/dev_api.c
··· 327 327 return ret; 328 328 } 329 329 EXPORT_SYMBOL_GPL(dev_xdp_propagate); 330 + 331 + /** 332 + * netdev_state_change() - device changes state 333 + * @dev: device to cause notification 334 + * 335 + * Called to indicate a device has changed state. This function calls 336 + * the notifier chains for netdev_chain and sends a NEWLINK message 337 + * to the routing socket. 338 + */ 339 + void netdev_state_change(struct net_device *dev) 340 + { 341 + netdev_lock_ops(dev); 342 + netif_state_change(dev); 343 + netdev_unlock_ops(dev); 344 + } 345 + EXPORT_SYMBOL(netdev_state_change);
+1 -1
net/core/lock_debug.c
··· 20 20 switch (cmd) { 21 21 case NETDEV_REGISTER: 22 22 case NETDEV_UP: 23 + case NETDEV_CHANGE: 23 24 netdev_ops_assert_locked(dev); 24 25 fallthrough; 25 26 case NETDEV_DOWN: 26 27 case NETDEV_REBOOT: 27 - case NETDEV_CHANGE: 28 28 case NETDEV_UNREGISTER: 29 29 case NETDEV_CHANGEMTU: 30 30 case NETDEV_CHANGEADDR:
+10 -7
net/core/rtnetlink.c
··· 1043 1043 } 1044 1044 EXPORT_SYMBOL_GPL(rtnl_put_cacheinfo); 1045 1045 1046 - void netdev_set_operstate(struct net_device *dev, int newstate) 1046 + void netif_set_operstate(struct net_device *dev, int newstate) 1047 1047 { 1048 1048 unsigned int old = READ_ONCE(dev->operstate); 1049 1049 ··· 1052 1052 return; 1053 1053 } while (!try_cmpxchg(&dev->operstate, &old, newstate)); 1054 1054 1055 - netdev_state_change(dev); 1055 + netif_state_change(dev); 1056 1056 } 1057 - EXPORT_SYMBOL(netdev_set_operstate); 1057 + EXPORT_SYMBOL(netif_set_operstate); 1058 1058 1059 1059 static void set_operstate(struct net_device *dev, unsigned char transition) 1060 1060 { ··· 1080 1080 break; 1081 1081 } 1082 1082 1083 - netdev_set_operstate(dev, operstate); 1083 + netif_set_operstate(dev, operstate); 1084 1084 } 1085 1085 1086 1086 static unsigned int rtnl_dev_get_flags(const struct net_device *dev) ··· 3027 3027 3028 3028 err = validate_linkmsg(dev, tb, extack); 3029 3029 if (err < 0) 3030 - goto errout; 3030 + return err; 3031 3031 3032 3032 if (tb[IFLA_IFNAME]) 3033 3033 nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); ··· 3396 3396 errout: 3397 3397 if (status & DO_SETLINK_MODIFIED) { 3398 3398 if ((status & DO_SETLINK_NOTIFY) == DO_SETLINK_NOTIFY) 3399 - netdev_state_change(dev); 3399 + netif_state_change(dev); 3400 3400 3401 3401 if (err < 0) 3402 3402 net_warn_ratelimited("A link change request failed with some changes committed already. Interface %s may have been left with an inconsistent configuration, please check.\n", ··· 3676 3676 nla_len(tb[IFLA_BROADCAST])); 3677 3677 if (tb[IFLA_TXQLEN]) 3678 3678 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]); 3679 - if (tb[IFLA_OPERSTATE]) 3679 + if (tb[IFLA_OPERSTATE]) { 3680 + netdev_lock_ops(dev); 3680 3681 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE])); 3682 + netdev_unlock_ops(dev); 3683 + } 3681 3684 if (tb[IFLA_LINKMODE]) 3682 3685 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]); 3683 3686 if (tb[IFLA_GROUP])
+5
net/core/sock.c
··· 2130 2130 */ 2131 2131 static inline void sock_lock_init(struct sock *sk) 2132 2132 { 2133 + sk_owner_clear(sk); 2134 + 2133 2135 if (sk->sk_kern_sock) 2134 2136 sock_lock_init_class_and_name( 2135 2137 sk, ··· 2228 2226 cgroup_sk_free(&sk->sk_cgrp_data); 2229 2227 mem_cgroup_sk_free(sk); 2230 2228 security_sk_free(sk); 2229 + 2230 + sk_owner_put(sk); 2231 + 2231 2232 if (slab != NULL) 2232 2233 kmem_cache_free(slab, sk); 2233 2234 else
-1
net/ethtool/cmis.h
··· 101 101 }; 102 102 103 103 u32 ethtool_cmis_get_max_lpl_size(u8 num_of_byte_octs); 104 - u32 ethtool_cmis_get_max_epl_size(u8 num_of_byte_octs); 105 104 106 105 void ethtool_cmis_cdb_compose_args(struct ethtool_cmis_cdb_cmd_args *args, 107 106 enum ethtool_cmis_cdb_cmd_id cmd, u8 *lpl,
+3 -15
net/ethtool/cmis_cdb.c
··· 16 16 return 8 * (1 + min_t(u8, num_of_byte_octs, 15)); 17 17 } 18 18 19 - /* For accessing the EPL field on page 9Fh, the allowable length extension is 20 - * min(i, 255) byte octets where i specifies the allowable additional number of 21 - * byte octets in a READ or a WRITE. 22 - */ 23 - u32 ethtool_cmis_get_max_epl_size(u8 num_of_byte_octs) 24 - { 25 - return 8 * (1 + min_t(u8, num_of_byte_octs, 255)); 26 - } 27 - 28 19 void ethtool_cmis_cdb_compose_args(struct ethtool_cmis_cdb_cmd_args *args, 29 20 enum ethtool_cmis_cdb_cmd_id cmd, u8 *lpl, 30 21 u8 lpl_len, u8 *epl, u16 epl_len, ··· 24 33 { 25 34 args->req.id = cpu_to_be16(cmd); 26 35 args->req.lpl_len = lpl_len; 27 - if (lpl) { 36 + if (lpl) 28 37 memcpy(args->req.payload, lpl, args->req.lpl_len); 29 - args->read_write_len_ext = 30 - ethtool_cmis_get_max_lpl_size(read_write_len_ext); 31 - } 32 38 if (epl) { 33 39 args->req.epl_len = cpu_to_be16(epl_len); 34 40 args->req.epl = epl; 35 - args->read_write_len_ext = 36 - ethtool_cmis_get_max_epl_size(read_write_len_ext); 37 41 } 38 42 39 43 args->max_duration = max_duration; 44 + args->read_write_len_ext = 45 + ethtool_cmis_get_max_lpl_size(read_write_len_ext); 40 46 args->msleep_pre_rpl = msleep_pre_rpl; 41 47 args->rpl_exp_len = rpl_exp_len; 42 48 args->flags = flags;
+1
net/ethtool/common.c
··· 830 830 831 831 /* Driver gives us current state, we want to return current config */ 832 832 kparam->tcp_data_split = dev->cfg->hds_config; 833 + kparam->hds_thresh = dev->cfg->hds_thresh; 833 834 } 834 835 835 836 static void ethtool_init_tsinfo(struct kernel_ethtool_ts_info *info)
+1 -1
net/ethtool/ioctl.c
··· 60 60 u32 ethtool_op_get_link(struct net_device *dev) 61 61 { 62 62 /* Synchronize carrier state with link watch, see also rtnl_getlink() */ 63 - linkwatch_sync_dev(dev); 63 + __linkwatch_sync_dev(dev); 64 64 65 65 return netif_carrier_ok(dev) ? 1 : 0; 66 66 }
+5 -3
net/ethtool/netlink.c
··· 500 500 netdev_unlock_ops(req_info->dev); 501 501 rtnl_unlock(); 502 502 if (ret < 0) 503 - goto err_cleanup; 503 + goto err_dev; 504 504 ret = ops->reply_size(req_info, reply_data); 505 505 if (ret < 0) 506 506 goto err_cleanup; ··· 560 560 netdev_unlock_ops(dev); 561 561 rtnl_unlock(); 562 562 if (ret < 0) 563 - goto out; 563 + goto out_cancel; 564 564 ret = ethnl_fill_reply_header(skb, dev, ctx->ops->hdr_attr); 565 565 if (ret < 0) 566 566 goto out; ··· 569 569 out: 570 570 if (ctx->ops->cleanup_data) 571 571 ctx->ops->cleanup_data(ctx->reply_data); 572 + out_cancel: 572 573 ctx->reply_data->dev = NULL; 573 574 if (ret < 0) 574 575 genlmsg_cancel(skb, ehdr); ··· 794 793 ethnl_init_reply_data(reply_data, ops, dev); 795 794 ret = ops->prepare_data(req_info, reply_data, &info); 796 795 if (ret < 0) 797 - goto err_cleanup; 796 + goto err_rep; 798 797 ret = ops->reply_size(req_info, reply_data); 799 798 if (ret < 0) 800 799 goto err_cleanup; ··· 829 828 err_cleanup: 830 829 if (ops->cleanup_data) 831 830 ops->cleanup_data(reply_data); 831 + err_rep: 832 832 kfree(reply_data); 833 833 kfree(req_info); 834 834 return;
+3 -3
net/hsr/hsr_device.c
··· 33 33 struct net_device *dev = master->dev; 34 34 35 35 if (!is_admin_up(dev)) { 36 - netdev_set_operstate(dev, IF_OPER_DOWN); 36 + netif_set_operstate(dev, IF_OPER_DOWN); 37 37 return; 38 38 } 39 39 40 40 if (has_carrier) 41 - netdev_set_operstate(dev, IF_OPER_UP); 41 + netif_set_operstate(dev, IF_OPER_UP); 42 42 else 43 - netdev_set_operstate(dev, IF_OPER_LOWERLAYERDOWN); 43 + netif_set_operstate(dev, IF_OPER_LOWERLAYERDOWN); 44 44 } 45 45 46 46 static bool hsr_check_carrier(struct hsr_port *master)
+5 -4
net/ipv6/addrconf.c
··· 3154 3154 3155 3155 rtnl_net_lock(net); 3156 3156 dev = __dev_get_by_index(net, ireq.ifr6_ifindex); 3157 - netdev_lock_ops(dev); 3158 - if (dev) 3157 + if (dev) { 3158 + netdev_lock_ops(dev); 3159 3159 err = inet6_addr_add(net, dev, &cfg, 0, 0, NULL); 3160 - else 3160 + netdev_unlock_ops(dev); 3161 + } else { 3161 3162 err = -ENODEV; 3162 - netdev_unlock_ops(dev); 3163 + } 3163 3164 rtnl_net_unlock(net); 3164 3165 return err; 3165 3166 }
+4 -4
net/ipv6/route.c
··· 470 470 goto out; 471 471 472 472 hash = fl6->mp_hash; 473 - if (hash <= atomic_read(&first->fib6_nh->fib_nh_upper_bound) && 474 - rt6_score_route(first->fib6_nh, first->fib6_flags, oif, 475 - strict) >= 0) { 476 - match = first; 473 + if (hash <= atomic_read(&first->fib6_nh->fib_nh_upper_bound)) { 474 + if (rt6_score_route(first->fib6_nh, first->fib6_flags, oif, 475 + strict) >= 0) 476 + match = first; 477 477 goto out; 478 478 } 479 479
+6 -2
net/mptcp/subflow.c
··· 899 899 goto dispose_child; 900 900 } 901 901 902 - if (!subflow_hmac_valid(req, &mp_opt) || 903 - !mptcp_can_accept_new_subflow(subflow_req->msk)) { 902 + if (!subflow_hmac_valid(req, &mp_opt)) { 904 903 SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); 904 + subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT); 905 + goto dispose_child; 906 + } 907 + 908 + if (!mptcp_can_accept_new_subflow(owner)) { 905 909 subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT); 906 910 goto dispose_child; 907 911 }
+2 -1
net/netfilter/nft_set_pipapo_avx2.c
··· 994 994 NFT_PIPAPO_AVX2_BUCKET_LOAD8(5, lt, 8, pkt[8], bsize); 995 995 996 996 NFT_PIPAPO_AVX2_AND(6, 2, 3); 997 + NFT_PIPAPO_AVX2_AND(3, 4, 7); 997 998 NFT_PIPAPO_AVX2_BUCKET_LOAD8(7, lt, 9, pkt[9], bsize); 998 - NFT_PIPAPO_AVX2_AND(0, 4, 5); 999 + NFT_PIPAPO_AVX2_AND(0, 3, 5); 999 1000 NFT_PIPAPO_AVX2_BUCKET_LOAD8(1, lt, 10, pkt[10], bsize); 1000 1001 NFT_PIPAPO_AVX2_AND(2, 6, 7); 1001 1002 NFT_PIPAPO_AVX2_BUCKET_LOAD8(3, lt, 11, pkt[11], bsize);
+45 -21
net/sched/cls_api.c
··· 2057 2057 struct tcmsg *tcm; 2058 2058 struct nlmsghdr *nlh; 2059 2059 unsigned char *b = skb_tail_pointer(skb); 2060 + int ret = -EMSGSIZE; 2060 2061 2061 2062 nlh = nlmsg_put(skb, portid, seq, event, sizeof(*tcm), flags); 2062 2063 if (!nlh) ··· 2102 2101 2103 2102 return skb->len; 2104 2103 2104 + cls_op_not_supp: 2105 + ret = -EOPNOTSUPP; 2105 2106 out_nlmsg_trim: 2106 2107 nla_put_failure: 2107 - cls_op_not_supp: 2108 2108 nlmsg_trim(skb, b); 2109 - return -1; 2109 + return ret; 2110 + } 2111 + 2112 + static struct sk_buff *tfilter_notify_prep(struct net *net, 2113 + struct sk_buff *oskb, 2114 + struct nlmsghdr *n, 2115 + struct tcf_proto *tp, 2116 + struct tcf_block *block, 2117 + struct Qdisc *q, u32 parent, 2118 + void *fh, int event, 2119 + u32 portid, bool rtnl_held, 2120 + struct netlink_ext_ack *extack) 2121 + { 2122 + unsigned int size = oskb ? max(NLMSG_GOODSIZE, oskb->len) : NLMSG_GOODSIZE; 2123 + struct sk_buff *skb; 2124 + int ret; 2125 + 2126 + retry: 2127 + skb = alloc_skb(size, GFP_KERNEL); 2128 + if (!skb) 2129 + return ERR_PTR(-ENOBUFS); 2130 + 2131 + ret = tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, 2132 + n->nlmsg_seq, n->nlmsg_flags, event, false, 2133 + rtnl_held, extack); 2134 + if (ret <= 0) { 2135 + kfree_skb(skb); 2136 + if (ret == -EMSGSIZE) { 2137 + size += NLMSG_GOODSIZE; 2138 + goto retry; 2139 + } 2140 + return ERR_PTR(-EINVAL); 2141 + } 2142 + return skb; 2110 2143 } 2111 2144 2112 2145 static int tfilter_notify(struct net *net, struct sk_buff *oskb, ··· 2156 2121 if (!unicast && !rtnl_notify_needed(net, n->nlmsg_flags, RTNLGRP_TC)) 2157 2122 return 0; 2158 2123 2159 - skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 2160 - if (!skb) 2161 - return -ENOBUFS; 2162 - 2163 - if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, 2164 - n->nlmsg_seq, n->nlmsg_flags, event, 2165 - false, rtnl_held, extack) <= 0) { 2166 - kfree_skb(skb); 2167 - return -EINVAL; 2168 - } 2124 + skb = tfilter_notify_prep(net, oskb, n, tp, block, q, parent, fh, event, 2125 + portid, rtnl_held, extack); 2126 + if (IS_ERR(skb)) 2127 + return PTR_ERR(skb); 2169 2128 2170 2129 if (unicast) 2171 2130 err = rtnl_unicast(skb, net, portid); ··· 2182 2153 if (!rtnl_notify_needed(net, n->nlmsg_flags, RTNLGRP_TC)) 2183 2154 return tp->ops->delete(tp, fh, last, rtnl_held, extack); 2184 2155 2185 - skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); 2186 - if (!skb) 2187 - return -ENOBUFS; 2188 - 2189 - if (tcf_fill_node(net, skb, tp, block, q, parent, fh, portid, 2190 - n->nlmsg_seq, n->nlmsg_flags, RTM_DELTFILTER, 2191 - false, rtnl_held, extack) <= 0) { 2156 + skb = tfilter_notify_prep(net, oskb, n, tp, block, q, parent, fh, 2157 + RTM_DELTFILTER, portid, rtnl_held, extack); 2158 + if (IS_ERR(skb)) { 2192 2159 NL_SET_ERR_MSG(extack, "Failed to build del event notification"); 2193 - kfree_skb(skb); 2194 - return -EINVAL; 2160 + return PTR_ERR(skb); 2195 2161 } 2196 2162 2197 2163 err = tp->ops->delete(tp, fh, last, rtnl_held, extack);
+1 -4
net/sched/sch_codel.c
··· 65 65 &q->stats, qdisc_pkt_len, codel_get_enqueue_time, 66 66 drop_func, dequeue_func); 67 67 68 - /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, 69 - * or HTB crashes. Defer it for next round. 70 - */ 71 - if (q->stats.drop_count && sch->q.qlen) { 68 + if (q->stats.drop_count) { 72 69 qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len); 73 70 q->stats.drop_count = 0; 74 71 q->stats.drop_len = 0;
+4 -3
net/sched/sch_drr.c
··· 105 105 return -ENOBUFS; 106 106 107 107 gnet_stats_basic_sync_init(&cl->bstats); 108 + INIT_LIST_HEAD(&cl->alist); 108 109 cl->common.classid = classid; 109 110 cl->quantum = quantum; 110 111 cl->qdisc = qdisc_create_dflt(sch->dev_queue, ··· 230 229 { 231 230 struct drr_class *cl = (struct drr_class *)arg; 232 231 233 - list_del(&cl->alist); 232 + list_del_init(&cl->alist); 234 233 } 235 234 236 235 static int drr_dump_class(struct Qdisc *sch, unsigned long arg, ··· 391 390 if (unlikely(skb == NULL)) 392 391 goto out; 393 392 if (cl->qdisc->q.qlen == 0) 394 - list_del(&cl->alist); 393 + list_del_init(&cl->alist); 395 394 396 395 bstats_update(&cl->bstats, skb); 397 396 qdisc_bstats_update(sch, skb); ··· 432 431 for (i = 0; i < q->clhash.hashsize; i++) { 433 432 hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) { 434 433 if (cl->qdisc->q.qlen) 435 - list_del(&cl->alist); 434 + list_del_init(&cl->alist); 436 435 qdisc_reset(cl->qdisc); 437 436 } 438 437 }
+4 -4
net/sched/sch_ets.c
··· 293 293 * to remove them. 294 294 */ 295 295 if (!ets_class_is_strict(q, cl) && sch->q.qlen) 296 - list_del(&cl->alist); 296 + list_del_init(&cl->alist); 297 297 } 298 298 299 299 static int ets_class_dump(struct Qdisc *sch, unsigned long arg, ··· 488 488 if (unlikely(!skb)) 489 489 goto out; 490 490 if (cl->qdisc->q.qlen == 0) 491 - list_del(&cl->alist); 491 + list_del_init(&cl->alist); 492 492 return ets_qdisc_dequeue_skb(sch, skb); 493 493 } 494 494 ··· 657 657 } 658 658 for (i = q->nbands; i < oldbands; i++) { 659 659 if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) 660 - list_del(&q->classes[i].alist); 660 + list_del_init(&q->classes[i].alist); 661 661 qdisc_tree_flush_backlog(q->classes[i].qdisc); 662 662 } 663 663 WRITE_ONCE(q->nstrict, nstrict); ··· 713 713 714 714 for (band = q->nstrict; band < q->nbands; band++) { 715 715 if (q->classes[band].qdisc->q.qlen) 716 - list_del(&q->classes[band].alist); 716 + list_del_init(&q->classes[band].alist); 717 717 } 718 718 for (band = 0; band < q->nbands; band++) 719 719 qdisc_reset(q->classes[band].qdisc);
+2 -4
net/sched/sch_fq_codel.c
··· 315 315 } 316 316 qdisc_bstats_update(sch, skb); 317 317 flow->deficit -= qdisc_pkt_len(skb); 318 - /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, 319 - * or HTB crashes. Defer it for next round. 320 - */ 321 - if (q->cstats.drop_count && sch->q.qlen) { 318 + 319 + if (q->cstats.drop_count) { 322 320 qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, 323 321 q->cstats.drop_len); 324 322 q->cstats.drop_count = 0;
+6 -2
net/sched/sch_hfsc.c
··· 203 203 static inline void 204 204 eltree_remove(struct hfsc_class *cl) 205 205 { 206 - rb_erase(&cl->el_node, &cl->sched->eligible); 206 + if (!RB_EMPTY_NODE(&cl->el_node)) { 207 + rb_erase(&cl->el_node, &cl->sched->eligible); 208 + RB_CLEAR_NODE(&cl->el_node); 209 + } 207 210 } 208 211 209 212 static inline void ··· 1223 1220 /* vttree is now handled in update_vf() so that update_vf(cl, 0, 0) 1224 1221 * needs to be called explicitly to remove a class from vttree. 1225 1222 */ 1226 - update_vf(cl, 0, 0); 1223 + if (cl->cl_nactive) 1224 + update_vf(cl, 0, 0); 1227 1225 if (cl->cl_flags & HFSC_RSC) 1228 1226 eltree_remove(cl); 1229 1227 }
+2
net/sched/sch_htb.c
··· 1485 1485 { 1486 1486 struct htb_class *cl = (struct htb_class *)arg; 1487 1487 1488 + if (!cl->prio_activity) 1489 + return; 1488 1490 htb_deactivate(qdisc_priv(sch), cl); 1489 1491 } 1490 1492
+5 -2
net/sched/sch_qfq.c
··· 347 347 struct qfq_aggregate *agg = cl->agg; 348 348 349 349 350 - list_del(&cl->alist); /* remove from RR queue of the aggregate */ 350 + list_del_init(&cl->alist); /* remove from RR queue of the aggregate */ 351 351 if (list_empty(&agg->active)) /* agg is now inactive */ 352 352 qfq_deactivate_agg(q, agg); 353 353 } ··· 474 474 gnet_stats_basic_sync_init(&cl->bstats); 475 475 cl->common.classid = classid; 476 476 cl->deficit = lmax; 477 + INIT_LIST_HEAD(&cl->alist); 477 478 478 479 cl->qdisc = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, 479 480 classid, NULL); ··· 983 982 cl->deficit -= (int) len; 984 983 985 984 if (cl->qdisc->q.qlen == 0) /* no more packets, remove from list */ 986 - list_del(&cl->alist); 985 + list_del_init(&cl->alist); 987 986 else if (cl->deficit < qdisc_pkt_len(cl->qdisc->ops->peek(cl->qdisc))) { 988 987 cl->deficit += agg->lmax; 989 988 list_move_tail(&cl->alist, &agg->active); ··· 1416 1415 struct qfq_sched *q = qdisc_priv(sch); 1417 1416 struct qfq_class *cl = (struct qfq_class *)arg; 1418 1417 1418 + if (list_empty(&cl->alist)) 1419 + return; 1419 1420 qfq_deactivate_class(q, cl); 1420 1421 } 1421 1422
+50 -16
net/sched/sch_sfq.c
··· 631 631 struct red_parms *p = NULL; 632 632 struct sk_buff *to_free = NULL; 633 633 struct sk_buff *tail = NULL; 634 + unsigned int maxflows; 635 + unsigned int quantum; 636 + unsigned int divisor; 637 + int perturb_period; 638 + u8 headdrop; 639 + u8 maxdepth; 640 + int limit; 641 + u8 flags; 642 + 634 643 635 644 if (opt->nla_len < nla_attr_size(sizeof(*ctl))) 636 645 return -EINVAL; ··· 661 652 if (!p) 662 653 return -ENOMEM; 663 654 } 664 - if (ctl->limit == 1) { 665 - NL_SET_ERR_MSG_MOD(extack, "invalid limit"); 666 - return -EINVAL; 667 - } 655 + 668 656 sch_tree_lock(sch); 657 + 658 + limit = q->limit; 659 + divisor = q->divisor; 660 + headdrop = q->headdrop; 661 + maxdepth = q->maxdepth; 662 + maxflows = q->maxflows; 663 + perturb_period = q->perturb_period; 664 + quantum = q->quantum; 665 + flags = q->flags; 666 + 667 + /* update and validate configuration */ 669 668 if (ctl->quantum) 670 - q->quantum = ctl->quantum; 671 - WRITE_ONCE(q->perturb_period, ctl->perturb_period * HZ); 669 + quantum = ctl->quantum; 670 + perturb_period = ctl->perturb_period * HZ; 672 671 if (ctl->flows) 673 - q->maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS); 672 + maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS); 674 673 if (ctl->divisor) { 675 - q->divisor = ctl->divisor; 676 - q->maxflows = min_t(u32, q->maxflows, q->divisor); 674 + divisor = ctl->divisor; 675 + maxflows = min_t(u32, maxflows, divisor); 677 676 } 678 677 if (ctl_v1) { 679 678 if (ctl_v1->depth) 680 - q->maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH); 679 + maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH); 681 680 if (p) { 682 - swap(q->red_parms, p); 683 - red_set_parms(q->red_parms, 681 + red_set_parms(p, 684 682 ctl_v1->qth_min, ctl_v1->qth_max, 685 683 ctl_v1->Wlog, 686 684 ctl_v1->Plog, ctl_v1->Scell_log, 687 685 NULL, 688 686 ctl_v1->max_P); 689 687 } 690 - q->flags = ctl_v1->flags; 691 - q->headdrop = ctl_v1->headdrop; 688 + flags = ctl_v1->flags; 689 + headdrop = ctl_v1->headdrop; 692 690 } 693 691 if (ctl->limit) { 694 - q->limit = min_t(u32, ctl->limit, q->maxdepth * q->maxflows); 695 - q->maxflows = min_t(u32, q->maxflows, q->limit); 692 + limit = min_t(u32, ctl->limit, maxdepth * maxflows); 693 + maxflows = min_t(u32, maxflows, limit); 696 694 } 695 + if (limit == 1) { 696 + sch_tree_unlock(sch); 697 + kfree(p); 698 + NL_SET_ERR_MSG_MOD(extack, "invalid limit"); 699 + return -EINVAL; 700 + } 701 + 702 + /* commit configuration */ 703 + q->limit = limit; 704 + q->divisor = divisor; 705 + q->headdrop = headdrop; 706 + q->maxdepth = maxdepth; 707 + q->maxflows = maxflows; 708 + WRITE_ONCE(q->perturb_period, perturb_period); 709 + q->quantum = quantum; 710 + q->flags = flags; 711 + if (p) 712 + swap(q->red_parms, p); 697 713 698 714 qlen = sch->q.qlen; 699 715 while (sch->q.qlen > q->limit) {
+14 -8
net/sctp/socket.c
··· 72 72 /* Forward declarations for internal helper functions. */ 73 73 static bool sctp_writeable(const struct sock *sk); 74 74 static void sctp_wfree(struct sk_buff *skb); 75 - static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, 76 - size_t msg_len); 75 + static int sctp_wait_for_sndbuf(struct sctp_association *asoc, 76 + struct sctp_transport *transport, 77 + long *timeo_p, size_t msg_len); 77 78 static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p); 78 79 static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p); 79 80 static int sctp_wait_for_accept(struct sock *sk, long timeo); ··· 1829 1828 1830 1829 if (sctp_wspace(asoc) <= 0 || !sk_wmem_schedule(sk, msg_len)) { 1831 1830 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1832 - err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); 1831 + err = sctp_wait_for_sndbuf(asoc, transport, &timeo, msg_len); 1833 1832 if (err) 1834 1833 goto err; 1835 1834 if (unlikely(sinfo->sinfo_stream >= asoc->stream.outcnt)) { ··· 9215 9214 9216 9215 9217 9216 /* Helper function to wait for space in the sndbuf. */ 9218 - static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, 9219 - size_t msg_len) 9217 + static int sctp_wait_for_sndbuf(struct sctp_association *asoc, 9218 + struct sctp_transport *transport, 9219 + long *timeo_p, size_t msg_len) 9220 9220 { 9221 9221 struct sock *sk = asoc->base.sk; 9222 9222 long current_timeo = *timeo_p; ··· 9227 9225 pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc, 9228 9226 *timeo_p, msg_len); 9229 9227 9230 - /* Increment the association's refcnt. */ 9228 + /* Increment the transport and association's refcnt. */ 9229 + if (transport) 9230 + sctp_transport_hold(transport); 9231 9231 sctp_association_hold(asoc); 9232 9232 9233 9233 /* Wait on the association specific sndbuf space. */ ··· 9238 9234 TASK_INTERRUPTIBLE); 9239 9235 if (asoc->base.dead) 9240 9236 goto do_dead; 9241 - if (!*timeo_p) 9237 + if ((!*timeo_p) || (transport && transport->dead)) 9242 9238 goto do_nonblock; 9243 9239 if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING) 9244 9240 goto do_error; ··· 9263 9259 out: 9264 9260 finish_wait(&asoc->wait, &wait); 9265 9261 9266 - /* Release the association's refcnt. */ 9262 + /* Release the transport and association's refcnt. */ 9263 + if (transport) 9264 + sctp_transport_put(transport); 9267 9265 sctp_association_put(asoc); 9268 9266 9269 9267 return err;
+2
net/sctp/transport.c
··· 117 117 */ 118 118 void sctp_transport_free(struct sctp_transport *transport) 119 119 { 120 + transport->dead = 1; 121 + 120 122 /* Try to delete the heartbeat timer. */ 121 123 if (timer_delete(&transport->hb_timer)) 122 124 sctp_transport_put(transport);
+1
net/tipc/link.c
··· 1046 1046 if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) { 1047 1047 if (imp == TIPC_SYSTEM_IMPORTANCE) { 1048 1048 pr_warn("%s<%s>, link overflow", link_rst_msg, l->name); 1049 + __skb_queue_purge(list); 1049 1050 return -ENOBUFS; 1050 1051 } 1051 1052 rc = link_schedule_user(l, hdr);
+6
net/tls/tls_main.c
··· 852 852 return do_tls_setsockopt(sk, optname, optval, optlen); 853 853 } 854 854 855 + static int tls_disconnect(struct sock *sk, int flags) 856 + { 857 + return -EOPNOTSUPP; 858 + } 859 + 855 860 struct tls_context *tls_ctx_create(struct sock *sk) 856 861 { 857 862 struct inet_connection_sock *icsk = inet_csk(sk); ··· 952 947 prot[TLS_BASE][TLS_BASE] = *base; 953 948 prot[TLS_BASE][TLS_BASE].setsockopt = tls_setsockopt; 954 949 prot[TLS_BASE][TLS_BASE].getsockopt = tls_getsockopt; 950 + prot[TLS_BASE][TLS_BASE].disconnect = tls_disconnect; 955 951 prot[TLS_BASE][TLS_BASE].close = tls_sk_proto_close; 956 952 957 953 prot[TLS_SW][TLS_BASE] = prot[TLS_BASE][TLS_BASE];
+32 -1
tools/testing/selftests/drivers/net/hds.py
··· 6 6 from lib.py import ksft_run, ksft_exit, ksft_eq, ksft_raises, KsftSkipEx 7 7 from lib.py import CmdExitFailure, EthtoolFamily, NlError 8 8 from lib.py import NetDrvEnv 9 - from lib.py import defer, ethtool, ip 9 + from lib.py import defer, ethtool, ip, random 10 10 11 11 12 12 def _get_hds_mode(cfg, netnl) -> str: ··· 108 108 raise KsftSkipEx('hds-thresh not supported by device') 109 109 110 110 ksft_eq(0, rings['hds-thresh']) 111 + 112 + def set_hds_thresh_random(cfg, netnl) -> None: 113 + try: 114 + rings = netnl.rings_get({'header': {'dev-index': cfg.ifindex}}) 115 + except NlError as e: 116 + raise KsftSkipEx('ring-get not supported by device') 117 + if 'hds-thresh' not in rings: 118 + raise KsftSkipEx('hds-thresh not supported by device') 119 + if 'hds-thresh-max' not in rings: 120 + raise KsftSkipEx('hds-thresh-max not defined by device') 121 + 122 + if rings['hds-thresh-max'] < 2: 123 + raise KsftSkipEx('hds-thresh-max is too small') 124 + elif rings['hds-thresh-max'] == 2: 125 + hds_thresh = 1 126 + else: 127 + while True: 128 + hds_thresh = random.randint(1, rings['hds-thresh-max'] - 1) 129 + if hds_thresh != rings['hds-thresh']: 130 + break 131 + 132 + try: 133 + netnl.rings_set({'header': {'dev-index': cfg.ifindex}, 'hds-thresh': hds_thresh}) 134 + except NlError as e: 135 + if e.error == errno.EINVAL: 136 + raise KsftSkipEx("hds-thresh-set not supported by the device") 137 + elif e.error == errno.EOPNOTSUPP: 138 + raise KsftSkipEx("ring-set not supported by the device") 139 + rings = netnl.rings_get({'header': {'dev-index': cfg.ifindex}}) 140 + ksft_eq(hds_thresh, rings['hds-thresh']) 111 141 112 142 def set_hds_thresh_max(cfg, netnl) -> None: 113 143 try: ··· 273 243 get_hds_thresh, 274 244 set_hds_disable, 275 245 set_hds_enable, 246 + set_hds_thresh_random, 276 247 set_hds_thresh_zero, 277 248 set_hds_thresh_max, 278 249 set_hds_thresh_gt,
+18
tools/testing/selftests/net/mptcp/mptcp_join.sh
··· 1441 1441 fi 1442 1442 fi 1443 1443 1444 + count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckHMacFailure") 1445 + if [ -z "$count" ]; then 1446 + rc=${KSFT_SKIP} 1447 + elif [ "$count" != "0" ]; then 1448 + rc=${KSFT_FAIL} 1449 + print_check "synack HMAC" 1450 + fail_test "got $count JOIN[s] synack HMAC failure expected 0" 1451 + fi 1452 + 1444 1453 count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx") 1445 1454 if [ -z "$count" ]; then 1446 1455 rc=${KSFT_SKIP} ··· 1457 1448 rc=${KSFT_FAIL} 1458 1449 print_check "ack rx" 1459 1450 fail_test "got $count JOIN[s] ack rx expected $ack_nr" 1451 + fi 1452 + 1453 + count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckHMacFailure") 1454 + if [ -z "$count" ]; then 1455 + rc=${KSFT_SKIP} 1456 + elif [ "$count" != "0" ]; then 1457 + rc=${KSFT_FAIL} 1458 + print_check "ack HMAC" 1459 + fail_test "got $count JOIN[s] ack HMAC failure expected 0" 1460 1460 fi 1461 1461 1462 1462 print_results "join Rx" ${rc}
+38 -1
tools/testing/selftests/net/netfilter/nft_concat_range.sh
··· 27 27 net6_port_net6_port net_port_mac_proto_net" 28 28 29 29 # Reported bugs, also described by TYPE_ variables below 30 - BUGS="flush_remove_add reload net_port_proto_match" 30 + BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch" 31 31 32 32 # List of possible paths to pktgen script from kernel tree for performance tests 33 33 PKTGEN_SCRIPT_PATHS=" ··· 387 387 388 388 perf_duration 0 389 389 " 390 + 391 + TYPE_avx2_mismatch=" 392 + display avx2 false match 393 + type_spec inet_proto . ipv6_addr 394 + chain_spec meta l4proto . ip6 daddr 395 + dst proto addr6 396 + src 397 + start 1 398 + count 1 399 + src_delta 1 400 + tools ping 401 + proto icmp6 402 + 403 + race_repeat 0 404 + 405 + perf_duration 0 406 + " 407 + 408 + 390 409 # Set template for all tests, types and rules are filled in depending on test 391 410 set_template=' 392 411 flush ruleset ··· 1646 1627 done 1647 1628 1648 1629 nft flush ruleset 1630 + } 1631 + 1632 + test_bug_avx2_mismatch() 1633 + { 1634 + setup veth send_"${proto}" set || return ${ksft_skip} 1635 + 1636 + local a1="fe80:dead:01ff:0a02:0b03:6007:8009:a001" 1637 + local a2="fe80:dead:01fe:0a02:0b03:6007:8009:a001" 1638 + 1639 + nft "add element inet filter test { icmpv6 . $a1 }" 1640 + 1641 + dst_addr6="$a2" 1642 + send_icmp6 1643 + 1644 + if [ "$(count_packets)" -gt "0" ]; then 1645 + err "False match for $a2" 1646 + return 1 1647 + fi 1649 1648 } 1650 1649 1651 1650 test_reported_issues() {
+36
tools/testing/selftests/net/tls.c
··· 1753 1753 EXPECT_EQ(memcmp(buf, test_str, send_len), 0); 1754 1754 } 1755 1755 1756 + TEST_F(tls_basic, disconnect) 1757 + { 1758 + char const *test_str = "test_message"; 1759 + int send_len = strlen(test_str) + 1; 1760 + struct tls_crypto_info_keys key; 1761 + struct sockaddr_in addr; 1762 + char buf[20]; 1763 + int ret; 1764 + 1765 + if (self->notls) 1766 + return; 1767 + 1768 + tls_crypto_info_init(TLS_1_3_VERSION, TLS_CIPHER_AES_GCM_128, 1769 + &key, 0); 1770 + 1771 + ret = setsockopt(self->fd, SOL_TLS, TLS_TX, &key, key.len); 1772 + ASSERT_EQ(ret, 0); 1773 + 1774 + /* Pre-queue the data so that setsockopt parses it but doesn't 1775 + * dequeue it from the TCP socket. recvmsg would dequeue. 1776 + */ 1777 + EXPECT_EQ(send(self->fd, test_str, send_len, 0), send_len); 1778 + 1779 + ret = setsockopt(self->cfd, SOL_TLS, TLS_RX, &key, key.len); 1780 + ASSERT_EQ(ret, 0); 1781 + 1782 + addr.sin_family = AF_UNSPEC; 1783 + addr.sin_addr.s_addr = htonl(INADDR_ANY); 1784 + addr.sin_port = 0; 1785 + ret = connect(self->cfd, &addr, sizeof(addr)); 1786 + EXPECT_EQ(ret, -1); 1787 + EXPECT_EQ(errno, EOPNOTSUPP); 1788 + 1789 + EXPECT_EQ(recv(self->cfd, buf, send_len, 0), send_len); 1790 + } 1791 + 1756 1792 TEST_F(tls, rekey) 1757 1793 { 1758 1794 char const *test_str_1 = "test_message_before_rekey";
+155
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
··· 158 158 "$TC qdisc del dev $DUMMY handle 1: root", 159 159 "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 160 160 ] 161 + }, 162 + { 163 + "id": "a4bb", 164 + "name": "Test FQ_CODEL with HTB parent - force packet drop with empty queue", 165 + "category": [ 166 + "qdisc", 167 + "fq_codel", 168 + "htb" 169 + ], 170 + "plugins": { 171 + "requires": "nsPlugin" 172 + }, 173 + "setup": [ 174 + "$IP link set dev $DUMMY up || true", 175 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 176 + "$TC qdisc add dev $DUMMY handle 1: root htb default 10", 177 + "$TC class add dev $DUMMY parent 1: classid 1:10 htb rate 1kbit", 178 + "$TC qdisc add dev $DUMMY parent 1:10 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms", 179 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:10", 180 + "ping -c 5 -f -I $DUMMY 10.10.10.1 > /dev/null || true", 181 + "sleep 0.1" 182 + ], 183 + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", 184 + "expExitCode": "0", 185 + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc fq_codel'", 186 + "matchPattern": "dropped [1-9][0-9]*", 187 + "matchCount": "1", 188 + "teardown": [ 189 + "$TC qdisc del dev $DUMMY handle 1: root", 190 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 191 + ] 192 + }, 193 + { 194 + "id": "a4be", 195 + "name": "Test FQ_CODEL with QFQ parent - force packet drop with empty queue", 196 + "category": [ 197 + "qdisc", 198 + "fq_codel", 199 + "qfq" 200 + ], 201 + "plugins": { 202 + "requires": "nsPlugin" 203 + }, 204 + "setup": [ 205 + "$IP link set dev $DUMMY up || true", 206 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 207 + "$TC qdisc add dev $DUMMY handle 1: root qfq", 208 + "$TC class add dev $DUMMY parent 1: classid 1:10 qfq weight 1 maxpkt 1000", 209 + "$TC qdisc add dev $DUMMY parent 1:10 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms", 210 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:10", 211 + "ping -c 10 -s 1000 -f -I $DUMMY 10.10.10.1 > /dev/null || true", 212 + "sleep 0.1" 213 + ], 214 + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", 215 + "expExitCode": "0", 216 + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc fq_codel'", 217 + "matchPattern": "dropped [1-9][0-9]*", 218 + "matchCount": "1", 219 + "teardown": [ 220 + "$TC qdisc del dev $DUMMY handle 1: root", 221 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 222 + ] 223 + }, 224 + { 225 + "id": "a4bf", 226 + "name": "Test FQ_CODEL with HFSC parent - force packet drop with empty queue", 227 + "category": [ 228 + "qdisc", 229 + "fq_codel", 230 + "hfsc" 231 + ], 232 + "plugins": { 233 + "requires": "nsPlugin" 234 + }, 235 + "setup": [ 236 + "$IP link set dev $DUMMY up || true", 237 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 238 + "$TC qdisc add dev $DUMMY handle 1: root hfsc default 10", 239 + "$TC class add dev $DUMMY parent 1: classid 1:10 hfsc sc rate 1kbit ul rate 1kbit", 240 + "$TC qdisc add dev $DUMMY parent 1:10 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms", 241 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:10", 242 + "ping -c 5 -f -I $DUMMY 10.10.10.1 > /dev/null || true", 243 + "sleep 0.1" 244 + ], 245 + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", 246 + "expExitCode": "0", 247 + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc fq_codel'", 248 + "matchPattern": "dropped [1-9][0-9]*", 249 + "matchCount": "1", 250 + "teardown": [ 251 + "$TC qdisc del dev $DUMMY handle 1: root", 252 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 253 + ] 254 + }, 255 + { 256 + "id": "a4c0", 257 + "name": "Test FQ_CODEL with DRR parent - force packet drop with empty queue", 258 + "category": [ 259 + "qdisc", 260 + "fq_codel", 261 + "drr" 262 + ], 263 + "plugins": { 264 + "requires": "nsPlugin" 265 + }, 266 + "setup": [ 267 + "$IP link set dev $DUMMY up || true", 268 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 269 + "$TC qdisc add dev $DUMMY handle 1: root drr", 270 + "$TC class add dev $DUMMY parent 1: classid 1:10 drr quantum 1500", 271 + "$TC qdisc add dev $DUMMY parent 1:10 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms", 272 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:10", 273 + "ping -c 5 -f -I $DUMMY 10.10.10.1 > /dev/null || true", 274 + "sleep 0.1" 275 + ], 276 + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", 277 + "expExitCode": "0", 278 + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc fq_codel'", 279 + "matchPattern": "dropped [1-9][0-9]*", 280 + "matchCount": "1", 281 + "teardown": [ 282 + "$TC qdisc del dev $DUMMY handle 1: root", 283 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 284 + ] 285 + }, 286 + { 287 + "id": "a4c1", 288 + "name": "Test FQ_CODEL with ETS parent - force packet drop with empty queue", 289 + "category": [ 290 + "qdisc", 291 + "fq_codel", 292 + "ets" 293 + ], 294 + "plugins": { 295 + "requires": "nsPlugin" 296 + }, 297 + "setup": [ 298 + "$IP link set dev $DUMMY up || true", 299 + "$IP addr add 10.10.10.10/24 dev $DUMMY || true", 300 + "$TC qdisc add dev $DUMMY handle 1: root ets bands 2 strict 1", 301 + "$TC class change dev $DUMMY parent 1: classid 1:1 ets", 302 + "$TC qdisc add dev $DUMMY parent 1:1 handle 10: fq_codel memory_limit 1 flows 1 target 0.1ms interval 1ms", 303 + "$TC filter add dev $DUMMY parent 1: protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:1", 304 + "ping -c 5 -f -I $DUMMY 10.10.10.1 > /dev/null || true", 305 + "sleep 0.1" 306 + ], 307 + "cmdUnderTest": "$TC -s qdisc show dev $DUMMY", 308 + "expExitCode": "0", 309 + "verifyCmd": "$TC -s qdisc show dev $DUMMY | grep -A 5 'qdisc fq_codel'", 310 + "matchPattern": "dropped [1-9][0-9]*", 311 + "matchCount": "1", 312 + "teardown": [ 313 + "$TC qdisc del dev $DUMMY handle 1: root", 314 + "$IP addr del 10.10.10.10/24 dev $DUMMY || true" 315 + ] 161 316 } 162 317 ]
+36
tools/testing/selftests/tc-testing/tc-tests/qdiscs/sfq.json
··· 228 228 "matchCount": "0", 229 229 "teardown": [ 230 230 ] 231 + }, 232 + { 233 + "id": "7f8f", 234 + "name": "Check that a derived limit of 1 is rejected (limit 2 depth 1 flows 1)", 235 + "category": [ 236 + "qdisc", 237 + "sfq" 238 + ], 239 + "plugins": { 240 + "requires": "nsPlugin" 241 + }, 242 + "setup": [], 243 + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root sfq limit 2 depth 1 flows 1", 244 + "expExitCode": "2", 245 + "verifyCmd": "$TC qdisc show dev $DUMMY", 246 + "matchPattern": "sfq", 247 + "matchCount": "0", 248 + "teardown": [] 249 + }, 250 + { 251 + "id": "5168", 252 + "name": "Check that a derived limit of 1 is rejected (limit 2 depth 1 divisor 1)", 253 + "category": [ 254 + "qdisc", 255 + "sfq" 256 + ], 257 + "plugins": { 258 + "requires": "nsPlugin" 259 + }, 260 + "setup": [], 261 + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root sfq limit 2 depth 1 divisor 1", 262 + "expExitCode": "2", 263 + "verifyCmd": "$TC qdisc show dev $DUMMY", 264 + "matchPattern": "sfq", 265 + "matchCount": "0", 266 + "teardown": [] 231 267 } 232 268 ]