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

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

Pull networking fixes from Paolo Abeni:
"Including fixes from Bluetooth and WiFi. Notably this includes the fix
for the iwlwifi issue you reported.

Current release - regressions:

- core: avoid prefetching NULL pointers

- wifi:
- iwlwifi: implement settime64 as stub for MVM/MLD PTP
- mac80211: fix list iteration in ieee80211_add_virtual_monitor()

- handshake: fix null-ptr-deref in handshake_complete()

- eth: mana: fix use-after-free in reset service rescan path

Previous releases - regressions:

- openvswitch: avoid needlessly taking the RTNL on vport destroy

- dsa: properly keep track of conduit reference

- ipv4:
- fix error route reference count leak with nexthop objects
- fib: restore ECMP balance from loopback

- mptcp: ensure context reset on disconnect()

- bluetooth: fix potential UaF in btusb

- nfc: fix deadlock between nfc_unregister_device and
rfkill_fop_write

- eth:
- gve: defer interrupt enabling until NAPI registration
- i40e: fix scheduling in set_rx_mode
- macb: relocate mog_init_rings() callback from macb_mac_link_up()
to macb_open()
- rtl8150: fix memory leak on usb_submit_urb() failure

- wifi: 8192cu: fix tid out of range in rtl92cu_tx_fill_desc()

Previous releases - always broken:

- ip6_gre: make ip6gre_header() robust

- ipv6: fix a BUG in rt6_get_pcpu_route() under PREEMPT_RT

- af_unix: don't post cmsg for SO_INQ unless explicitly asked for

- phy: mediatek: fix nvmem cell reference leak in
mt798x_phy_calibration

- wifi: mac80211: discard beacon frames to non-broadcast address

- eth:
- iavf: fix off-by-one issues in iavf_config_rss_reg()
- stmmac: fix the crash issue for zero copy XDP_TX action
- team: fix check for port enabled when priority changes"

* tag 'net-6.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (64 commits)
ipv6: fix a BUG in rt6_get_pcpu_route() under PREEMPT_RT
net: rose: fix invalid array index in rose_kill_by_device()
net: enetc: do not print error log if addr is 0
net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()
selftests: fib_test: Add test case for ipv4 multi nexthops
net: fib: restore ECMP balance from loopback
selftests: fib_nexthops: Add test cases for error routes deletion
ipv4: Fix reference count leak when using error routes with nexthop objects
net: usb: sr9700: fix incorrect command used to write single register
ipv6: BUG() in pskb_expand_head() as part of calipso_skbuff_setattr()
usbnet: avoid a possible crash in dql_completed()
gve: defer interrupt enabling until NAPI registration
net: stmmac: fix the crash issue for zero copy XDP_TX action
octeontx2-pf: fix "UBSAN: shift-out-of-bounds error"
af_unix: don't post cmsg for SO_INQ unless explicitly asked for
net: mana: Fix use-after-free in reset service rescan path
net: avoid prefetching NULL pointers
net: bridge: Describe @tunnel_hash member in net_bridge_vlan_group struct
net: nfc: fix deadlock between nfc_unregister_device and rfkill_fop_write
net: usb: asix: validate PHY address before use
...

