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.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Paolo Abeni:
"Quite smaller than usual. Notably it includes the fix for the unix
regression from the past weeks. The TCP window fix will require some
follow-up, already queued.

Current release - regressions:

- af_unix: fix garbage collection of embryos

Previous releases - regressions:

- af_unix: fix race between GC and receive path

- ipv6: sr: fix missing sk_buff release in seg6_input_core

- tcp: remove 64 KByte limit for initial tp->rcv_wnd value

- eth: r8169: fix rx hangup

- eth: lan966x: remove ptp traps in case the ptp is not enabled

- eth: ixgbe: fix link breakage vs cisco switches

- eth: ice: prevent ethtool from corrupting the channels

Previous releases - always broken:

- openvswitch: set the skbuff pkt_type for proper pmtud support

- tcp: Fix shift-out-of-bounds in dctcp_update_alpha()

Misc:

- a bunch of selftests stabilization patches"

* tag 'net-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (25 commits)
r8169: Fix possible ring buffer corruption on fragmented Tx packets.
idpf: Interpret .set_channels() input differently
ice: Interpret .set_channels() input differently
nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
net: relax socket state check at accept time.
tcp: remove 64 KByte limit for initial tp->rcv_wnd value
net: ti: icssg_prueth: Fix NULL pointer dereference in prueth_probe()
tls: fix missing memory barrier in tls_init
net: fec: avoid lock evasion when reading pps_enable
Revert "ixgbe: Manual AN-37 for troublesome link partners for X550 SFI"
testing: net-drv: use stats64 for testing
net: mana: Fix the extra HZ in mana_hwc_send_request
net: lan966x: Remove ptp traps in case the ptp is not enabled.
openvswitch: Set the skbuff pkt_type for proper pmtud support.
selftest: af_unix: Make SCM_RIGHTS into OOB data.
af_unix: Fix garbage collection of embryos carrying OOB with SCM_RIGHTS
tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
selftests/net: use tc rule to filter the na packet
ipv6: sr: fix memleak in seg6_hmac_init_algo
af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
...

+243 -245
+3 -1
drivers/net/Makefile
··· 49 49 obj-$(CONFIG_ARCNET) += arcnet/ 50 50 obj-$(CONFIG_CAIF) += caif/ 51 51 obj-$(CONFIG_CAN) += can/ 52 - obj-$(CONFIG_NET_DSA) += dsa/ 52 + ifdef CONFIG_NET_DSA 53 + obj-y += dsa/ 54 + endif 53 55 obj-$(CONFIG_ETHERNET) += ethernet/ 54 56 obj-$(CONFIG_FDDI) += fddi/ 55 57 obj-$(CONFIG_HIPPI) += hippi/
+8 -6
drivers/net/ethernet/freescale/fec_ptp.c
··· 104 104 struct timespec64 ts; 105 105 u64 ns; 106 106 107 - if (fep->pps_enable == enable) 108 - return 0; 109 - 110 - fep->pps_channel = DEFAULT_PPS_CHANNEL; 111 - fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; 112 - 113 107 spin_lock_irqsave(&fep->tmreg_lock, flags); 108 + 109 + if (fep->pps_enable == enable) { 110 + spin_unlock_irqrestore(&fep->tmreg_lock, flags); 111 + return 0; 112 + } 114 113 115 114 if (enable) { 116 115 /* clear capture or output compare interrupt status if have. ··· 531 532 int ret = 0; 532 533 533 534 if (rq->type == PTP_CLK_REQ_PPS) { 535 + fep->pps_channel = DEFAULT_PPS_CHANNEL; 536 + fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; 537 + 534 538 ret = fec_ptp_enable_pps(fep, on); 535 539 536 540 return ret;
+2 -17
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 3593 3593 struct ice_pf *pf = vsi->back; 3594 3594 int new_rx = 0, new_tx = 0; 3595 3595 bool locked = false; 3596 - u32 curr_combined; 3597 3596 int ret = 0; 3598 3597 3599 3598 /* do not support changing channels in Safe Mode */ ··· 3614 3615 return -EOPNOTSUPP; 3615 3616 } 3616 3617 3617 - curr_combined = ice_get_combined_cnt(vsi); 3618 - 3619 - /* these checks are for cases where user didn't specify a particular 3620 - * value on cmd line but we get non-zero value anyway via 3621 - * get_channels(); look at ethtool.c in ethtool repository (the user 3622 - * space part), particularly, do_schannels() routine 3623 - */ 3624 - if (ch->rx_count == vsi->num_rxq - curr_combined) 3625 - ch->rx_count = 0; 3626 - if (ch->tx_count == vsi->num_txq - curr_combined) 3627 - ch->tx_count = 0; 3628 - if (ch->combined_count == curr_combined) 3629 - ch->combined_count = 0; 3630 - 3631 - if (!(ch->combined_count || (ch->rx_count && ch->tx_count))) { 3632 - netdev_err(dev, "Please specify at least 1 Rx and 1 Tx channel\n"); 3618 + if (ch->rx_count && ch->tx_count) { 3619 + netdev_err(dev, "Dedicated RX or TX channels cannot be used simultaneously\n"); 3633 3620 return -EINVAL; 3634 3621 } 3635 3622
+6 -15
drivers/net/ethernet/intel/idpf/idpf_ethtool.c
··· 222 222 struct ethtool_channels *ch) 223 223 { 224 224 struct idpf_vport_config *vport_config; 225 - u16 combined, num_txq, num_rxq; 226 225 unsigned int num_req_tx_q; 227 226 unsigned int num_req_rx_q; 228 227 struct idpf_vport *vport; 228 + u16 num_txq, num_rxq; 229 229 struct device *dev; 230 230 int err = 0; 231 231 u16 idx; 232 + 233 + if (ch->rx_count && ch->tx_count) { 234 + netdev_err(netdev, "Dedicated RX or TX channels cannot be used simultaneously\n"); 235 + return -EINVAL; 236 + } 232 237 233 238 idpf_vport_ctrl_lock(netdev); 234 239 vport = idpf_netdev_to_vport(netdev); ··· 243 238 244 239 num_txq = vport_config->user_config.num_req_tx_qs; 245 240 num_rxq = vport_config->user_config.num_req_rx_qs; 246 - 247 - combined = min(num_txq, num_rxq); 248 - 249 - /* these checks are for cases where user didn't specify a particular 250 - * value on cmd line but we get non-zero value anyway via 251 - * get_channels(); look at ethtool.c in ethtool repository (the user 252 - * space part), particularly, do_schannels() routine 253 - */ 254 - if (ch->combined_count == combined) 255 - ch->combined_count = 0; 256 - if (ch->combined_count && ch->rx_count == num_rxq - combined) 257 - ch->rx_count = 0; 258 - if (ch->combined_count && ch->tx_count == num_txq - combined) 259 - ch->tx_count = 0; 260 241 261 242 num_req_tx_q = ch->combined_count + ch->tx_count; 262 243 num_req_rx_q = ch->combined_count + ch->rx_count;
-3
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
··· 3675 3675 #define IXGBE_KRM_LINK_S1(P) ((P) ? 0x8200 : 0x4200) 3676 3676 #define IXGBE_KRM_LINK_CTRL_1(P) ((P) ? 0x820C : 0x420C) 3677 3677 #define IXGBE_KRM_AN_CNTL_1(P) ((P) ? 0x822C : 0x422C) 3678 - #define IXGBE_KRM_AN_CNTL_4(P) ((P) ? 0x8238 : 0x4238) 3679 3678 #define IXGBE_KRM_AN_CNTL_8(P) ((P) ? 0x8248 : 0x4248) 3680 - #define IXGBE_KRM_PCS_KX_AN(P) ((P) ? 0x9918 : 0x5918) 3681 3679 #define IXGBE_KRM_SGMII_CTRL(P) ((P) ? 0x82A0 : 0x42A0) 3682 3680 #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P) ((P) ? 0x836C : 0x436C) 3683 3681 #define IXGBE_KRM_DSP_TXFFE_STATE_4(P) ((P) ? 0x8634 : 0x4634) ··· 3685 3687 #define IXGBE_KRM_PMD_FLX_MASK_ST20(P) ((P) ? 0x9054 : 0x5054) 3686 3688 #define IXGBE_KRM_TX_COEFF_CTRL_1(P) ((P) ? 0x9520 : 0x5520) 3687 3689 #define IXGBE_KRM_RX_ANA_CTL(P) ((P) ? 0x9A00 : 0x5A00) 3688 - #define IXGBE_KRM_FLX_TMRS_CTRL_ST31(P) ((P) ? 0x9180 : 0x5180) 3689 3690 3690 3691 #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA ~(0x3 << 20) 3691 3692 #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR BIT(20)
+3 -53
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
··· 1722 1722 return -EINVAL; 1723 1723 } 1724 1724 1725 - (void)mac->ops.write_iosf_sb_reg(hw, 1726 - IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), 1727 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1728 - 1729 - /* change mode enforcement rules to hybrid */ 1730 - (void)mac->ops.read_iosf_sb_reg(hw, 1731 - IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id), 1732 - IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val); 1733 - reg_val |= 0x0400; 1734 - 1735 - (void)mac->ops.write_iosf_sb_reg(hw, 1736 - IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id), 1737 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1738 - 1739 - /* manually control the config */ 1740 - (void)mac->ops.read_iosf_sb_reg(hw, 1741 - IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), 1742 - IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val); 1743 - reg_val |= 0x20002240; 1744 - 1745 - (void)mac->ops.write_iosf_sb_reg(hw, 1746 - IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), 1747 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1748 - 1749 - /* move the AN base page values */ 1750 - (void)mac->ops.read_iosf_sb_reg(hw, 1751 - IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id), 1752 - IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val); 1753 - reg_val |= 0x1; 1754 - 1755 - (void)mac->ops.write_iosf_sb_reg(hw, 1756 - IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id), 1757 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1758 - 1759 - /* set the AN37 over CB mode */ 1760 - (void)mac->ops.read_iosf_sb_reg(hw, 1761 - IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id), 1762 - IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val); 1763 - reg_val |= 0x20000000; 1764 - 1765 - (void)mac->ops.write_iosf_sb_reg(hw, 1766 - IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id), 1767 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1768 - 1769 - /* restart AN manually */ 1770 - (void)mac->ops.read_iosf_sb_reg(hw, 1771 - IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), 1772 - IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val); 1773 - reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART; 1774 - 1775 - (void)mac->ops.write_iosf_sb_reg(hw, 1776 - IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id), 1777 - IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1725 + status = mac->ops.write_iosf_sb_reg(hw, 1726 + IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id), 1727 + IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val); 1778 1728 1779 1729 /* Toggle port SW reset by AN reset. */ 1780 1730 status = ixgbe_restart_an_internal_phy_x550em(hw);
+3 -3
drivers/net/ethernet/microchip/lan966x/lan966x_main.c
··· 474 474 cfg->source != HWTSTAMP_SOURCE_PHYLIB) 475 475 return -EOPNOTSUPP; 476 476 477 + if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp) 478 + return -EOPNOTSUPP; 479 + 477 480 err = lan966x_ptp_setup_traps(port, cfg); 478 481 if (err) 479 482 return err; 480 483 481 484 if (cfg->source == HWTSTAMP_SOURCE_NETDEV) { 482 - if (!port->lan966x->ptp) 483 - return -EOPNOTSUPP; 484 - 485 485 err = lan966x_ptp_hwtstamp_set(port, cfg, extack); 486 486 if (err) { 487 487 lan966x_ptp_del_traps(port);
+1 -1
drivers/net/ethernet/microsoft/mana/hw_channel.c
··· 849 849 } 850 850 851 851 if (!wait_for_completion_timeout(&ctx->comp_event, 852 - (msecs_to_jiffies(hwc->hwc_timeout) * HZ))) { 852 + (msecs_to_jiffies(hwc->hwc_timeout)))) { 853 853 dev_err(hwc->dev, "HWC: Request timed out!\n"); 854 854 err = -ETIMEDOUT; 855 855 goto out;
+4 -5
drivers/net/ethernet/realtek/r8169_main.c
··· 4337 4337 static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, 4338 4338 struct net_device *dev) 4339 4339 { 4340 - unsigned int frags = skb_shinfo(skb)->nr_frags; 4341 4340 struct rtl8169_private *tp = netdev_priv(dev); 4342 4341 unsigned int entry = tp->cur_tx % NUM_TX_DESC; 4343 4342 struct TxDesc *txd_first, *txd_last; 4344 4343 bool stop_queue, door_bell; 4344 + unsigned int frags; 4345 4345 u32 opts[2]; 4346 4346 4347 4347 if (unlikely(!rtl_tx_slots_avail(tp))) { ··· 4364 4364 4365 4365 txd_first = tp->TxDescArray + entry; 4366 4366 4367 + frags = skb_shinfo(skb)->nr_frags; 4367 4368 if (frags) { 4368 4369 if (rtl8169_xmit_frags(tp, skb, opts, entry)) 4369 4370 goto err_dma_1; ··· 4658 4657 rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); 4659 4658 } 4660 4659 4661 - if (napi_schedule_prep(&tp->napi)) { 4662 - rtl_irq_disable(tp); 4663 - __napi_schedule(&tp->napi); 4664 - } 4660 + rtl_irq_disable(tp); 4661 + napi_schedule(&tp->napi); 4665 4662 out: 4666 4663 rtl_ack_events(tp, status); 4667 4664
+12 -2
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 1039 1039 1040 1040 prueth->registered_netdevs[PRUETH_MAC0] = prueth->emac[PRUETH_MAC0]->ndev; 1041 1041 1042 - emac_phy_connect(prueth->emac[PRUETH_MAC0]); 1042 + ret = emac_phy_connect(prueth->emac[PRUETH_MAC0]); 1043 + if (ret) { 1044 + dev_err(dev, 1045 + "can't connect to MII0 PHY, error -%d", ret); 1046 + goto netdev_unregister; 1047 + } 1043 1048 phy_attached_info(prueth->emac[PRUETH_MAC0]->ndev->phydev); 1044 1049 } 1045 1050 ··· 1056 1051 } 1057 1052 1058 1053 prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; 1059 - emac_phy_connect(prueth->emac[PRUETH_MAC1]); 1054 + ret = emac_phy_connect(prueth->emac[PRUETH_MAC1]); 1055 + if (ret) { 1056 + dev_err(dev, 1057 + "can't connect to MII1 PHY, error %d", ret); 1058 + goto netdev_unregister; 1059 + } 1060 1060 phy_attached_info(prueth->emac[PRUETH_MAC1]->ndev->phydev); 1061 1061 } 1062 1062
+3 -1
net/ipv4/af_inet.c
··· 758 758 sock_rps_record_flow(newsk); 759 759 WARN_ON(!((1 << newsk->sk_state) & 760 760 (TCPF_ESTABLISHED | TCPF_SYN_RECV | 761 - TCPF_CLOSE_WAIT | TCPF_CLOSE))); 761 + TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | 762 + TCPF_CLOSING | TCPF_CLOSE_WAIT | 763 + TCPF_CLOSE))); 762 764 763 765 if (test_bit(SOCK_SUPPORT_ZC, &sock->flags)) 764 766 set_bit(SOCK_SUPPORT_ZC, &newsock->flags);
+12 -1
net/ipv4/tcp_dctcp.c
··· 58 58 }; 59 59 60 60 static unsigned int dctcp_shift_g __read_mostly = 4; /* g = 1/2^4 */ 61 - module_param(dctcp_shift_g, uint, 0644); 61 + 62 + static int dctcp_shift_g_set(const char *val, const struct kernel_param *kp) 63 + { 64 + return param_set_uint_minmax(val, kp, 0, 10); 65 + } 66 + 67 + static const struct kernel_param_ops dctcp_shift_g_ops = { 68 + .set = dctcp_shift_g_set, 69 + .get = param_get_uint, 70 + }; 71 + 72 + module_param_cb(dctcp_shift_g, &dctcp_shift_g_ops, &dctcp_shift_g, 0644); 62 73 MODULE_PARM_DESC(dctcp_shift_g, "parameter g for updating dctcp_alpha"); 63 74 64 75 static unsigned int dctcp_alpha_on_init __read_mostly = DCTCP_MAX_ALPHA;
+1 -1
net/ipv4/tcp_output.c
··· 232 232 if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)) 233 233 (*rcv_wnd) = min(space, MAX_TCP_WINDOW); 234 234 else 235 - (*rcv_wnd) = min_t(u32, space, U16_MAX); 235 + (*rcv_wnd) = space; 236 236 237 237 if (init_rcv_wnd) 238 238 *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
+28 -14
net/ipv6/seg6_hmac.c
··· 356 356 struct crypto_shash *tfm; 357 357 struct shash_desc *shash; 358 358 int i, alg_count, cpu; 359 + int ret = -ENOMEM; 359 360 360 361 alg_count = ARRAY_SIZE(hmac_algos); 361 362 ··· 367 366 algo = &hmac_algos[i]; 368 367 algo->tfms = alloc_percpu(struct crypto_shash *); 369 368 if (!algo->tfms) 370 - return -ENOMEM; 369 + goto error_out; 371 370 372 371 for_each_possible_cpu(cpu) { 373 372 tfm = crypto_alloc_shash(algo->name, 0, 0); 374 - if (IS_ERR(tfm)) 375 - return PTR_ERR(tfm); 373 + if (IS_ERR(tfm)) { 374 + ret = PTR_ERR(tfm); 375 + goto error_out; 376 + } 376 377 p_tfm = per_cpu_ptr(algo->tfms, cpu); 377 378 *p_tfm = tfm; 378 379 } ··· 386 383 387 384 algo->shashs = alloc_percpu(struct shash_desc *); 388 385 if (!algo->shashs) 389 - return -ENOMEM; 386 + goto error_out; 390 387 391 388 for_each_possible_cpu(cpu) { 392 389 shash = kzalloc_node(shsize, GFP_KERNEL, 393 390 cpu_to_node(cpu)); 394 391 if (!shash) 395 - return -ENOMEM; 392 + goto error_out; 396 393 *per_cpu_ptr(algo->shashs, cpu) = shash; 397 394 } 398 395 } 399 396 400 397 return 0; 398 + 399 + error_out: 400 + seg6_hmac_exit(); 401 + return ret; 401 402 } 402 403 403 404 int __init seg6_hmac_init(void) ··· 419 412 void seg6_hmac_exit(void) 420 413 { 421 414 struct seg6_hmac_algo *algo = NULL; 415 + struct crypto_shash *tfm; 416 + struct shash_desc *shash; 422 417 int i, alg_count, cpu; 423 418 424 419 alg_count = ARRAY_SIZE(hmac_algos); 425 420 for (i = 0; i < alg_count; i++) { 426 421 algo = &hmac_algos[i]; 427 - for_each_possible_cpu(cpu) { 428 - struct crypto_shash *tfm; 429 - struct shash_desc *shash; 430 422 431 - shash = *per_cpu_ptr(algo->shashs, cpu); 432 - kfree(shash); 433 - tfm = *per_cpu_ptr(algo->tfms, cpu); 434 - crypto_free_shash(tfm); 423 + if (algo->shashs) { 424 + for_each_possible_cpu(cpu) { 425 + shash = *per_cpu_ptr(algo->shashs, cpu); 426 + kfree(shash); 427 + } 428 + free_percpu(algo->shashs); 435 429 } 436 - free_percpu(algo->tfms); 437 - free_percpu(algo->shashs); 430 + 431 + if (algo->tfms) { 432 + for_each_possible_cpu(cpu) { 433 + tfm = *per_cpu_ptr(algo->tfms, cpu); 434 + crypto_free_shash(tfm); 435 + } 436 + free_percpu(algo->tfms); 437 + } 438 438 } 439 439 } 440 440 EXPORT_SYMBOL(seg6_hmac_exit);
+6 -5
net/ipv6/seg6_iptunnel.c
··· 459 459 int err; 460 460 461 461 err = seg6_do_srh(skb); 462 - if (unlikely(err)) { 463 - kfree_skb(skb); 464 - return err; 465 - } 462 + if (unlikely(err)) 463 + goto drop; 466 464 467 465 slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate); 468 466 ··· 484 486 485 487 err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev)); 486 488 if (unlikely(err)) 487 - return err; 489 + goto drop; 488 490 489 491 if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled)) 490 492 return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, ··· 492 494 skb_dst(skb)->dev, seg6_input_finish); 493 495 494 496 return seg6_input_finish(dev_net(skb->dev), NULL, skb); 497 + drop: 498 + kfree_skb(skb); 499 + return err; 495 500 } 496 501 497 502 static int seg6_input_nf(struct sk_buff *skb)
+15 -3
net/nfc/nci/core.c
··· 1463 1463 ndev->ops->n_core_ops); 1464 1464 } 1465 1465 1466 + static bool nci_valid_size(struct sk_buff *skb) 1467 + { 1468 + BUILD_BUG_ON(NCI_CTRL_HDR_SIZE != NCI_DATA_HDR_SIZE); 1469 + unsigned int hdr_size = NCI_CTRL_HDR_SIZE; 1470 + 1471 + if (skb->len < hdr_size || 1472 + !nci_plen(skb->data) || 1473 + skb->len < hdr_size + nci_plen(skb->data)) { 1474 + return false; 1475 + } 1476 + return true; 1477 + } 1478 + 1466 1479 /* ---- NCI TX Data worker thread ---- */ 1467 1480 1468 1481 static void nci_tx_work(struct work_struct *work) ··· 1529 1516 nfc_send_to_raw_sock(ndev->nfc_dev, skb, 1530 1517 RAW_PAYLOAD_NCI, NFC_DIRECTION_RX); 1531 1518 1532 - if (!nci_plen(skb->data)) { 1519 + if (!nci_valid_size(skb)) { 1533 1520 kfree_skb(skb); 1534 - kcov_remote_stop(); 1535 - break; 1521 + continue; 1536 1522 } 1537 1523 1538 1524 /* Process frame */
+6
net/openvswitch/actions.c
··· 936 936 pskb_trim(skb, ovs_mac_header_len(key)); 937 937 } 938 938 939 + /* Need to set the pkt_type to involve the routing layer. The 940 + * packet movement through the OVS datapath doesn't generally 941 + * use routing, but this is needed for tunnel cases. 942 + */ 943 + skb->pkt_type = PACKET_OUTGOING; 944 + 939 945 if (likely(!mru || 940 946 (skb->len <= mru + vport->dev->hard_header_len))) { 941 947 ovs_vport_send(vport, skb, ovs_key_mac_proto(key));
+9 -1
net/tls/tls_main.c
··· 816 816 return NULL; 817 817 818 818 mutex_init(&ctx->tx_lock); 819 - rcu_assign_pointer(icsk->icsk_ulp_data, ctx); 820 819 ctx->sk_proto = READ_ONCE(sk->sk_prot); 821 820 ctx->sk = sk; 821 + /* Release semantic of rcu_assign_pointer() ensures that 822 + * ctx->sk_proto is visible before changing sk->sk_prot in 823 + * update_sk_prot(), and prevents reading uninitialized value in 824 + * tls_{getsockopt, setsockopt}. Note that we do not need a 825 + * read barrier in tls_{getsockopt,setsockopt} as there is an 826 + * address dependency between sk->sk_proto->{getsockopt,setsockopt} 827 + * and ctx->sk_proto. 828 + */ 829 + rcu_assign_pointer(icsk->icsk_ulp_data, ctx); 822 830 return ctx; 823 831 } 824 832
+22 -6
net/unix/af_unix.c
··· 2170 2170 maybe_add_creds(skb, sock, other); 2171 2171 skb_get(skb); 2172 2172 2173 + scm_stat_add(other, skb); 2174 + 2175 + spin_lock(&other->sk_receive_queue.lock); 2173 2176 if (ousk->oob_skb) 2174 2177 consume_skb(ousk->oob_skb); 2175 - 2176 2178 WRITE_ONCE(ousk->oob_skb, skb); 2179 + __skb_queue_tail(&other->sk_receive_queue, skb); 2180 + spin_unlock(&other->sk_receive_queue.lock); 2177 2181 2178 - scm_stat_add(other, skb); 2179 - skb_queue_tail(&other->sk_receive_queue, skb); 2180 2182 sk_send_sigurg(other); 2181 2183 unix_state_unlock(other); 2182 2184 other->sk_data_ready(other); ··· 2569 2567 2570 2568 mutex_lock(&u->iolock); 2571 2569 unix_state_lock(sk); 2570 + spin_lock(&sk->sk_receive_queue.lock); 2572 2571 2573 2572 if (sock_flag(sk, SOCK_URGINLINE) || !u->oob_skb) { 2573 + spin_unlock(&sk->sk_receive_queue.lock); 2574 2574 unix_state_unlock(sk); 2575 2575 mutex_unlock(&u->iolock); 2576 2576 return -EINVAL; ··· 2584 2580 WRITE_ONCE(u->oob_skb, NULL); 2585 2581 else 2586 2582 skb_get(oob_skb); 2583 + 2584 + spin_unlock(&sk->sk_receive_queue.lock); 2587 2585 unix_state_unlock(sk); 2588 2586 2589 2587 chunk = state->recv_actor(oob_skb, 0, chunk, state); ··· 2614 2608 consume_skb(skb); 2615 2609 skb = NULL; 2616 2610 } else { 2611 + struct sk_buff *unlinked_skb = NULL; 2612 + 2613 + spin_lock(&sk->sk_receive_queue.lock); 2614 + 2617 2615 if (skb == u->oob_skb) { 2618 2616 if (copied) { 2619 2617 skb = NULL; ··· 2629 2619 } else if (flags & MSG_PEEK) { 2630 2620 skb = NULL; 2631 2621 } else { 2632 - skb_unlink(skb, &sk->sk_receive_queue); 2622 + __skb_unlink(skb, &sk->sk_receive_queue); 2633 2623 WRITE_ONCE(u->oob_skb, NULL); 2634 - if (!WARN_ON_ONCE(skb_unref(skb))) 2635 - kfree_skb(skb); 2624 + unlinked_skb = skb; 2636 2625 skb = skb_peek(&sk->sk_receive_queue); 2637 2626 } 2627 + } 2628 + 2629 + spin_unlock(&sk->sk_receive_queue.lock); 2630 + 2631 + if (unlinked_skb) { 2632 + WARN_ON_ONCE(skb_unref(unlinked_skb)); 2633 + kfree_skb(unlinked_skb); 2638 2634 } 2639 2635 } 2640 2636 return skb;
+14 -9
net/unix/garbage.c
··· 342 342 U_RECVQ_LOCK_EMBRYO, 343 343 }; 344 344 345 + static void unix_collect_queue(struct unix_sock *u, struct sk_buff_head *hitlist) 346 + { 347 + skb_queue_splice_init(&u->sk.sk_receive_queue, hitlist); 348 + 349 + #if IS_ENABLED(CONFIG_AF_UNIX_OOB) 350 + if (u->oob_skb) { 351 + WARN_ON_ONCE(skb_unref(u->oob_skb)); 352 + u->oob_skb = NULL; 353 + } 354 + #endif 355 + } 356 + 345 357 static void unix_collect_skb(struct list_head *scc, struct sk_buff_head *hitlist) 346 358 { 347 359 struct unix_vertex *vertex; ··· 377 365 378 366 /* listener -> embryo order, the inversion never happens. */ 379 367 spin_lock_nested(&embryo_queue->lock, U_RECVQ_LOCK_EMBRYO); 380 - skb_queue_splice_init(embryo_queue, hitlist); 368 + unix_collect_queue(unix_sk(skb->sk), hitlist); 381 369 spin_unlock(&embryo_queue->lock); 382 370 } 383 371 } else { 384 - skb_queue_splice_init(queue, hitlist); 385 - 386 - #if IS_ENABLED(CONFIG_AF_UNIX_OOB) 387 - if (u->oob_skb) { 388 - kfree_skb(u->oob_skb); 389 - u->oob_skb = NULL; 390 - } 391 - #endif 372 + unix_collect_queue(u, hitlist); 392 373 } 393 374 394 375 spin_unlock(&queue->lock);
+1 -1
tools/testing/selftests/drivers/net/stats.py
··· 69 69 return 0 70 70 71 71 for _ in range(10): 72 - rtstat = rtnl.getlink({"ifi-index": cfg.ifindex})['stats'] 72 + rtstat = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64'] 73 73 if stat_cmp(rtstat, qstat) < 0: 74 74 raise Exception("RTNL stats are lower, fetched later") 75 75 qstat = get_qstat(cfg)
+2 -2
tools/testing/selftests/net/af_unix/scm_rights.c
··· 197 197 const FIXTURE_VARIANT(scm_rights) *variant, 198 198 int inflight, int receiver) 199 199 { 200 - #define MSG "nop" 201 - #define MSGLEN 3 200 + #define MSG "x" 201 + #define MSGLEN 1 202 202 struct { 203 203 struct cmsghdr cmsghdr; 204 204 int fd[2];
+7 -1
tools/testing/selftests/net/amt.sh
··· 77 77 readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX) 78 78 readonly RELAY=$(mktemp -u relay-XXXXXXXX) 79 79 readonly SOURCE=$(mktemp -u source-XXXXXXXX) 80 + readonly SMCROUTEDIR="$(mktemp -d)" 80 81 ERR=4 81 82 err=0 82 83 ··· 86 85 for ns in "$@"; do 87 86 ip netns delete "${ns}" 2>/dev/null || true 88 87 done 88 + if [ -f "$SMCROUTEDIR/amt.pid" ]; then 89 + smcpid=$(< $SMCROUTEDIR/amt.pid) 90 + kill $smcpid 91 + fi 92 + rm -rf $SMCROUTEDIR 89 93 90 94 exit $ERR 91 95 } ··· 173 167 174 168 setup_mcast_routing() 175 169 { 176 - ip netns exec "${RELAY}" smcrouted 170 + ip netns exec "${RELAY}" smcrouted -P $SMCROUTEDIR/amt.pid 177 171 ip netns exec "${RELAY}" smcroutectl a relay_src \ 178 172 172.17.0.2 239.0.0.1 amtr 179 173 ip netns exec "${RELAY}" smcroutectl a relay_src \
+17 -36
tools/testing/selftests/net/arp_ndisc_untracked_subnets.sh
··· 73 73 # namespaces. veth0 is veth-router, veth1 is veth-host. 74 74 # first, set up the inteface's link to the namespace 75 75 # then, set the interface "up" 76 - ip -6 -netns ${ROUTER_NS_V6} link add name ${ROUTER_INTF} \ 77 - type veth peer name ${HOST_INTF} 76 + ip -n ${ROUTER_NS_V6} link add name ${ROUTER_INTF} \ 77 + type veth peer name ${HOST_INTF} netns ${HOST_NS_V6} 78 78 79 - ip -6 -netns ${ROUTER_NS_V6} link set dev ${ROUTER_INTF} up 80 - ip -6 -netns ${ROUTER_NS_V6} link set dev ${HOST_INTF} netns \ 81 - ${HOST_NS_V6} 82 - 83 - ip -6 -netns ${HOST_NS_V6} link set dev ${HOST_INTF} up 84 - ip -6 -netns ${ROUTER_NS_V6} addr add \ 85 - ${ROUTER_ADDR_V6}/${PREFIX_WIDTH_V6} dev ${ROUTER_INTF} nodad 79 + # Add tc rule to filter out host na message 80 + tc -n ${ROUTER_NS_V6} qdisc add dev ${ROUTER_INTF} clsact 81 + tc -n ${ROUTER_NS_V6} filter add dev ${ROUTER_INTF} \ 82 + ingress protocol ipv6 pref 1 handle 101 \ 83 + flower src_ip ${HOST_ADDR_V6} ip_proto icmpv6 type 136 skip_hw action pass 86 84 87 85 HOST_CONF=net.ipv6.conf.${HOST_INTF} 88 86 ip netns exec ${HOST_NS_V6} sysctl -qw ${HOST_CONF}.ndisc_notify=1 89 87 ip netns exec ${HOST_NS_V6} sysctl -qw ${HOST_CONF}.disable_ipv6=0 90 - ip -6 -netns ${HOST_NS_V6} addr add ${HOST_ADDR_V6}/${PREFIX_WIDTH_V6} \ 91 - dev ${HOST_INTF} 92 - 93 88 ROUTER_CONF=net.ipv6.conf.${ROUTER_INTF} 94 - 95 89 ip netns exec ${ROUTER_NS_V6} sysctl -w \ 96 90 ${ROUTER_CONF}.forwarding=1 >/dev/null 2>&1 97 91 ip netns exec ${ROUTER_NS_V6} sysctl -w \ ··· 93 99 ip netns exec ${ROUTER_NS_V6} sysctl -w \ 94 100 ${ROUTER_CONF}.accept_untracked_na=${accept_untracked_na} \ 95 101 >/dev/null 2>&1 102 + 103 + ip -n ${ROUTER_NS_V6} link set dev ${ROUTER_INTF} up 104 + ip -n ${HOST_NS_V6} link set dev ${HOST_INTF} up 105 + ip -n ${ROUTER_NS_V6} addr add ${ROUTER_ADDR_V6}/${PREFIX_WIDTH_V6} \ 106 + dev ${ROUTER_INTF} nodad 107 + ip -n ${HOST_NS_V6} addr add ${HOST_ADDR_V6}/${PREFIX_WIDTH_V6} \ 108 + dev ${HOST_INTF} 96 109 set +e 97 110 } 98 111 ··· 163 162 arp_test_gratuitous 2 1 164 163 } 165 164 166 - cleanup_tcpdump() { 167 - set -e 168 - [[ ! -z ${tcpdump_stdout} ]] && rm -f ${tcpdump_stdout} 169 - [[ ! -z ${tcpdump_stderr} ]] && rm -f ${tcpdump_stderr} 170 - tcpdump_stdout= 171 - tcpdump_stderr= 172 - set +e 173 - } 174 - 175 - start_tcpdump() { 176 - set -e 177 - tcpdump_stdout=`mktemp` 178 - tcpdump_stderr=`mktemp` 179 - ip netns exec ${ROUTER_NS_V6} timeout 15s \ 180 - tcpdump --immediate-mode -tpni ${ROUTER_INTF} -c 1 \ 181 - "icmp6 && icmp6[0] == 136 && src ${HOST_ADDR_V6}" \ 182 - > ${tcpdump_stdout} 2> /dev/null 183 - set +e 184 - } 185 - 186 165 verify_ndisc() { 187 166 local accept_untracked_na=$1 188 167 local same_subnet=$2 ··· 203 222 HOST_ADDR_V6=2001:db8:abcd:0012::3 204 223 fi 205 224 fi 206 - setup_v6 $1 $2 207 - start_tcpdump 225 + setup_v6 $1 226 + slowwait_for_counter 15 1 \ 227 + tc_rule_handle_stats_get "dev ${ROUTER_INTF} ingress" 101 ".packets" "-n ${ROUTER_NS_V6}" 208 228 209 229 if verify_ndisc $1 $2; then 210 230 printf " TEST: %-60s [ OK ]\n" "${test_msg[*]}" ··· 213 231 printf " TEST: %-60s [FAIL]\n" "${test_msg[*]}" 214 232 fi 215 233 216 - cleanup_tcpdump 217 234 cleanup_v6 218 235 set +e 219 236 }
-58
tools/testing/selftests/net/forwarding/lib.sh
··· 129 129 130 130 source "$net_forwarding_dir/../lib.sh" 131 131 132 - # timeout in seconds 133 - slowwait() 134 - { 135 - local timeout_sec=$1; shift 136 - 137 - loopy_wait "sleep 0.1" "$((timeout_sec * 1000))" "$@" 138 - } 139 - 140 132 ############################################################################## 141 133 # Sanity checks 142 134 ··· 670 678 "$@" | grep -q trap 671 679 } 672 680 673 - until_counter_is() 674 - { 675 - local expr=$1; shift 676 - local current=$("$@") 677 - 678 - echo $((current)) 679 - ((current $expr)) 680 - } 681 - 682 - busywait_for_counter() 683 - { 684 - local timeout=$1; shift 685 - local delta=$1; shift 686 - 687 - local base=$("$@") 688 - busywait "$timeout" until_counter_is ">= $((base + delta))" "$@" 689 - } 690 - 691 - slowwait_for_counter() 692 - { 693 - local timeout=$1; shift 694 - local delta=$1; shift 695 - 696 - local base=$("$@") 697 - slowwait "$timeout" until_counter_is ">= $((base + delta))" "$@" 698 - } 699 - 700 681 setup_wait_dev() 701 682 { 702 683 local dev=$1; shift ··· 986 1021 link_stats_rx_errors_get() 987 1022 { 988 1023 link_stats_get $1 rx errors 989 - } 990 - 991 - tc_rule_stats_get() 992 - { 993 - local dev=$1; shift 994 - local pref=$1; shift 995 - local dir=$1; shift 996 - local selector=${1:-.packets}; shift 997 - 998 - tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \ 999 - | jq ".[1].options.actions[].stats$selector" 1000 - } 1001 - 1002 - tc_rule_handle_stats_get() 1003 - { 1004 - local id=$1; shift 1005 - local handle=$1; shift 1006 - local selector=${1:-.packets}; shift 1007 - local netns=${1:-""}; shift 1008 - 1009 - tc $netns -j -s filter show $id \ 1010 - | jq ".[] | select(.options.handle == $handle) | \ 1011 - .options.actions[0].stats$selector" 1012 1024 } 1013 1025 1014 1026 ethtool_stats_get()
+58
tools/testing/selftests/net/lib.sh
··· 91 91 loopy_wait : "$timeout_ms" "$@" 92 92 } 93 93 94 + # timeout in seconds 95 + slowwait() 96 + { 97 + local timeout_sec=$1; shift 98 + 99 + loopy_wait "sleep 0.1" "$((timeout_sec * 1000))" "$@" 100 + } 101 + 102 + until_counter_is() 103 + { 104 + local expr=$1; shift 105 + local current=$("$@") 106 + 107 + echo $((current)) 108 + ((current $expr)) 109 + } 110 + 111 + busywait_for_counter() 112 + { 113 + local timeout=$1; shift 114 + local delta=$1; shift 115 + 116 + local base=$("$@") 117 + busywait "$timeout" until_counter_is ">= $((base + delta))" "$@" 118 + } 119 + 120 + slowwait_for_counter() 121 + { 122 + local timeout=$1; shift 123 + local delta=$1; shift 124 + 125 + local base=$("$@") 126 + slowwait "$timeout" until_counter_is ">= $((base + delta))" "$@" 127 + } 128 + 94 129 cleanup_ns() 95 130 { 96 131 local ns="" ··· 184 149 ! $ns_exist && ns_list="$ns_list $ns" 185 150 done 186 151 NS_LIST="$NS_LIST $ns_list" 152 + } 153 + 154 + tc_rule_stats_get() 155 + { 156 + local dev=$1; shift 157 + local pref=$1; shift 158 + local dir=$1; shift 159 + local selector=${1:-.packets}; shift 160 + 161 + tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \ 162 + | jq ".[1].options.actions[].stats$selector" 163 + } 164 + 165 + tc_rule_handle_stats_get() 166 + { 167 + local id=$1; shift 168 + local handle=$1; shift 169 + local selector=${1:-.packets}; shift 170 + local netns=${1:-""}; shift 171 + 172 + tc $netns -j -s filter show $id \ 173 + | jq ".[] | select(.options.handle == $handle) | \ 174 + .options.actions[0].stats$selector" 187 175 }