+428 -194
+9 -3
drivers/bluetooth/btusb.c
··· 4052 4052 return -ENODEV; 4053 4053 } 4054 4054 4055 - data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); 4055 + data = kzalloc(sizeof(*data), GFP_KERNEL); 4056 4056 if (!data) 4057 4057 return -ENOMEM; 4058 4058 ··· 4075 4075 } 4076 4076 } 4077 4077 4078 - if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) 4078 + if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) { 4079 + kfree(data); 4079 4080 return -ENODEV; 4081 + } 4080 4082 4081 4083 if (id->driver_info & BTUSB_AMP) { 4082 4084 data->cmdreq_type = USB_TYPE_CLASS | 0x01; ··· 4133 4131 data->recv_acl = hci_recv_frame; 4134 4132 4135 4133 hdev = hci_alloc_dev_priv(priv_size); 4136 - if (!hdev) 4134 + if (!hdev) { 4135 + kfree(data); 4137 4136 return -ENOMEM; 4137 + } 4138 4138 4139 4139 hdev->bus = HCI_USB; 4140 4140 hci_set_drvdata(hdev, data); ··· 4410 4406 if (data->reset_gpio) 4411 4407 gpiod_put(data->reset_gpio); 4412 4408 hci_free_dev(hdev); 4409 + kfree(data); 4413 4410 return err; 4414 4411 } 4415 4412 ··· 4459 4454 } 4460 4455 4461 4456 hci_free_dev(hdev); 4457 + kfree(data); 4462 4458 } 4463 4459 4464 4460 #ifdef CONFIG_PM
+3
drivers/net/dsa/b53/b53_common.c
··· 2169 2169 if (!ent->is_valid) 2170 2170 return 0; 2171 2171 2172 + if (is_multicast_ether_addr(ent->mac)) 2173 + return 0; 2174 + 2172 2175 if (port != ent->port) 2173 2176 return 0; 2174 2177
+26 -13
drivers/net/ethernet/airoha/airoha_eth.c
··· 2924 2924 port->id = id; 2925 2925 eth->ports[p] = port; 2926 2926 2927 - err = airoha_metadata_dst_alloc(port); 2928 - if (err) 2929 - return err; 2927 + return airoha_metadata_dst_alloc(port); 2928 + } 2930 2929 2931 - err = register_netdev(dev); 2932 - if (err) 2933 - goto free_metadata_dst; 2930 + static int airoha_register_gdm_devices(struct airoha_eth *eth) 2931 + { 2932 + int i; 2933 + 2934 + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { 2935 + struct airoha_gdm_port *port = eth->ports[i]; 2936 + int err; 2937 + 2938 + if (!port) 2939 + continue; 2940 + 2941 + err = register_netdev(port->dev); 2942 + if (err) 2943 + return err; 2944 + } 2934 2945 2935 2946 return 0; 2936 - 2937 - free_metadata_dst: 2938 - airoha_metadata_dst_free(port); 2939 - return err; 2940 2947 } 2941 2948 2942 2949 static int airoha_probe(struct platform_device *pdev) ··· 3034 3027 } 3035 3028 } 3036 3029 3030 + err = airoha_register_gdm_devices(eth); 3031 + if (err) 3032 + goto error_napi_stop; 3033 + 3037 3034 return 0; 3038 3035 3039 3036 error_napi_stop: ··· 3051 3040 for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { 3052 3041 struct airoha_gdm_port *port = eth->ports[i]; 3053 3042 3054 - if (port && port->dev->reg_state == NETREG_REGISTERED) { 3043 + if (!port) 3044 + continue; 3045 + 3046 + if (port->dev->reg_state == NETREG_REGISTERED) 3055 3047 unregister_netdev(port->dev); 3056 - airoha_metadata_dst_free(port); 3057 - } 3048 + airoha_metadata_dst_free(port); 3058 3049 } 3059 3050 free_netdev(eth->napi_dev); 3060 3051 platform_set_drvdata(pdev, NULL);
+2
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
··· 1928 1928 { 1929 1929 if (pdata->rx_adapt_retries++ >= MAX_RX_ADAPT_RETRIES) { 1930 1930 pdata->rx_adapt_retries = 0; 1931 + pdata->mode_set = false; 1931 1932 return; 1932 1933 } 1933 1934 ··· 1975 1974 */ 1976 1975 netif_dbg(pdata, link, pdata->netdev, "Block_lock done"); 1977 1976 pdata->rx_adapt_done = true; 1977 + pdata->rx_adapt_retries = 0; 1978 1978 pdata->mode_set = false; 1979 1979 return; 1980 1980 }
+4 -4
drivers/net/ethernet/broadcom/Kconfig
··· 255 255 devices, via the hwmon sysfs interface. 256 256 257 257 config BNGE 258 - tristate "Broadcom Ethernet device support" 258 + tristate "Broadcom ThorUltra Ethernet device support" 259 259 depends on PCI 260 260 select NET_DEVLINK 261 261 select PAGE_POOL 262 262 help 263 - This driver supports Broadcom 50/100/200/400/800 gigabit Ethernet cards. 264 - The module will be called bng_en. To compile this driver as a module, 265 - choose M here. 263 + This driver supports Broadcom ThorUltra 50/100/200/400/800 gigabit 264 + Ethernet cards. The module will be called bng_en. To compile this 265 + driver as a module, choose M here. 266 266 267 267 config BCMASP 268 268 tristate "Broadcom ASP 2.0 Ethernet support"
+1 -1
drivers/net/ethernet/broadcom/bnge/bnge.h
··· 5 5 #define _BNGE_H_ 6 6 7 7 #define DRV_NAME "bng_en" 8 - #define DRV_SUMMARY "Broadcom 800G Ethernet Linux Driver" 8 + #define DRV_SUMMARY "Broadcom ThorUltra NIC Ethernet Driver" 9 9 10 10 #include <linux/etherdevice.h> 11 11 #include <linux/bnxt/hsi.h>
+1 -1
drivers/net/ethernet/broadcom/bnge/bnge_core.c
··· 19 19 static const struct { 20 20 char *name; 21 21 } board_info[] = { 22 - [BCM57708] = { "Broadcom BCM57708 50Gb/100Gb/200Gb/400Gb/800Gb Ethernet" }, 22 + [BCM57708] = { "Broadcom BCM57708 ThorUltra 50Gb/100Gb/200Gb/400Gb/800Gb Ethernet" }, 23 23 }; 24 24 25 25 static const struct pci_device_id bnge_pci_tbl[] = {
+2 -1
drivers/net/ethernet/cadence/macb_main.c
··· 708 708 /* Initialize rings & buffers as clearing MACB_BIT(TE) in link down 709 709 * cleared the pipeline and control registers. 710 710 */ 711 - bp->macbgem_ops.mog_init_rings(bp); 712 711 macb_init_buffers(bp); 713 712 714 713 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) ··· 2952 2953 err); 2953 2954 goto pm_exit; 2954 2955 } 2956 + 2957 + bp->macbgem_ops.mog_init_rings(bp); 2955 2958 2956 2959 for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { 2957 2960 napi_enable(&queue->napi_rx);
+7 -1
drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c
··· 577 577 } 578 578 579 579 addr = netc_get_phy_addr(np); 580 - if (addr <= 0) { 580 + if (addr < 0) { 581 581 dev_err(dev, "Failed to get PHY address\n"); 582 582 return addr; 583 583 } 584 + 585 + /* The default value of LaBCR[MDIO_PHYAD_PRTAD] is 0, 586 + * so no need to set the register. 587 + */ 588 + if (!addr) 589 + return 0; 584 590 585 591 if (phy_mask & BIT(addr)) { 586 592 dev_err(dev,
+1 -1
drivers/net/ethernet/google/gve/gve_main.c
··· 558 558 block->priv = priv; 559 559 err = request_irq(priv->msix_vectors[msix_idx].vector, 560 560 gve_is_gqi(priv) ? gve_intr : gve_intr_dqo, 561 - 0, block->name, block); 561 + IRQF_NO_AUTOEN, block->name, block); 562 562 if (err) { 563 563 dev_err(&priv->pdev->dev, 564 564 "Failed to receive msix vector %d\n", i);
+2
drivers/net/ethernet/google/gve/gve_utils.c
··· 112 112 113 113 netif_napi_add_locked(priv->dev, &block->napi, gve_poll); 114 114 netif_napi_set_irq_locked(&block->napi, block->irq); 115 + enable_irq(block->irq); 115 116 } 116 117 117 118 void gve_remove_napi(struct gve_priv *priv, int ntfy_idx) 118 119 { 119 120 struct gve_notify_block *block = &priv->ntfy_blocks[ntfy_idx]; 120 121 122 + disable_irq(block->irq); 121 123 netif_napi_del_locked(&block->napi); 122 124 }
+9 -1
drivers/net/ethernet/intel/e1000/e1000_main.c
··· 4094 4094 u32 length, const u8 *data) 4095 4095 { 4096 4096 struct e1000_hw *hw = &adapter->hw; 4097 - u8 last_byte = *(data + length - 1); 4097 + u8 last_byte; 4098 + 4099 + /* Guard against OOB on data[length - 1] */ 4100 + if (unlikely(!length)) 4101 + return false; 4102 + /* Upper bound: length must not exceed rx_buffer_len */ 4103 + if (unlikely(length > adapter->rx_buffer_len)) 4104 + return false; 4105 + last_byte = *(data + length - 1); 4098 4106 4099 4107 if (TBI_ACCEPT(hw, status, errors, length, last_byte)) { 4100 4108 unsigned long irq_flags;
+11
drivers/net/ethernet/intel/i40e/i40e.h
··· 1422 1422 return (pf->lan_veb != I40E_NO_VEB) ? pf->veb[pf->lan_veb] : NULL; 1423 1423 } 1424 1424 1425 + static inline u32 i40e_get_max_num_descriptors(const struct i40e_pf *pf) 1426 + { 1427 + const struct i40e_hw *hw = &pf->hw; 1428 + 1429 + switch (hw->mac.type) { 1430 + case I40E_MAC_XL710: 1431 + return I40E_MAX_NUM_DESCRIPTORS_XL710; 1432 + default: 1433 + return I40E_MAX_NUM_DESCRIPTORS; 1434 + } 1435 + } 1425 1436 #endif /* _I40E_H_ */
-12
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 2013 2013 drvinfo->n_priv_flags += I40E_GL_PRIV_FLAGS_STR_LEN; 2014 2014 } 2015 2015 2016 - static u32 i40e_get_max_num_descriptors(struct i40e_pf *pf) 2017 - { 2018 - struct i40e_hw *hw = &pf->hw; 2019 - 2020 - switch (hw->mac.type) { 2021 - case I40E_MAC_XL710: 2022 - return I40E_MAX_NUM_DESCRIPTORS_XL710; 2023 - default: 2024 - return I40E_MAX_NUM_DESCRIPTORS; 2025 - } 2026 - } 2027 - 2028 2016 static void i40e_get_ringparam(struct net_device *netdev, 2029 2017 struct ethtool_ringparam *ring, 2030 2018 struct kernel_ethtool_ringparam *kernel_ring,
+1
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 2234 2234 vsi->flags |= I40E_VSI_FLAG_FILTER_CHANGED; 2235 2235 set_bit(__I40E_MACVLAN_SYNC_PENDING, vsi->back->state); 2236 2236 } 2237 + i40e_service_event_schedule(vsi->back); 2237 2238 } 2238 2239 2239 2240 /**
+2 -2
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 656 656 657 657 /* ring_len has to be multiple of 8 */ 658 658 if (!IS_ALIGNED(info->ring_len, 8) || 659 - info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) { 659 + info->ring_len > i40e_get_max_num_descriptors(pf)) { 660 660 ret = -EINVAL; 661 661 goto error_context; 662 662 } ··· 726 726 727 727 /* ring_len has to be multiple of 32 */ 728 728 if (!IS_ALIGNED(info->ring_len, 32) || 729 - info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) { 729 + info->ring_len > i40e_get_max_num_descriptors(pf)) { 730 730 ret = -EINVAL; 731 731 goto error_param; 732 732 }
+2 -2
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 1726 1726 u16 i; 1727 1727 1728 1728 dw = (u32 *)adapter->rss_key; 1729 - for (i = 0; i <= adapter->rss_key_size / 4; i++) 1729 + for (i = 0; i < adapter->rss_key_size / 4; i++) 1730 1730 wr32(hw, IAVF_VFQF_HKEY(i), dw[i]); 1731 1731 1732 1732 dw = (u32 *)adapter->rss_lut; 1733 - for (i = 0; i <= adapter->rss_lut_size / 4; i++) 1733 + for (i = 0; i < adapter->rss_lut_size / 4; i++) 1734 1734 wr32(hw, IAVF_VFQF_HLUT(i), dw[i]); 1735 1735 1736 1736 iavf_flush(hw);
+1 -1
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 1271 1271 idpf_mb_irq_enable(adapter); 1272 1272 else 1273 1273 queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 1274 - msecs_to_jiffies(300)); 1274 + usecs_to_jiffies(300)); 1275 1275 1276 1276 idpf_recv_mb_msg(adapter); 1277 1277 }
+5
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
··· 1016 1016 struct idpf_vc_xn_params xn_params = { 1017 1017 .vc_op = VIRTCHNL2_OP_GET_LAN_MEMORY_REGIONS, 1018 1018 .recv_buf.iov_len = IDPF_CTLQ_MAX_BUF_LEN, 1019 + .send_buf.iov_len = 1020 + sizeof(struct virtchnl2_get_lan_memory_regions) + 1021 + sizeof(struct virtchnl2_mem_region), 1019 1022 .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC, 1020 1023 }; 1021 1024 int num_regions, size; ··· 1031 1028 return -ENOMEM; 1032 1029 1033 1030 xn_params.recv_buf.iov_base = rcvd_regions; 1031 + rcvd_regions->num_memory_regions = cpu_to_le16(1); 1032 + xn_params.send_buf.iov_base = rcvd_regions; 1034 1033 reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 1035 1034 if (reply_sz < 0) 1036 1035 return reply_sz;
+8
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
··· 418 418 */ 419 419 if (rx_count < pfvf->hw.rq_skid) 420 420 rx_count = pfvf->hw.rq_skid; 421 + 422 + if (ring->rx_pending < 16) { 423 + netdev_err(netdev, 424 + "rx ring size %u invalid, min is 16\n", 425 + ring->rx_pending); 426 + return -EINVAL; 427 + } 428 + 421 429 rx_count = Q_COUNT(Q_SIZE(rx_count, 3)); 422 430 423 431 /* Due pipelining impact minimum 2000 unused SQ CQE's
+1 -1
drivers/net/ethernet/microsoft/mana/gdma_main.c
··· 481 481 /* Perform PCI rescan on device if we failed on HWC */ 482 482 dev_err(&pdev->dev, "MANA service: resume failed, rescanning\n"); 483 483 mana_serv_rescan(pdev); 484 - goto out; 484 + return; 485 485 } 486 486 487 487 if (ret)
+1 -9
drivers/net/ethernet/smsc/smc91x.c
··· 516 516 * any other concurrent access and C would always interrupt B. But life 517 517 * isn't that easy in a SMP world... 518 518 */ 519 - #define smc_special_trylock(lock, flags) \ 520 - ({ \ 521 - int __ret; \ 522 - local_irq_save(flags); \ 523 - __ret = spin_trylock(lock); \ 524 - if (!__ret) \ 525 - local_irq_restore(flags); \ 526 - __ret; \ 527 - }) 519 + #define smc_special_trylock(lock, flags) spin_trylock_irqsave(lock, flags) 528 520 #define smc_special_lock(lock, flags) spin_lock_irqsave(lock, flags) 529 521 #define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags) 530 522 #else
+15 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 89 89 #define STMMAC_XDP_CONSUMED BIT(0) 90 90 #define STMMAC_XDP_TX BIT(1) 91 91 #define STMMAC_XDP_REDIRECT BIT(2) 92 + #define STMMAC_XSK_CONSUMED BIT(3) 92 93 93 94 static int flow_ctrl = 0xdead; 94 95 module_param(flow_ctrl, int, 0644); ··· 5127 5126 static int stmmac_xdp_xmit_back(struct stmmac_priv *priv, 5128 5127 struct xdp_buff *xdp) 5129 5128 { 5129 + bool zc = !!(xdp->rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL); 5130 5130 struct xdp_frame *xdpf = xdp_convert_buff_to_frame(xdp); 5131 5131 int cpu = smp_processor_id(); 5132 5132 struct netdev_queue *nq; ··· 5144 5142 /* Avoids TX time-out as we are sharing with slow path */ 5145 5143 txq_trans_cond_update(nq); 5146 5144 5147 - res = stmmac_xdp_xmit_xdpf(priv, queue, xdpf, false); 5148 - if (res == STMMAC_XDP_TX) 5145 + /* For zero copy XDP_TX action, dma_map is true */ 5146 + res = stmmac_xdp_xmit_xdpf(priv, queue, xdpf, zc); 5147 + if (res == STMMAC_XDP_TX) { 5149 5148 stmmac_flush_tx_descriptors(priv, queue); 5149 + } else if (res == STMMAC_XDP_CONSUMED && zc) { 5150 + /* xdp has been freed by xdp_convert_buff_to_frame(), 5151 + * no need to call xsk_buff_free() again, so return 5152 + * STMMAC_XSK_CONSUMED. 5153 + */ 5154 + res = STMMAC_XSK_CONSUMED; 5155 + xdp_return_frame(xdpf); 5156 + } 5150 5157 5151 5158 __netif_tx_unlock(nq); 5152 5159 ··· 5505 5494 break; 5506 5495 case STMMAC_XDP_CONSUMED: 5507 5496 xsk_buff_free(buf->xdp); 5497 + fallthrough; 5498 + case STMMAC_XSK_CONSUMED: 5508 5499 rx_dropped++; 5509 5500 break; 5510 5501 case STMMAC_XDP_TX:
+1 -3
drivers/net/ethernet/wangxun/Kconfig
··· 21 21 depends on PTP_1588_CLOCK_OPTIONAL 22 22 select PAGE_POOL 23 23 select DIMLIB 24 + select PHYLINK 24 25 help 25 26 Common library for Wangxun(R) Ethernet drivers. 26 27 ··· 30 29 depends on PCI 31 30 depends on PTP_1588_CLOCK_OPTIONAL 32 31 select LIBWX 33 - select PHYLINK 34 32 help 35 33 This driver supports Wangxun(R) GbE PCI Express family of 36 34 adapters. ··· 48 48 depends on PTP_1588_CLOCK_OPTIONAL 49 49 select MARVELL_10G_PHY 50 50 select REGMAP 51 - select PHYLINK 52 51 select HWMON if TXGBE=y 53 52 select SFP 54 53 select GPIOLIB ··· 70 71 depends on PCI_MSI 71 72 depends on PTP_1588_CLOCK_OPTIONAL 72 73 select LIBWX 73 - select PHYLINK 74 74 help 75 75 This driver supports virtual functions for SP1000A, WX1820AL, 76 76 WX5XXX, WX5XXXAL.
+9 -3
drivers/net/fjes/fjes_hw.c
··· 334 334 335 335 ret = fjes_hw_reset(hw); 336 336 if (ret) 337 - return ret; 337 + goto err_iounmap; 338 338 339 339 fjes_hw_set_irqmask(hw, REG_ICTL_MASK_ALL, true); 340 340 ··· 347 347 hw->max_epid = fjes_hw_get_max_epid(hw); 348 348 hw->my_epid = fjes_hw_get_my_epid(hw); 349 349 350 - if ((hw->max_epid == 0) || (hw->my_epid >= hw->max_epid)) 351 - return -ENXIO; 350 + if ((hw->max_epid == 0) || (hw->my_epid >= hw->max_epid)) { 351 + ret = -ENXIO; 352 + goto err_iounmap; 353 + } 352 354 353 355 ret = fjes_hw_setup(hw); 354 356 355 357 hw->hw_info.trace = vzalloc(FJES_DEBUG_BUFFER_SIZE); 356 358 hw->hw_info.trace_size = FJES_DEBUG_BUFFER_SIZE; 357 359 360 + return ret; 361 + 362 + err_iounmap: 363 + fjes_hw_iounmap(hw); 358 364 return ret; 359 365 } 360 366
+7
drivers/net/mdio/mdio-aspeed.c
··· 63 63 64 64 iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); 65 65 66 + /* Workaround for read-after-write issue. 67 + * The controller may return stale data if a read follows immediately 68 + * after a write. A dummy read forces the hardware to update its 69 + * internal state, ensuring that the next real read returns correct data. 70 + */ 71 + ioread32(ctx->base + ASPEED_MDIO_CTRL); 72 + 66 73 return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl, 67 74 !(ctrl & ASPEED_MDIO_CTRL_FIRE), 68 75 ASPEED_MDIO_INTERVAL_US,
+2 -4
drivers/net/mdio/mdio-realtek-rtl9300.c
··· 354 354 struct fwnode_handle *node) 355 355 { 356 356 struct rtl9300_mdio_chan *chan; 357 - struct fwnode_handle *child; 358 357 struct mii_bus *bus; 359 358 u32 mdio_bus; 360 359 int err; ··· 370 371 * compatible = "ethernet-phy-ieee802.3-c45". This does mean we can't 371 372 * support both c45 and c22 on the same MDIO bus. 372 373 */ 373 - fwnode_for_each_child_node(node, child) 374 + fwnode_for_each_child_node_scoped(node, child) 374 375 if (fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) 375 376 priv->smi_bus_is_c45[mdio_bus] = true; 376 377 ··· 408 409 { 409 410 struct rtl9300_mdio_priv *priv = dev_get_drvdata(dev); 410 411 struct device *parent = dev->parent; 411 - struct fwnode_handle *port; 412 412 int err; 413 413 414 414 struct fwnode_handle *ports __free(fwnode_handle) = ··· 416 418 return dev_err_probe(dev, -EINVAL, "%pfwP missing ethernet-ports\n", 417 419 dev_fwnode(parent)); 418 420 419 - fwnode_for_each_child_node(ports, port) { 421 + fwnode_for_each_child_node_scoped(ports, port) { 420 422 struct device_node *mdio_dn; 421 423 u32 addr; 422 424 u32 bus;
+1 -1
drivers/net/phy/mediatek/mtk-ge-soc.c
··· 1167 1167 } 1168 1168 1169 1169 buf = (u32 *)nvmem_cell_read(cell, &len); 1170 + nvmem_cell_put(cell); 1170 1171 if (IS_ERR(buf)) 1171 1172 return PTR_ERR(buf); 1172 - nvmem_cell_put(cell); 1173 1173 1174 1174 if (!buf[0] || !buf[1] || !buf[2] || !buf[3] || len < 4 * sizeof(u32)) { 1175 1175 phydev_err(phydev, "invalid efuse data\n");
+1 -1
drivers/net/team/team_core.c
··· 878 878 static void team_queue_override_port_prio_changed(struct team *team, 879 879 struct team_port *port) 880 880 { 881 - if (!port->queue_id || team_port_enabled(port)) 881 + if (!port->queue_id || !team_port_enabled(port)) 882 882 return; 883 883 __team_queue_override_port_del(team, port); 884 884 __team_queue_override_port_add(team, port);
+5
drivers/net/usb/asix_common.c
··· 335 335 offset = (internal ? 1 : 0); 336 336 ret = buf[offset]; 337 337 338 + if (ret >= PHY_MAX_ADDR) { 339 + netdev_err(dev->net, "invalid PHY address: %d\n", ret); 340 + return -ENODEV; 341 + } 342 + 338 343 netdev_dbg(dev->net, "%s PHY address 0x%x\n", 339 344 internal ? "internal" : "external", ret); 340 345
+1 -5
drivers/net/usb/ax88172a.c
··· 210 210 ret = asix_read_phy_addr(dev, priv->use_embdphy); 211 211 if (ret < 0) 212 212 goto free; 213 - if (ret >= PHY_MAX_ADDR) { 214 - netdev_err(dev->net, "Invalid PHY address %#x\n", ret); 215 - ret = -ENODEV; 216 - goto free; 217 - } 213 + 218 214 priv->phy_addr = ret; 219 215 220 216 ax88172a_reset_phy(dev, priv->use_embdphy);
+2
drivers/net/usb/rtl8150.c
··· 211 211 if (res == -ENODEV) 212 212 netif_device_detach(dev->netdev); 213 213 dev_err(&dev->udev->dev, "%s failed with %d\n", __func__, res); 214 + kfree(req); 215 + usb_free_urb(async_urb); 214 216 } 215 217 return res; 216 218 }
+7 -2
drivers/net/usb/sr9700.c
··· 52 52 53 53 static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value) 54 54 { 55 - return usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG, 55 + return usbnet_write_cmd(dev, SR_WR_REG, SR_REQ_WR_REG, 56 56 value, reg, NULL, 0); 57 57 } 58 58 ··· 65 65 66 66 static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value) 67 67 { 68 - usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG, 68 + usbnet_write_cmd_async(dev, SR_WR_REG, SR_REQ_WR_REG, 69 69 value, reg, NULL, 0); 70 70 } 71 71 ··· 537 537 static const struct usb_device_id products[] = { 538 538 { 539 539 USB_DEVICE(0x0fe6, 0x9700), /* SR9700 device */ 540 + .driver_info = (unsigned long)&sr9700_driver_info, 541 + }, 542 + { 543 + /* SR9700 with virtual driver CD-ROM - interface 0 is the CD-ROM device */ 544 + USB_DEVICE_INTERFACE_NUMBER(0x0fe6, 0x9702, 1), 540 545 .driver_info = (unsigned long)&sr9700_driver_info, 541 546 }, 542 547 {}, /* END */
+2 -1
drivers/net/usb/usbnet.c
··· 831 831 832 832 clear_bit(EVENT_DEV_OPEN, &dev->flags); 833 833 netif_stop_queue(net); 834 - netdev_reset_queue(net); 835 834 836 835 netif_info(dev, ifdown, dev->net, 837 836 "stop stats: rx/tx %lu/%lu, errs %lu/%lu\n", ··· 873 874 cancel_work_sync(&dev->bh_work); 874 875 timer_delete_sync(&dev->delay); 875 876 cancel_work_sync(&dev->kevent); 877 + 878 + netdev_reset_queue(net); 876 879 877 880 if (!pm) 878 881 usb_autopm_put_interface(dev->intf);
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1597 1597 */ 1598 1598 static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) 1599 1599 { 1600 - unsigned int min_core, max_core, loaded_core; 1600 + int min_core, max_core, loaded_core; 1601 1601 struct iwl_drv *drv = context; 1602 1602 struct iwl_fw *fw = &drv->fw; 1603 1603 const struct iwl_ucode_header *ucode; ··· 1676 1676 if (loaded_core < min_core || loaded_core > max_core) { 1677 1677 IWL_ERR(drv, 1678 1678 "Driver unable to support your firmware API. " 1679 - "Driver supports FW core %u..%u, firmware is %u.\n", 1679 + "Driver supports FW core %d..%d, firmware is %d.\n", 1680 1680 min_core, max_core, loaded_core); 1681 1681 goto try_again; 1682 1682 }
+7
drivers/net/wireless/intel/iwlwifi/mld/ptp.c
··· 121 121 return 0; 122 122 } 123 123 124 + static int iwl_mld_ptp_settime(struct ptp_clock_info *ptp, 125 + const struct timespec64 *ts) 126 + { 127 + return -EOPNOTSUPP; 128 + } 129 + 124 130 static int iwl_mld_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) 125 131 { 126 132 struct iwl_mld *mld = container_of(ptp, struct iwl_mld, ··· 285 279 286 280 mld->ptp_data.ptp_clock_info.owner = THIS_MODULE; 287 281 mld->ptp_data.ptp_clock_info.gettime64 = iwl_mld_ptp_gettime; 282 + mld->ptp_data.ptp_clock_info.settime64 = iwl_mld_ptp_settime; 288 283 mld->ptp_data.ptp_clock_info.max_adj = 0x7fffffff; 289 284 mld->ptp_data.ptp_clock_info.adjtime = iwl_mld_ptp_adjtime; 290 285 mld->ptp_data.ptp_clock_info.adjfine = iwl_mld_ptp_adjfine;
+7
drivers/net/wireless/intel/iwlwifi/mvm/ptp.c
··· 220 220 return 0; 221 221 } 222 222 223 + static int iwl_mvm_ptp_settime(struct ptp_clock_info *ptp, 224 + const struct timespec64 *ts) 225 + { 226 + return -EOPNOTSUPP; 227 + } 228 + 223 229 static int iwl_mvm_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) 224 230 { 225 231 struct iwl_mvm *mvm = container_of(ptp, struct iwl_mvm, ··· 287 281 mvm->ptp_data.ptp_clock_info.adjfine = iwl_mvm_ptp_adjfine; 288 282 mvm->ptp_data.ptp_clock_info.adjtime = iwl_mvm_ptp_adjtime; 289 283 mvm->ptp_data.ptp_clock_info.gettime64 = iwl_mvm_ptp_gettime; 284 + mvm->ptp_data.ptp_clock_info.settime64 = iwl_mvm_ptp_settime; 290 285 mvm->ptp_data.scaled_freq = SCALE_FACTOR; 291 286 292 287 /* Give a short 'friendly name' to identify the PHC clock */
+2 -1
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/trx.c
··· 511 511 if (sta) { 512 512 sta_entry = (struct rtl_sta_info *)sta->drv_priv; 513 513 tid = ieee80211_get_tid(hdr); 514 - agg_state = sta_entry->tids[tid].agg.agg_state; 514 + if (tid < MAX_TID_COUNT) 515 + agg_state = sta_entry->tids[tid].agg.agg_state; 515 516 ampdu_density = sta->deflink.ht_cap.ampdu_density; 516 517 } 517 518
+3 -1
drivers/net/wireless/realtek/rtw88/sdio.c
··· 144 144 145 145 static bool rtw_sdio_use_direct_io(struct rtw_dev *rtwdev, u32 addr) 146 146 { 147 + bool might_indirect_under_power_off = rtwdev->chip->id == RTW_CHIP_TYPE_8822C; 148 + 147 149 if (!test_bit(RTW_FLAG_POWERON, rtwdev->flags) && 148 - !rtw_sdio_is_bus_addr(addr)) 150 + !rtw_sdio_is_bus_addr(addr) && might_indirect_under_power_off) 149 151 return false; 150 152 151 153 return !rtw_sdio_is_sdio30_supported(rtwdev) ||
+1 -2
drivers/net/wireless/realtek/rtw88/usb.c
··· 965 965 struct sk_buff *rx_skb; 966 966 int i; 967 967 968 - rtwusb->rxwq = alloc_workqueue("rtw88_usb: rx wq", WQ_BH | WQ_UNBOUND, 969 - 0); 968 + rtwusb->rxwq = alloc_workqueue("rtw88_usb: rx wq", WQ_BH, 0); 970 969 if (!rtwusb->rxwq) { 971 970 rtw_err(rtwdev, "failed to create RX work queue\n"); 972 971 return -ENOMEM;
+5
drivers/net/wireless/ti/wlcore/tx.c
··· 207 207 total_blocks = wlcore_hw_calc_tx_blocks(wl, total_len, spare_blocks); 208 208 209 209 if (total_blocks <= wl->tx_blocks_available) { 210 + if (skb_headroom(skb) < (total_len - skb->len) && 211 + pskb_expand_head(skb, (total_len - skb->len), 0, GFP_ATOMIC)) { 212 + wl1271_free_tx_id(wl, id); 213 + return -EAGAIN; 214 + } 210 215 desc = skb_push(skb, total_len - skb->len); 211 216 212 217 wlcore_hw_set_tx_desc_blocks(wl, desc, total_blocks,
+1
include/net/dsa.h
··· 302 302 struct devlink_port devlink_port; 303 303 struct phylink *pl; 304 304 struct phylink_config pl_config; 305 + netdevice_tracker conduit_tracker; 305 306 struct dsa_lag *lag; 306 307 struct net_device *hsr_dev; 307 308
+6
net/bluetooth/mgmt.c
··· 849 849 if (cis_peripheral_capable(hdev)) 850 850 settings |= MGMT_SETTING_CIS_PERIPHERAL; 851 851 852 + if (bis_capable(hdev)) 853 + settings |= MGMT_SETTING_ISO_BROADCASTER; 854 + 855 + if (sync_recv_capable(hdev)) 856 + settings |= MGMT_SETTING_ISO_SYNC_RECEIVER; 857 + 852 858 if (ll_privacy_capable(hdev)) 853 859 settings |= MGMT_SETTING_LL_PRIVACY; 854 860
+1
net/bridge/br_private.h
··· 247 247 * struct net_bridge_vlan_group 248 248 * 249 249 * @vlan_hash: VLAN entry rhashtable 250 + * @tunnel_hash: Hash table to map from tunnel key ID (e.g. VXLAN VNI) to VLAN 250 251 * @vlan_list: sorted VLAN entry list 251 252 * @num_vlans: number of total VLAN entries 252 253 * @pvid: PVID VLAN id
+5 -3
net/core/dev.c
··· 4241 4241 int count = 0; 4242 4242 4243 4243 llist_for_each_entry_safe(skb, next, ll_list, ll_node) { 4244 - prefetch(next); 4245 - prefetch(&next->priority); 4246 - skb_mark_not_on_list(skb); 4244 + if (next) { 4245 + prefetch(next); 4246 + prefetch(&next->priority); 4247 + skb_mark_not_on_list(skb); 4248 + } 4247 4249 rc = dev_qdisc_enqueue(skb, q, &to_free, txq); 4248 4250 count++; 4249 4251 }
+35 -32
net/dsa/dsa.c
··· 367 367 368 368 struct net_device *dsa_tree_find_first_conduit(struct dsa_switch_tree *dst) 369 369 { 370 - struct device_node *ethernet; 371 - struct net_device *conduit; 372 370 struct dsa_port *cpu_dp; 373 371 374 372 cpu_dp = dsa_tree_find_first_cpu(dst); 375 - ethernet = of_parse_phandle(cpu_dp->dn, "ethernet", 0); 376 - conduit = of_find_net_device_by_node(ethernet); 377 - of_node_put(ethernet); 378 - 379 - return conduit; 373 + return cpu_dp->conduit; 380 374 } 381 375 382 376 /* Assign the default CPU port (the first one in the tree) to all ports of the ··· 1247 1253 if (ethernet) { 1248 1254 struct net_device *conduit; 1249 1255 const char *user_protocol; 1256 + int err; 1250 1257 1258 + rtnl_lock(); 1251 1259 conduit = of_find_net_device_by_node(ethernet); 1252 1260 of_node_put(ethernet); 1253 - if (!conduit) 1261 + if (!conduit) { 1262 + rtnl_unlock(); 1254 1263 return -EPROBE_DEFER; 1264 + } 1265 + 1266 + netdev_hold(conduit, &dp->conduit_tracker, GFP_KERNEL); 1267 + put_device(&conduit->dev); 1268 + rtnl_unlock(); 1255 1269 1256 1270 user_protocol = of_get_property(dn, "dsa-tag-protocol", NULL); 1257 - return dsa_port_parse_cpu(dp, conduit, user_protocol); 1271 + err = dsa_port_parse_cpu(dp, conduit, user_protocol); 1272 + if (err) 1273 + netdev_put(conduit, &dp->conduit_tracker); 1274 + return err; 1258 1275 } 1259 1276 1260 1277 if (link) ··· 1398 1393 return device_find_child(parent, class, dev_is_class); 1399 1394 } 1400 1395 1401 - static struct net_device *dsa_dev_to_net_device(struct device *dev) 1402 - { 1403 - struct device *d; 1404 - 1405 - d = dev_find_class(dev, "net"); 1406 - if (d != NULL) { 1407 - struct net_device *nd; 1408 - 1409 - nd = to_net_dev(d); 1410 - dev_hold(nd); 1411 - put_device(d); 1412 - 1413 - return nd; 1414 - } 1415 - 1416 - return NULL; 1417 - } 1418 - 1419 1396 static int dsa_port_parse(struct dsa_port *dp, const char *name, 1420 1397 struct device *dev) 1421 1398 { 1422 1399 if (!strcmp(name, "cpu")) { 1423 1400 struct net_device *conduit; 1401 + struct device *d; 1402 + int err; 1424 1403 1425 - conduit = dsa_dev_to_net_device(dev); 1426 - if (!conduit) 1404 + rtnl_lock(); 1405 + d = dev_find_class(dev, "net"); 1406 + if (!d) { 1407 + rtnl_unlock(); 1427 1408 return -EPROBE_DEFER; 1409 + } 1428 1410 1429 - dev_put(conduit); 1411 + conduit = to_net_dev(d); 1412 + netdev_hold(conduit, &dp->conduit_tracker, GFP_KERNEL); 1413 + put_device(d); 1414 + rtnl_unlock(); 1430 1415 1431 - return dsa_port_parse_cpu(dp, conduit, NULL); 1416 + err = dsa_port_parse_cpu(dp, conduit, NULL); 1417 + if (err) 1418 + netdev_put(conduit, &dp->conduit_tracker); 1419 + return err; 1432 1420 } 1433 1421 1434 1422 if (!strcmp(name, "dsa")) ··· 1489 1491 struct dsa_vlan *v, *n; 1490 1492 1491 1493 dsa_switch_for_each_port_safe(dp, next, ds) { 1494 + if (dsa_port_is_cpu(dp) && dp->conduit) 1495 + netdev_put(dp->conduit, &dp->conduit_tracker); 1496 + 1492 1497 /* These are either entries that upper layers lost track of 1493 1498 * (probably due to bugs), or installed through interfaces 1494 1499 * where one does not necessarily have to remove them, like ··· 1636 1635 /* Disconnect from further netdevice notifiers on the conduit, 1637 1636 * since netdev_uses_dsa() will now return false. 1638 1637 */ 1639 - dsa_switch_for_each_cpu_port(dp, ds) 1638 + dsa_switch_for_each_cpu_port(dp, ds) { 1640 1639 dp->conduit->dsa_ptr = NULL; 1640 + netdev_put(dp->conduit, &dp->conduit_tracker); 1641 + } 1641 1642 1642 1643 rtnl_unlock(); 1643 1644 out:
+2 -1
net/handshake/netlink.c
··· 126 126 } 127 127 128 128 out_complete: 129 - handshake_complete(req, -EIO, NULL); 129 + if (req) 130 + handshake_complete(req, -EIO, NULL); 130 131 out_status: 131 132 trace_handshake_cmd_accept_err(net, req, NULL, err); 132 133 return err;
+10 -16
net/ipv4/fib_semantics.c
··· 2167 2167 { 2168 2168 struct fib_info *fi = res->fi; 2169 2169 struct net *net = fi->fib_net; 2170 - bool found = false; 2171 2170 bool use_neigh; 2171 + int score = -1; 2172 2172 __be32 saddr; 2173 2173 2174 2174 if (unlikely(res->fi->nh)) { ··· 2180 2180 saddr = fl4 ? fl4->saddr : 0; 2181 2181 2182 2182 change_nexthops(fi) { 2183 - int nh_upper_bound; 2183 + int nh_upper_bound, nh_score = 0; 2184 2184 2185 2185 /* Nexthops without a carrier are assigned an upper bound of 2186 2186 * minus one when "ignore_routes_with_linkdown" is set. ··· 2190 2190 (use_neigh && !fib_good_nh(nexthop_nh))) 2191 2191 continue; 2192 2192 2193 - if (!found) { 2193 + if (saddr && nexthop_nh->nh_saddr == saddr) 2194 + nh_score += 2; 2195 + if (hash <= nh_upper_bound) 2196 + nh_score++; 2197 + if (score < nh_score) { 2194 2198 res->nh_sel = nhsel; 2195 2199 res->nhc = &nexthop_nh->nh_common; 2196 - found = !saddr || nexthop_nh->nh_saddr == saddr; 2200 + if (nh_score == 3 || (!saddr && nh_score == 1)) 2201 + return; 2202 + score = nh_score; 2197 2203 } 2198 - 2199 - if (hash > nh_upper_bound) 2200 - continue; 2201 - 2202 - if (!saddr || nexthop_nh->nh_saddr == saddr) { 2203 - res->nh_sel = nhsel; 2204 - res->nhc = &nexthop_nh->nh_common; 2205 - return; 2206 - } 2207 - 2208 - if (found) 2209 - return; 2210 2204 2211 2205 } endfor_nexthops(fi); 2212 2206 }
+4 -3
net/ipv4/fib_trie.c
··· 2053 2053 continue; 2054 2054 } 2055 2055 2056 - /* Do not flush error routes if network namespace is 2057 - * not being dismantled 2056 + /* When not flushing the entire table, skip error 2057 + * routes that are not marked for deletion. 2058 2058 */ 2059 - if (!flush_all && fib_props[fa->fa_type].error) { 2059 + if (!flush_all && fib_props[fa->fa_type].error && 2060 + !(fi->fib_flags & RTNH_F_DEAD)) { 2060 2061 slen = fa->fa_slen; 2061 2062 continue; 2062 2063 }
+4 -2
net/ipv4/ip_gre.c
··· 330 330 if (!tun_dst) 331 331 return PACKET_REJECT; 332 332 333 + /* MUST set options_len before referencing options */ 334 + info = &tun_dst->u.tun_info; 335 + info->options_len = sizeof(*md); 336 + 333 337 /* skb can be uncloned in __iptunnel_pull_header, so 334 338 * old pkt_md is no longer valid and we need to reset 335 339 * it ··· 348 344 memcpy(md2, pkt_md, ver == 1 ? ERSPAN_V1_MDSIZE : 349 345 ERSPAN_V2_MDSIZE); 350 346 351 - info = &tun_dst->u.tun_info; 352 347 __set_bit(IP_TUNNEL_ERSPAN_OPT_BIT, 353 348 info->key.tun_flags); 354 - info->options_len = sizeof(*md); 355 349 } 356 350 357 351 skb_reset_mac_header(skb);
+2 -1
net/ipv6/calipso.c
··· 1342 1342 /* At this point new_end aligns to 4n, so (new_end & 4) pads to 8n */ 1343 1343 pad = ((new_end & 4) + (end & 7)) & 7; 1344 1344 len_delta = new_end - (int)end + pad; 1345 - ret_val = skb_cow(skb, skb_headroom(skb) + len_delta); 1345 + ret_val = skb_cow(skb, 1346 + skb_headroom(skb) + (len_delta > 0 ? len_delta : 0)); 1346 1347 if (ret_val < 0) 1347 1348 return ret_val; 1348 1349
+12 -3
net/ipv6/ip6_gre.c
··· 535 535 if (!tun_dst) 536 536 return PACKET_REJECT; 537 537 538 + /* MUST set options_len before referencing options */ 539 + info = &tun_dst->u.tun_info; 540 + info->options_len = sizeof(*md); 541 + 538 542 /* skb can be uncloned in __iptunnel_pull_header, so 539 543 * old pkt_md is no longer valid and we need to reset 540 544 * it ··· 547 543 skb_network_header_len(skb); 548 544 pkt_md = (struct erspan_metadata *)(gh + gre_hdr_len + 549 545 sizeof(*ershdr)); 550 - info = &tun_dst->u.tun_info; 551 546 md = ip_tunnel_info_opts(info); 552 547 md->version = ver; 553 548 md2 = &md->u.md2; ··· 554 551 ERSPAN_V2_MDSIZE); 555 552 __set_bit(IP_TUNNEL_ERSPAN_OPT_BIT, 556 553 info->key.tun_flags); 557 - info->options_len = sizeof(*md); 558 554 559 555 ip6_tnl_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error); 560 556 ··· 1368 1366 { 1369 1367 struct ip6_tnl *t = netdev_priv(dev); 1370 1368 struct ipv6hdr *ipv6h; 1369 + int needed; 1371 1370 __be16 *p; 1372 1371 1373 - ipv6h = skb_push(skb, t->hlen + sizeof(*ipv6h)); 1372 + needed = t->hlen + sizeof(*ipv6h); 1373 + if (skb_headroom(skb) < needed && 1374 + pskb_expand_head(skb, HH_DATA_ALIGN(needed - skb_headroom(skb)), 1375 + 0, GFP_ATOMIC)) 1376 + return -needed; 1377 + 1378 + ipv6h = skb_push(skb, needed); 1374 1379 ip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb, 1375 1380 t->fl.u.ip6.flowlabel, 1376 1381 true, &t->fl.u.ip6));
+12 -1
net/ipv6/route.c
··· 1470 1470 1471 1471 p = this_cpu_ptr(res->nh->rt6i_pcpu); 1472 1472 prev = cmpxchg(p, NULL, pcpu_rt); 1473 - BUG_ON(prev); 1473 + if (unlikely(prev)) { 1474 + /* 1475 + * Another task on this CPU already installed a pcpu_rt. 1476 + * This can happen on PREEMPT_RT where preemption is possible. 1477 + * Free our allocation and return the existing one. 1478 + */ 1479 + WARN_ON_ONCE(!IS_ENABLED(CONFIG_PREEMPT_RT)); 1480 + 1481 + dst_dev_put(&pcpu_rt->dst); 1482 + dst_release(&pcpu_rt->dst); 1483 + return prev; 1484 + } 1474 1485 1475 1486 if (res->f6i->fib6_destroying) { 1476 1487 struct fib6_info *from;
-10
net/mac80211/cfg.c
··· 1345 1345 1346 1346 size = sizeof(*new) + new_head_len + new_tail_len; 1347 1347 1348 - /* new or old multiple BSSID elements? */ 1349 1348 if (params->mbssid_ies) { 1350 1349 mbssid = params->mbssid_ies; 1351 1350 size += struct_size(new->mbssid_ies, elem, mbssid->cnt); 1352 1351 if (params->rnr_ies) { 1353 1352 rnr = params->rnr_ies; 1354 - size += struct_size(new->rnr_ies, elem, rnr->cnt); 1355 - } 1356 - size += ieee80211_get_mbssid_beacon_len(mbssid, rnr, 1357 - mbssid->cnt); 1358 - } else if (old && old->mbssid_ies) { 1359 - mbssid = old->mbssid_ies; 1360 - size += struct_size(new->mbssid_ies, elem, mbssid->cnt); 1361 - if (old && old->rnr_ies) { 1362 - rnr = old->rnr_ies; 1363 1353 size += struct_size(new->rnr_ies, elem, rnr->cnt); 1364 1354 } 1365 1355 size += ieee80211_get_mbssid_beacon_len(mbssid, rnr,
+1 -1
net/mac80211/iface.c
··· 1251 1251 if (!creator_sdata) { 1252 1252 struct ieee80211_sub_if_data *other; 1253 1253 1254 - list_for_each_entry(other, &local->mon_list, list) { 1254 + list_for_each_entry_rcu(other, &local->mon_list, u.mntr.list) { 1255 1255 if (!other->vif.bss_conf.mu_mimo_owner) 1256 1256 continue; 1257 1257
+4 -1
net/mac80211/mlme.c
··· 1126 1126 1127 1127 while (!ieee80211_chandef_usable(sdata, &chanreq->oper, 1128 1128 IEEE80211_CHAN_DISABLED)) { 1129 - if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) { 1129 + if (chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT) { 1130 + link_id_info(sdata, link_id, 1131 + "unusable channel (%d MHz) for connection\n", 1132 + chanreq->oper.chan->center_freq); 1130 1133 ret = -EINVAL; 1131 1134 goto free; 1132 1135 }
+3
net/mac80211/ocb.c
··· 47 47 struct sta_info *sta; 48 48 int band; 49 49 50 + if (!ifocb->joined) 51 + return; 52 + 50 53 /* XXX: Consider removing the least recently used entry and 51 54 * allow new one to be added. 52 55 */
+5
net/mac80211/rx.c
··· 3511 3511 rx->skb->len < IEEE80211_MIN_ACTION_SIZE) 3512 3512 return RX_DROP_U_RUNT_ACTION; 3513 3513 3514 + /* Drop non-broadcast Beacon frames */ 3515 + if (ieee80211_is_beacon(mgmt->frame_control) && 3516 + !is_broadcast_ether_addr(mgmt->da)) 3517 + return RX_DROP; 3518 + 3514 3519 if (rx->sdata->vif.type == NL80211_IFTYPE_AP && 3515 3520 ieee80211_is_beacon(mgmt->frame_control) && 3516 3521 !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {
+10
net/mptcp/options.c
··· 408 408 */ 409 409 subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; 410 410 if (subflow->request_mptcp) { 411 + if (unlikely(subflow_simultaneous_connect(sk))) { 412 + WARN_ON_ONCE(!mptcp_try_fallback(sk, MPTCP_MIB_SIMULTCONNFALLBACK)); 413 + 414 + /* Ensure mptcp_finish_connect() will not process the 415 + * MPC handshake. 416 + */ 417 + subflow->request_mptcp = 0; 418 + return false; 419 + } 420 + 411 421 opts->suboptions = OPTION_MPTCP_MPC_SYN; 412 422 opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk)); 413 423 opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk));
+5 -3
net/mptcp/protocol.c
··· 2467 2467 */ 2468 2468 static void __mptcp_subflow_disconnect(struct sock *ssk, 2469 2469 struct mptcp_subflow_context *subflow, 2470 - unsigned int flags) 2470 + bool fastclosing) 2471 2471 { 2472 2472 if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || 2473 - subflow->send_fastclose) { 2473 + fastclosing) { 2474 2474 /* The MPTCP code never wait on the subflow sockets, TCP-level 2475 2475 * disconnect should never fail 2476 2476 */ ··· 2538 2538 2539 2539 need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); 2540 2540 if (!dispose_it) { 2541 - __mptcp_subflow_disconnect(ssk, subflow, flags); 2541 + __mptcp_subflow_disconnect(ssk, subflow, msk->fastclosing); 2542 2542 release_sock(ssk); 2543 2543 2544 2544 goto out; ··· 2884 2884 2885 2885 mptcp_set_state(sk, TCP_CLOSE); 2886 2886 mptcp_backlog_purge(sk); 2887 + msk->fastclosing = 1; 2887 2888 2888 2889 /* Explicitly send the fastclose reset as need */ 2889 2890 if (__mptcp_check_fallback(msk)) ··· 3419 3418 msk->bytes_sent = 0; 3420 3419 msk->bytes_retrans = 0; 3421 3420 msk->rcvspace_init = 0; 3421 + msk->fastclosing = 0; 3422 3422 3423 3423 /* for fallback's sake */ 3424 3424 WRITE_ONCE(msk->ack_seq, 0);
+4 -5
net/mptcp/protocol.h
··· 320 320 fastopening:1, 321 321 in_accept_queue:1, 322 322 free_first:1, 323 - rcvspace_init:1; 323 + rcvspace_init:1, 324 + fastclosing:1; 324 325 u32 notsent_lowat; 325 326 int keepalive_cnt; 326 327 int keepalive_idle; ··· 1338 1337 { 1339 1338 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1340 1339 1341 - return (1 << sk->sk_state) & 1342 - (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && 1343 - is_active_ssk(subflow) && 1344 - !subflow->conn_finished; 1340 + /* Note that the sk state implies !subflow->conn_finished. */ 1341 + return sk->sk_state == TCP_SYN_RECV && is_active_ssk(subflow); 1345 1342 } 1346 1343 1347 1344 #ifdef CONFIG_SYN_COOKIES
-6
net/mptcp/subflow.c
··· 1878 1878 1879 1879 __subflow_state_change(sk); 1880 1880 1881 - if (subflow_simultaneous_connect(sk)) { 1882 - WARN_ON_ONCE(!mptcp_try_fallback(sk, MPTCP_MIB_SIMULTCONNFALLBACK)); 1883 - subflow->conn_finished = 1; 1884 - mptcp_propagate_state(parent, sk, subflow, NULL); 1885 - } 1886 - 1887 1881 /* as recvmsg() does not acquire the subflow socket for ssk selection 1888 1882 * a fin packet carrying a DSS can be unnoticed if we don't trigger 1889 1883 * the data available machinery here.
+7 -2
net/nfc/core.c
··· 1154 1154 void nfc_unregister_device(struct nfc_dev *dev) 1155 1155 { 1156 1156 int rc; 1157 + struct rfkill *rfk = NULL; 1157 1158 1158 1159 pr_debug("dev_name=%s\n", dev_name(&dev->dev)); 1159 1160 ··· 1165 1164 1166 1165 device_lock(&dev->dev); 1167 1166 if (dev->rfkill) { 1168 - rfkill_unregister(dev->rfkill); 1169 - rfkill_destroy(dev->rfkill); 1167 + rfk = dev->rfkill; 1170 1168 dev->rfkill = NULL; 1171 1169 } 1172 1170 dev->shutting_down = true; 1173 1171 device_unlock(&dev->dev); 1172 + 1173 + if (rfk) { 1174 + rfkill_unregister(rfk); 1175 + rfkill_destroy(rfk); 1176 + } 1174 1177 1175 1178 if (dev->ops->check_presence) { 1176 1179 timer_delete_sync(&dev->check_pres_timer);
+13 -4
net/openvswitch/vport-netdev.c
··· 160 160 161 161 static void netdev_destroy(struct vport *vport) 162 162 { 163 - rtnl_lock(); 164 - if (netif_is_ovs_port(vport->dev)) 165 - ovs_netdev_detach_dev(vport); 166 - rtnl_unlock(); 163 + /* When called from ovs_db_notify_wq() after a dp_device_event(), the 164 + * port has already been detached, so we can avoid taking the RTNL by 165 + * checking this first. 166 + */ 167 + if (netif_is_ovs_port(vport->dev)) { 168 + rtnl_lock(); 169 + /* Check again while holding the lock to ensure we don't race 170 + * with the netdev notifier and detach twice. 171 + */ 172 + if (netif_is_ovs_port(vport->dev)) 173 + ovs_netdev_detach_dev(vport); 174 + rtnl_unlock(); 175 + } 167 176 168 177 call_rcu(&vport->rcu, vport_netdev_free); 169 178 }
+1 -1
net/rose/af_rose.c
··· 205 205 spin_unlock_bh(&rose_list_lock); 206 206 207 207 for (i = 0; i < cnt; i++) { 208 - sk = array[cnt]; 208 + sk = array[i]; 209 209 rose = rose_sk(sk); 210 210 lock_sock(sk); 211 211 spin_lock_bh(&rose_list_lock);
+8 -3
net/unix/af_unix.c
··· 2904 2904 unsigned int last_len; 2905 2905 struct unix_sock *u; 2906 2906 int copied = 0; 2907 + bool do_cmsg; 2907 2908 int err = 0; 2908 2909 long timeo; 2909 2910 int target; ··· 2930 2929 2931 2930 u = unix_sk(sk); 2932 2931 2932 + do_cmsg = READ_ONCE(u->recvmsg_inq); 2933 + if (do_cmsg) 2934 + msg->msg_get_inq = 1; 2933 2935 redo: 2934 2936 /* Lock the socket to prevent queue disordering 2935 2937 * while sleeps in memcpy_tomsg ··· 3092 3088 if (msg) { 3093 3089 scm_recv_unix(sock, msg, &scm, flags); 3094 3090 3095 - if (READ_ONCE(u->recvmsg_inq) || msg->msg_get_inq) { 3091 + if (msg->msg_get_inq && (copied ?: err) >= 0) { 3096 3092 msg->msg_inq = READ_ONCE(u->inq_len); 3097 - put_cmsg(msg, SOL_SOCKET, SCM_INQ, 3098 - sizeof(msg->msg_inq), &msg->msg_inq); 3093 + if (do_cmsg) 3094 + put_cmsg(msg, SOL_SOCKET, SCM_INQ, 3095 + sizeof(msg->msg_inq), &msg->msg_inq); 3099 3096 } 3100 3097 } else { 3101 3098 scm_destroy(&scm);
+1 -1
net/wireless/sme.c
··· 910 910 911 911 ssid_len = min(ssid->datalen, IEEE80211_MAX_SSID_LEN); 912 912 memcpy(wdev->u.client.ssid, ssid->data, ssid_len); 913 - wdev->u.client.ssid_len = ssid->datalen; 913 + wdev->u.client.ssid_len = ssid_len; 914 914 break; 915 915 } 916 916 rcu_read_unlock();
+4 -2
tools/testing/selftests/drivers/net/psp.py
··· 573 573 """Build test cases for each combo of PSP version and IP version""" 574 574 def test_case(cfg): 575 575 cfg.require_ipver(ipver) 576 - test_case.__name__ = f"{name}_v{psp_ver}_ip{ipver}" 577 576 test_func(cfg, psp_ver, ipver) 577 + 578 + test_case.__name__ = f"{name}_v{psp_ver}_ip{ipver}" 578 579 return test_case 579 580 580 581 ··· 583 582 """Build test cases for each IP version""" 584 583 def test_case(cfg): 585 584 cfg.require_ipver(ipver) 586 - test_case.__name__ = f"{name}_ip{ipver}" 587 585 test_func(cfg, ipver) 586 + 587 + test_case.__name__ = f"{name}_ip{ipver}" 588 588 return test_case 589 589 590 590
+15
tools/testing/selftests/net/fib_nexthops.sh
··· 800 800 set +e 801 801 check_nexthop "dev veth1" "" 802 802 log_test $? 0 "Nexthops removed on admin down" 803 + 804 + # error routes should be deleted when their nexthop is deleted 805 + run_cmd "$IP li set dev veth1 up" 806 + run_cmd "$IP -6 nexthop add id 58 dev veth1" 807 + run_cmd "$IP ro add blackhole 2001:db8:101::1/128 nhid 58" 808 + run_cmd "$IP nexthop del id 58" 809 + check_route6 "2001:db8:101::1" "" 810 + log_test $? 0 "Error route removed on nexthop deletion" 803 811 } 804 812 805 813 ipv6_grp_refs() ··· 1467 1459 1468 1460 run_cmd "$IP ro del 172.16.102.0/24" 1469 1461 log_test $? 0 "Delete route when not specifying nexthop attributes" 1462 + 1463 + # error routes should be deleted when their nexthop is deleted 1464 + run_cmd "$IP nexthop add id 23 dev veth1" 1465 + run_cmd "$IP ro add blackhole 172.16.102.100/32 nhid 23" 1466 + run_cmd "$IP nexthop del id 23" 1467 + check_route "172.16.102.100" "" 1468 + log_test $? 0 "Error route removed on nexthop deletion" 1470 1469 } 1471 1470 1472 1471 ipv4_grp_fcnal()
+69 -1
tools/testing/selftests/net/fib_tests.sh
··· 12 12 ipv4_route_metrics ipv4_route_v6_gw rp_filter ipv4_del_addr \ 13 13 ipv6_del_addr ipv4_mangle ipv6_mangle ipv4_bcast_neigh fib6_gc_test \ 14 14 ipv4_mpath_list ipv6_mpath_list ipv4_mpath_balance ipv6_mpath_balance \ 15 - fib6_ra_to_static" 15 + ipv4_mpath_balance_preferred fib6_ra_to_static" 16 16 17 17 VERBOSE=0 18 18 PAUSE_ON_FAIL=no ··· 2751 2751 forwarding_cleanup 2752 2752 } 2753 2753 2754 + get_route_dev_src() 2755 + { 2756 + local pfx="$1" 2757 + local src="$2" 2758 + local out 2759 + 2760 + if out=$($IP -j route get "$pfx" from "$src" | jq -re ".[0].dev"); then 2761 + echo "$out" 2762 + fi 2763 + } 2764 + 2765 + ipv4_mpath_preferred() 2766 + { 2767 + local src_ip=$1 2768 + local pref_dev=$2 2769 + local dev routes 2770 + local route0=0 2771 + local route1=0 2772 + local pref_route=0 2773 + num_routes=254 2774 + 2775 + for i in $(seq 1 $num_routes) ; do 2776 + dev=$(get_route_dev_src 172.16.105.$i $src_ip) 2777 + if [ "$dev" = "$pref_dev" ]; then 2778 + pref_route=$((pref_route+1)) 2779 + elif [ "$dev" = "veth1" ]; then 2780 + route0=$((route0+1)) 2781 + elif [ "$dev" = "veth3" ]; then 2782 + route1=$((route1+1)) 2783 + fi 2784 + done 2785 + 2786 + routes=$((route0+route1)) 2787 + 2788 + [ "$VERBOSE" = "1" ] && echo "multipath: routes seen: ($route0,$route1,$pref_route)" 2789 + 2790 + if [ x"$pref_dev" = x"" ]; then 2791 + [[ $routes -ge $num_routes ]] && [[ $route0 -gt 0 ]] && [[ $route1 -gt 0 ]] 2792 + else 2793 + [[ $pref_route -ge $num_routes ]] 2794 + fi 2795 + 2796 + } 2797 + 2798 + ipv4_mpath_balance_preferred_test() 2799 + { 2800 + echo 2801 + echo "IPv4 multipath load balance preferred route" 2802 + 2803 + forwarding_setup 2804 + 2805 + $IP route add 172.16.105.0/24 \ 2806 + nexthop via 172.16.101.2 \ 2807 + nexthop via 172.16.103.2 2808 + 2809 + ipv4_mpath_preferred 172.16.101.1 veth1 2810 + log_test $? 0 "IPv4 multipath loadbalance from veth1" 2811 + 2812 + ipv4_mpath_preferred 172.16.103.1 veth3 2813 + log_test $? 0 "IPv4 multipath loadbalance from veth3" 2814 + 2815 + ipv4_mpath_preferred 198.51.100.1 2816 + log_test $? 0 "IPv4 multipath loadbalance from dummy" 2817 + 2818 + forwarding_cleanup 2819 + } 2820 + 2754 2821 ipv6_mpath_balance_test() 2755 2822 { 2756 2823 echo ··· 2928 2861 ipv6_mpath_list) ipv6_mpath_list_test;; 2929 2862 ipv4_mpath_balance) ipv4_mpath_balance_test;; 2930 2863 ipv6_mpath_balance) ipv6_mpath_balance_test;; 2864 + ipv4_mpath_balance_preferred) ipv4_mpath_balance_preferred_test;; 2931 2865 fib6_ra_to_static) fib6_ra_to_static;; 2932 2866 2933 2867 help) echo "Test names: $TESTS"; exit 0;;
+5 -11
tools/testing/selftests/net/tap.c
··· 56 56 static struct rtattr *rtattr_add_str(struct nlmsghdr *nh, unsigned short type, 57 57 const char *s) 58 58 { 59 - struct rtattr *rta = rtattr_add(nh, type, strlen(s)); 59 + unsigned int strsz = strlen(s) + 1; 60 + struct rtattr *rta; 60 61 61 - memcpy(RTA_DATA(rta), s, strlen(s)); 62 - return rta; 63 - } 62 + rta = rtattr_add(nh, type, strsz); 64 63 65 - static struct rtattr *rtattr_add_strsz(struct nlmsghdr *nh, unsigned short type, 66 - const char *s) 67 - { 68 - struct rtattr *rta = rtattr_add(nh, type, strlen(s) + 1); 69 - 70 - strcpy(RTA_DATA(rta), s); 64 + memcpy(RTA_DATA(rta), s, strsz); 71 65 return rta; 72 66 } 73 67 ··· 113 119 114 120 link_info = rtattr_begin(&req.nh, IFLA_LINKINFO); 115 121 116 - rtattr_add_strsz(&req.nh, IFLA_INFO_KIND, link_type); 122 + rtattr_add_str(&req.nh, IFLA_INFO_KIND, link_type); 117 123 118 124 if (fill_info_data) { 119 125 info_data = rtattr_begin(&req.nh, IFLA_INFO_DATA);