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

Pull networking fixes from David Miller:

1) Fix sk_psock reference count leak on receive, from Xiyu Yang.

2) CONFIG_HNS should be invisible, from Geert Uytterhoeven.

3) Don't allow locking route MTUs in ipv6, RFCs actually forbid this,
from Maciej Żenczykowski.

4) ipv4 route redirect backoff wasn't actually enforced, from Paolo
Abeni.

5) Fix netprio cgroup v2 leak, from Zefan Li.

6) Fix infinite loop on rmmod in conntrack, from Florian Westphal.

7) Fix tcp SO_RCVLOWAT hangs, from Eric Dumazet.

8) Various bpf probe handling fixes, from Daniel Borkmann.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (68 commits)
selftests: mptcp: pm: rm the right tmp file
dpaa2-eth: properly handle buffer size restrictions
bpf: Restrict bpf_trace_printk()'s %s usage and add %pks, %pus specifier
bpf: Add bpf_probe_read_{user, kernel}_str() to do_refine_retval_range
bpf: Restrict bpf_probe_read{, str}() only to archs where they work
MAINTAINERS: Mark networking drivers as Maintained.
ipmr: Add lockdep expression to ipmr_for_each_table macro
ipmr: Fix RCU list debugging warning
drivers: net: hamradio: Fix suspicious RCU usage warning in bpqether.c
net: phy: broadcom: fix BCM54XX_SHD_SCR3_TRDDAPD value for BCM54810
tcp: fix error recovery in tcp_zerocopy_receive()
MAINTAINERS: Add Jakub to networking drivers.
MAINTAINERS: another add of Karsten Graul for S390 networking
drivers: ipa: fix typos for ipa_smp2p structure doc
pppoe: only process PADT targeted at local interfaces
selftests/bpf: Enforce returning 0 for fentry/fexit programs
bpf: Enforce returning 0 for fentry/fexit progs
net: stmmac: fix num_por initialization
security: Fix the default value of secid_to_secctx hook
libbpf: Fix register naming in PT_REGS s390 macros
...

+460 -205
+14
Documentation/core-api/printk-formats.rst
··· 112 112 consideration the effect of compiler optimisations which may occur 113 113 when tail-calls are used and marked with the noreturn GCC attribute. 114 114 115 + Probed Pointers from BPF / tracing 116 + ---------------------------------- 117 + 118 + :: 119 + 120 + %pks kernel string 121 + %pus user string 122 + 123 + The ``k`` and ``u`` specifiers are used for printing prior probed memory from 124 + either kernel memory (k) or user memory (u). The subsequent ``s`` specifier 125 + results in printing a string. For direct use in regular vsnprintf() the (k) 126 + and (u) annotation is ignored, however, when used out of BPF's bpf_trace_printk(), 127 + for example, it reads the memory it is pointing to without faulting. 128 + 115 129 Kernel Pointers 116 130 --------------- 117 131
+4 -1
MAINTAINERS
··· 11710 11710 11711 11711 NETWORKING DRIVERS 11712 11712 M: "David S. Miller" <davem@davemloft.net> 11713 + M: Jakub Kicinski <kuba@kernel.org> 11713 11714 L: netdev@vger.kernel.org 11714 - S: Odd Fixes 11715 + S: Maintained 11715 11716 W: http://www.linuxfoundation.org/en/Net 11716 11717 Q: http://patchwork.ozlabs.org/project/netdev/list/ 11717 11718 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git ··· 14635 14634 14636 14635 S390 IUCV NETWORK LAYER 14637 14636 M: Julian Wiedmann <jwi@linux.ibm.com> 14637 + M: Karsten Graul <kgraul@linux.ibm.com> 14638 14638 M: Ursula Braun <ubraun@linux.ibm.com> 14639 14639 L: linux-s390@vger.kernel.org 14640 14640 S: Supported ··· 14646 14644 14647 14645 S390 NETWORK DRIVERS 14648 14646 M: Julian Wiedmann <jwi@linux.ibm.com> 14647 + M: Karsten Graul <kgraul@linux.ibm.com> 14649 14648 M: Ursula Braun <ubraun@linux.ibm.com> 14650 14649 L: linux-s390@vger.kernel.org 14651 14650 S: Supported
+1
arch/arm/Kconfig
··· 12 12 select ARCH_HAS_KEEPINITRD 13 13 select ARCH_HAS_KCOV 14 14 select ARCH_HAS_MEMBARRIER_SYNC_CORE 15 + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 15 16 select ARCH_HAS_PTE_SPECIAL if ARM_LPAE 16 17 select ARCH_HAS_PHYS_TO_DMA 17 18 select ARCH_HAS_SETUP_DMA_OPS
+1
arch/arm/configs/keystone_defconfig
··· 147 147 CONFIG_SPI=y 148 148 CONFIG_SPI_DAVINCI=y 149 149 CONFIG_SPI_SPIDEV=y 150 + CONFIG_PTP_1588_CLOCK=y 150 151 CONFIG_PINCTRL_SINGLE=y 151 152 CONFIG_GPIOLIB=y 152 153 CONFIG_GPIO_SYSFS=y
+1
arch/arm/configs/omap2plus_defconfig
··· 274 274 CONFIG_HSI=m 275 275 CONFIG_OMAP_SSI=m 276 276 CONFIG_SSI_PROTOCOL=m 277 + CONFIG_PTP_1588_CLOCK=y 277 278 CONFIG_PINCTRL_SINGLE=y 278 279 CONFIG_DEBUG_GPIO=y 279 280 CONFIG_GPIO_SYSFS=y
+1
arch/arm64/Kconfig
··· 20 20 select ARCH_HAS_KCOV 21 21 select ARCH_HAS_KEEPINITRD 22 22 select ARCH_HAS_MEMBARRIER_SYNC_CORE 23 + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 23 24 select ARCH_HAS_PTE_DEVMAP 24 25 select ARCH_HAS_PTE_SPECIAL 25 26 select ARCH_HAS_SETUP_DMA_OPS
+1
arch/x86/Kconfig
··· 68 68 select ARCH_HAS_KCOV if X86_64 69 69 select ARCH_HAS_MEM_ENCRYPT 70 70 select ARCH_HAS_MEMBARRIER_SYNC_CORE 71 + select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 71 72 select ARCH_HAS_PMEM_API if X86_64 72 73 select ARCH_HAS_PTE_DEVMAP if X86_64 73 74 select ARCH_HAS_PTE_SPECIAL
+4 -14
drivers/net/bareudp.c
··· 136 136 oiph = skb_network_header(skb); 137 137 skb_reset_network_header(skb); 138 138 139 - if (family == AF_INET) 139 + if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET) 140 140 err = IP_ECN_decapsulate(oiph, skb); 141 - #if IS_ENABLED(CONFIG_IPV6) 142 141 else 143 142 err = IP6_ECN_decapsulate(oiph, skb); 144 - #endif 145 143 146 144 if (unlikely(err)) { 147 145 if (log_ecn_error) { 148 - if (family == AF_INET) 146 + if (!IS_ENABLED(CONFIG_IPV6) || family == AF_INET) 149 147 net_info_ratelimited("non-ECT from %pI4 " 150 148 "with TOS=%#x\n", 151 149 &((struct iphdr *)oiph)->saddr, 152 150 ((struct iphdr *)oiph)->tos); 153 - #if IS_ENABLED(CONFIG_IPV6) 154 151 else 155 152 net_info_ratelimited("non-ECT from %pI6\n", 156 153 &((struct ipv6hdr *)oiph)->saddr); 157 - #endif 158 154 } 159 155 if (err > 1) { 160 156 ++bareudp->dev->stats.rx_frame_errors; ··· 346 350 return err; 347 351 } 348 352 349 - #if IS_ENABLED(CONFIG_IPV6) 350 353 static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev, 351 354 struct bareudp_dev *bareudp, 352 355 const struct ip_tunnel_info *info) ··· 406 411 dst_release(dst); 407 412 return err; 408 413 } 409 - #endif 410 414 411 415 static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) 412 416 { ··· 429 435 } 430 436 431 437 rcu_read_lock(); 432 - #if IS_ENABLED(CONFIG_IPV6) 433 - if (info->mode & IP_TUNNEL_INFO_IPV6) 438 + if (IS_ENABLED(CONFIG_IPV6) && info->mode & IP_TUNNEL_INFO_IPV6) 434 439 err = bareudp6_xmit_skb(skb, dev, bareudp, info); 435 440 else 436 - #endif 437 441 err = bareudp_xmit_skb(skb, dev, bareudp, info); 438 442 439 443 rcu_read_unlock(); ··· 459 467 460 468 use_cache = ip_tunnel_dst_cache_usable(skb, info); 461 469 462 - if (ip_tunnel_info_af(info) == AF_INET) { 470 + if (!IS_ENABLED(CONFIG_IPV6) || ip_tunnel_info_af(info) == AF_INET) { 463 471 struct rtable *rt; 464 472 __be32 saddr; 465 473 ··· 470 478 471 479 ip_rt_put(rt); 472 480 info->key.u.ipv4.src = saddr; 473 - #if IS_ENABLED(CONFIG_IPV6) 474 481 } else if (ip_tunnel_info_af(info) == AF_INET6) { 475 482 struct dst_entry *dst; 476 483 struct in6_addr saddr; ··· 483 492 484 493 dst_release(dst); 485 494 info->key.u.ipv6.src = saddr; 486 - #endif 487 495 } else { 488 496 return -EINVAL; 489 497 }
+1
drivers/net/dsa/dsa_loop.c
··· 360 360 } 361 361 module_exit(dsa_loop_exit); 362 362 363 + MODULE_SOFTDEP("pre: dsa_loop_bdinfo"); 363 364 MODULE_LICENSE("GPL"); 364 365 MODULE_AUTHOR("Florian Fainelli"); 365 366 MODULE_DESCRIPTION("DSA loopback driver");
+1
drivers/net/ethernet/broadcom/Kconfig
··· 69 69 select BCM7XXX_PHY 70 70 select MDIO_BCM_UNIMAC 71 71 select DIMLIB 72 + select BROADCOM_PHY if ARCH_BCM2835 72 73 help 73 74 This driver supports the built-in Ethernet MACs found in the 74 75 Broadcom BCM7xxx Set Top Box family chipset.
+2
drivers/net/ethernet/freescale/Kconfig
··· 77 77 depends on QUICC_ENGINE && PPC32 78 78 select FSL_PQ_MDIO 79 79 select PHYLIB 80 + select FIXED_PHY 80 81 ---help--- 81 82 This driver supports the Gigabit Ethernet mode of the QUICC Engine, 82 83 which is available on some Freescale SOCs. ··· 91 90 depends on HAS_DMA 92 91 select FSL_PQ_MDIO 93 92 select PHYLIB 93 + select FIXED_PHY 94 94 select CRC32 95 95 ---help--- 96 96 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
+1
drivers/net/ethernet/freescale/dpaa/Kconfig
··· 3 3 tristate "DPAA Ethernet" 4 4 depends on FSL_DPAA && FSL_FMAN 5 5 select PHYLIB 6 + select FIXED_PHY 6 7 select FSL_FMAN_MAC 7 8 ---help--- 8 9 Data Path Acceleration Architecture Ethernet driver,
+17 -12
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
··· 86 86 for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) { 87 87 addr = dpaa2_sg_get_addr(&sgt[i]); 88 88 sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); 89 - dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE, 89 + dma_unmap_page(dev, addr, priv->rx_buf_size, 90 90 DMA_BIDIRECTIONAL); 91 91 92 92 free_pages((unsigned long)sg_vaddr, 0); ··· 144 144 /* Get the address and length from the S/G entry */ 145 145 sg_addr = dpaa2_sg_get_addr(sge); 146 146 sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, sg_addr); 147 - dma_unmap_page(dev, sg_addr, DPAA2_ETH_RX_BUF_SIZE, 147 + dma_unmap_page(dev, sg_addr, priv->rx_buf_size, 148 148 DMA_BIDIRECTIONAL); 149 149 150 150 sg_length = dpaa2_sg_get_len(sge); ··· 185 185 (page_address(page) - page_address(head_page)); 186 186 187 187 skb_add_rx_frag(skb, i - 1, head_page, page_offset, 188 - sg_length, DPAA2_ETH_RX_BUF_SIZE); 188 + sg_length, priv->rx_buf_size); 189 189 } 190 190 191 191 if (dpaa2_sg_is_final(sge)) ··· 211 211 212 212 for (i = 0; i < count; i++) { 213 213 vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]); 214 - dma_unmap_page(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE, 214 + dma_unmap_page(dev, buf_array[i], priv->rx_buf_size, 215 215 DMA_BIDIRECTIONAL); 216 216 free_pages((unsigned long)vaddr, 0); 217 217 } ··· 335 335 break; 336 336 case XDP_REDIRECT: 337 337 dma_unmap_page(priv->net_dev->dev.parent, addr, 338 - DPAA2_ETH_RX_BUF_SIZE, DMA_BIDIRECTIONAL); 338 + priv->rx_buf_size, DMA_BIDIRECTIONAL); 339 339 ch->buf_count--; 340 340 xdp.data_hard_start = vaddr; 341 341 err = xdp_do_redirect(priv->net_dev, &xdp, xdp_prog); ··· 374 374 trace_dpaa2_rx_fd(priv->net_dev, fd); 375 375 376 376 vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr); 377 - dma_sync_single_for_cpu(dev, addr, DPAA2_ETH_RX_BUF_SIZE, 377 + dma_sync_single_for_cpu(dev, addr, priv->rx_buf_size, 378 378 DMA_BIDIRECTIONAL); 379 379 380 380 fas = dpaa2_get_fas(vaddr, false); ··· 393 393 return; 394 394 } 395 395 396 - dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE, 396 + dma_unmap_page(dev, addr, priv->rx_buf_size, 397 397 DMA_BIDIRECTIONAL); 398 398 skb = build_linear_skb(ch, fd, vaddr); 399 399 } else if (fd_format == dpaa2_fd_sg) { 400 400 WARN_ON(priv->xdp_prog); 401 401 402 - dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE, 402 + dma_unmap_page(dev, addr, priv->rx_buf_size, 403 403 DMA_BIDIRECTIONAL); 404 404 skb = build_frag_skb(priv, ch, buf_data); 405 405 free_pages((unsigned long)vaddr, 0); ··· 974 974 if (!page) 975 975 goto err_alloc; 976 976 977 - addr = dma_map_page(dev, page, 0, DPAA2_ETH_RX_BUF_SIZE, 977 + addr = dma_map_page(dev, page, 0, priv->rx_buf_size, 978 978 DMA_BIDIRECTIONAL); 979 979 if (unlikely(dma_mapping_error(dev, addr))) 980 980 goto err_map; ··· 984 984 /* tracing point */ 985 985 trace_dpaa2_eth_buf_seed(priv->net_dev, 986 986 page, DPAA2_ETH_RX_BUF_RAW_SIZE, 987 - addr, DPAA2_ETH_RX_BUF_SIZE, 987 + addr, priv->rx_buf_size, 988 988 bpid); 989 989 } 990 990 ··· 1720 1720 int mfl, linear_mfl; 1721 1721 1722 1722 mfl = DPAA2_ETH_L2_MAX_FRM(mtu); 1723 - linear_mfl = DPAA2_ETH_RX_BUF_SIZE - DPAA2_ETH_RX_HWA_SIZE - 1723 + linear_mfl = priv->rx_buf_size - DPAA2_ETH_RX_HWA_SIZE - 1724 1724 dpaa2_eth_rx_head_room(priv) - XDP_PACKET_HEADROOM; 1725 1725 1726 1726 if (mfl > linear_mfl) { ··· 2462 2462 else 2463 2463 rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN; 2464 2464 2465 + /* We need to ensure that the buffer size seen by WRIOP is a multiple 2466 + * of 64 or 256 bytes depending on the WRIOP version. 2467 + */ 2468 + priv->rx_buf_size = ALIGN_DOWN(DPAA2_ETH_RX_BUF_SIZE, rx_buf_align); 2469 + 2465 2470 /* tx buffer */ 2466 2471 buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE; 2467 2472 buf_layout.pass_timestamp = true; ··· 3131 3126 pools_params.num_dpbp = 1; 3132 3127 pools_params.pools[0].dpbp_id = priv->dpbp_dev->obj_desc.id; 3133 3128 pools_params.pools[0].backup_pool = 0; 3134 - pools_params.pools[0].buffer_size = DPAA2_ETH_RX_BUF_SIZE; 3129 + pools_params.pools[0].buffer_size = priv->rx_buf_size; 3135 3130 err = dpni_set_pools(priv->mc_io, 0, priv->mc_token, &pools_params); 3136 3131 if (err) { 3137 3132 dev_err(dev, "dpni_set_pools() failed\n");
+1
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
··· 382 382 u16 tx_data_offset; 383 383 384 384 struct fsl_mc_device *dpbp_dev; 385 + u16 rx_buf_size; 385 386 u16 bpid; 386 387 struct iommu_domain *iommu_domain; 387 388
+1 -1
drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c
··· 635 635 636 636 static int update_cls_rule(struct net_device *net_dev, 637 637 struct ethtool_rx_flow_spec *new_fs, 638 - int location) 638 + unsigned int location) 639 639 { 640 640 struct dpaa2_eth_priv *priv = netdev_priv(net_dev); 641 641 struct dpaa2_eth_cls_rule *rule;
+1 -1
drivers/net/ethernet/hisilicon/Kconfig
··· 64 64 the PHY 65 65 66 66 config HNS 67 - tristate "Hisilicon Network Subsystem Support (Framework)" 67 + tristate 68 68 ---help--- 69 69 This selects the framework support for Hisilicon Network Subsystem. It 70 70 is needed by any driver which provides HNS acceleration engine or make
+12 -4
drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c
··· 45 45 46 46 #define MGMT_MSG_TIMEOUT 5000 47 47 48 + #define SET_FUNC_PORT_MGMT_TIMEOUT 25000 49 + 48 50 #define mgmt_to_pfhwdev(pf_mgmt) \ 49 51 container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt) 50 52 ··· 240 238 u8 *buf_in, u16 in_size, 241 239 u8 *buf_out, u16 *out_size, 242 240 enum mgmt_direction_type direction, 243 - u16 resp_msg_id) 241 + u16 resp_msg_id, u32 timeout) 244 242 { 245 243 struct hinic_hwif *hwif = pf_to_mgmt->hwif; 246 244 struct pci_dev *pdev = hwif->pdev; 247 245 struct hinic_recv_msg *recv_msg; 248 246 struct completion *recv_done; 247 + unsigned long timeo; 249 248 u16 msg_id; 250 249 int err; 251 250 ··· 270 267 goto unlock_sync_msg; 271 268 } 272 269 273 - if (!wait_for_completion_timeout(recv_done, 274 - msecs_to_jiffies(MGMT_MSG_TIMEOUT))) { 270 + timeo = msecs_to_jiffies(timeout ? timeout : MGMT_MSG_TIMEOUT); 271 + 272 + if (!wait_for_completion_timeout(recv_done, timeo)) { 275 273 dev_err(&pdev->dev, "MGMT timeout, MSG id = %d\n", msg_id); 276 274 err = -ETIMEDOUT; 277 275 goto unlock_sync_msg; ··· 346 342 { 347 343 struct hinic_hwif *hwif = pf_to_mgmt->hwif; 348 344 struct pci_dev *pdev = hwif->pdev; 345 + u32 timeout = 0; 349 346 350 347 if (sync != HINIC_MGMT_MSG_SYNC) { 351 348 dev_err(&pdev->dev, "Invalid MGMT msg type\n"); ··· 358 353 return -EINVAL; 359 354 } 360 355 356 + if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE) 357 + timeout = SET_FUNC_PORT_MGMT_TIMEOUT; 358 + 361 359 return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size, 362 360 buf_out, out_size, MGMT_DIRECT_SEND, 363 - MSG_NOT_RESP); 361 + MSG_NOT_RESP, timeout); 364 362 } 365 363 366 364 /**
+2 -14
drivers/net/ethernet/huawei/hinic/hinic_main.c
··· 483 483 { 484 484 struct hinic_dev *nic_dev = netdev_priv(netdev); 485 485 unsigned int flags; 486 - int err; 487 486 488 487 down(&nic_dev->mgmt_lock); 489 488 ··· 496 497 497 498 up(&nic_dev->mgmt_lock); 498 499 499 - err = hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE); 500 - if (err) { 501 - netif_err(nic_dev, drv, netdev, 502 - "Failed to set func port state\n"); 503 - nic_dev->flags |= (flags & HINIC_INTF_UP); 504 - return err; 505 - } 500 + hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE); 506 501 507 - err = hinic_port_set_state(nic_dev, HINIC_PORT_DISABLE); 508 - if (err) { 509 - netif_err(nic_dev, drv, netdev, "Failed to set port state\n"); 510 - nic_dev->flags |= (flags & HINIC_INTF_UP); 511 - return err; 512 - } 502 + hinic_port_set_func_state(nic_dev, HINIC_FUNC_PORT_DISABLE); 513 503 514 504 if (nic_dev->flags & HINIC_RSS_ENABLE) { 515 505 hinic_rss_deinit(nic_dev);
+6 -2
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
··· 497 497 498 498 hw->irq_name = devm_kmalloc_array(&hw->pdev->dev, num_vec, NAME_SIZE, 499 499 GFP_KERNEL); 500 - if (!hw->irq_name) 500 + if (!hw->irq_name) { 501 + err = -ENOMEM; 501 502 goto err_free_netdev; 503 + } 502 504 503 505 hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec, 504 506 sizeof(cpumask_var_t), GFP_KERNEL); 505 - if (!hw->affinity_mask) 507 + if (!hw->affinity_mask) { 508 + err = -ENOMEM; 506 509 goto err_free_netdev; 510 + } 507 511 508 512 err = pci_alloc_irq_vectors(hw->pdev, num_vec, num_vec, PCI_IRQ_MSIX); 509 513 if (err < 0) {
+4 -1
drivers/net/ethernet/microchip/encx24j600.c
··· 1070 1070 if (unlikely(ret)) { 1071 1071 netif_err(priv, probe, ndev, "Error %d initializing card encx24j600 card\n", 1072 1072 ret); 1073 - goto out_free; 1073 + goto out_stop; 1074 1074 } 1075 1075 1076 1076 eidled = encx24j600_read_reg(priv, EIDLED); ··· 1088 1088 1089 1089 out_unregister: 1090 1090 unregister_netdev(priv->ndev); 1091 + out_stop: 1092 + kthread_stop(priv->kworker_task); 1091 1093 out_free: 1092 1094 free_netdev(ndev); 1093 1095 ··· 1102 1100 struct encx24j600_priv *priv = dev_get_drvdata(&spi->dev); 1103 1101 1104 1102 unregister_netdev(priv->ndev); 1103 + kthread_stop(priv->kworker_task); 1105 1104 1106 1105 free_netdev(priv->ndev); 1107 1106
+3 -1
drivers/net/ethernet/netronome/nfp/abm/main.c
··· 333 333 goto err_free_alink; 334 334 335 335 alink->prio_map = kzalloc(abm->prio_map_len, GFP_KERNEL); 336 - if (!alink->prio_map) 336 + if (!alink->prio_map) { 337 + err = -ENOMEM; 337 338 goto err_free_alink; 339 + } 338 340 339 341 /* This is a multi-host app, make sure MAC/PHY is up, but don't 340 342 * make the MAC/PHY state follow the state of any of the ports.
+12 -7
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 2118 2118 dev_info(ionic->dev, "FW Up: restarting LIFs\n"); 2119 2119 2120 2120 ionic_init_devinfo(ionic); 2121 + ionic_port_init(ionic); 2121 2122 err = ionic_qcqs_alloc(lif); 2122 2123 if (err) 2123 2124 goto err_out; ··· 2349 2348 if (is_zero_ether_addr(ctx.comp.lif_getattr.mac)) 2350 2349 return 0; 2351 2350 2352 - if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) { 2351 + if (!is_zero_ether_addr(netdev->dev_addr)) { 2352 + /* If the netdev mac is non-zero and doesn't match the default 2353 + * device address, it was set by something earlier and we're 2354 + * likely here again after a fw-upgrade reset. We need to be 2355 + * sure the netdev mac is in our filter list. 2356 + */ 2357 + if (!ether_addr_equal(ctx.comp.lif_getattr.mac, 2358 + netdev->dev_addr)) 2359 + ionic_lif_addr(lif, netdev->dev_addr, true); 2360 + } else { 2361 + /* Update the netdev mac with the device's mac */ 2353 2362 memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); 2354 2363 addr.sa_family = AF_INET; 2355 2364 err = eth_prepare_mac_addr_change(netdev, &addr); ··· 2367 2356 netdev_warn(lif->netdev, "ignoring bad MAC addr from NIC %pM - err %d\n", 2368 2357 addr.sa_data, err); 2369 2358 return 0; 2370 - } 2371 - 2372 - if (!is_zero_ether_addr(netdev->dev_addr)) { 2373 - netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n", 2374 - netdev->dev_addr); 2375 - ionic_lif_addr(lif, netdev->dev_addr, false); 2376 2359 } 2377 2360 2378 2361 eth_commit_mac_addr_change(netdev, &addr);
+9 -9
drivers/net/ethernet/pensando/ionic/ionic_main.c
··· 509 509 size_t sz; 510 510 int err; 511 511 512 - if (idev->port_info) 513 - return 0; 514 - 515 - idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE); 516 - idev->port_info = dma_alloc_coherent(ionic->dev, idev->port_info_sz, 517 - &idev->port_info_pa, 518 - GFP_KERNEL); 519 512 if (!idev->port_info) { 520 - dev_err(ionic->dev, "Failed to allocate port info, aborting\n"); 521 - return -ENOMEM; 513 + idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE); 514 + idev->port_info = dma_alloc_coherent(ionic->dev, 515 + idev->port_info_sz, 516 + &idev->port_info_pa, 517 + GFP_KERNEL); 518 + if (!idev->port_info) { 519 + dev_err(ionic->dev, "Failed to allocate port info\n"); 520 + return -ENOMEM; 521 + } 522 522 } 523 523 524 524 sz = min(sizeof(ident->port.config), sizeof(idev->dev_cmd_regs->data));
+2
drivers/net/ethernet/realtek/r8169_main.c
··· 2127 2127 { 0x7cf, 0x348, RTL_GIGA_MAC_VER_07 }, 2128 2128 { 0x7cf, 0x248, RTL_GIGA_MAC_VER_07 }, 2129 2129 { 0x7cf, 0x340, RTL_GIGA_MAC_VER_13 }, 2130 + /* RTL8401, reportedly works if treated as RTL8101e */ 2131 + { 0x7cf, 0x240, RTL_GIGA_MAC_VER_13 }, 2130 2132 { 0x7cf, 0x343, RTL_GIGA_MAC_VER_10 }, 2131 2133 { 0x7cf, 0x342, RTL_GIGA_MAC_VER_16 }, 2132 2134 { 0x7c8, 0x348, RTL_GIGA_MAC_VER_09 },
+15 -2
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
··· 75 75 unsigned int value; 76 76 }; 77 77 78 + struct ethqos_emac_driver_data { 79 + const struct ethqos_emac_por *por; 80 + unsigned int num_por; 81 + }; 82 + 78 83 struct qcom_ethqos { 79 84 struct platform_device *pdev; 80 85 void __iomem *rgmii_base; ··· 174 169 { .offset = SDCC_HC_REG_DLL_CONFIG2, .value = 0x00200000 }, 175 170 { .offset = SDCC_USR_CTL, .value = 0x00010800 }, 176 171 { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x00002060 }, 172 + }; 173 + 174 + static const struct ethqos_emac_driver_data emac_v2_3_0_data = { 175 + .por = emac_v2_3_0_por, 176 + .num_por = ARRAY_SIZE(emac_v2_3_0_por), 177 177 }; 178 178 179 179 static int ethqos_dll_configure(struct qcom_ethqos *ethqos) ··· 452 442 struct device_node *np = pdev->dev.of_node; 453 443 struct plat_stmmacenet_data *plat_dat; 454 444 struct stmmac_resources stmmac_res; 445 + const struct ethqos_emac_driver_data *data; 455 446 struct qcom_ethqos *ethqos; 456 447 struct resource *res; 457 448 int ret; ··· 482 471 goto err_mem; 483 472 } 484 473 485 - ethqos->por = of_device_get_match_data(&pdev->dev); 474 + data = of_device_get_match_data(&pdev->dev); 475 + ethqos->por = data->por; 476 + ethqos->num_por = data->num_por; 486 477 487 478 ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); 488 479 if (IS_ERR(ethqos->rgmii_clk)) { ··· 539 526 } 540 527 541 528 static const struct of_device_id qcom_ethqos_match[] = { 542 - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por}, 529 + { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, 543 530 { } 544 531 }; 545 532 MODULE_DEVICE_TABLE(of, qcom_ethqos_match);
+6 -10
drivers/net/ethernet/ti/Kconfig
··· 49 49 config TI_CPSW 50 50 tristate "TI CPSW Switch Support" 51 51 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST 52 + depends on TI_CPTS || !TI_CPTS 52 53 select TI_DAVINCI_MDIO 53 54 select MFD_SYSCON 54 55 select PAGE_POOL ··· 65 64 tristate "TI CPSW Switch Support with switchdev" 66 65 depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || COMPILE_TEST 67 66 depends on NET_SWITCHDEV 67 + depends on TI_CPTS || !TI_CPTS 68 68 select PAGE_POOL 69 69 select TI_DAVINCI_MDIO 70 70 select MFD_SYSCON ··· 79 77 will be called cpsw_new. 80 78 81 79 config TI_CPTS 82 - bool "TI Common Platform Time Sync (CPTS) Support" 83 - depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST 80 + tristate "TI Common Platform Time Sync (CPTS) Support" 81 + depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST 84 82 depends on COMMON_CLK 85 - depends on POSIX_TIMERS 83 + depends on PTP_1588_CLOCK 86 84 ---help--- 87 85 This driver supports the Common Platform Time Sync unit of 88 86 the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem. 89 87 The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the 90 88 driver offers a PTP Hardware Clock. 91 - 92 - config TI_CPTS_MOD 93 - tristate 94 - depends on TI_CPTS 95 - depends on PTP_1588_CLOCK 96 - default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y 97 - default m 98 89 99 90 config TI_K3_AM65_CPSW_NUSS 100 91 tristate "TI K3 AM654x/J721E CPSW Ethernet driver" ··· 109 114 select TI_DAVINCI_MDIO 110 115 depends on OF 111 116 depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS 117 + depends on TI_CPTS || !TI_CPTS 112 118 ---help--- 113 119 This driver supports TI's Keystone NETCP Core. 114 120
+1 -1
drivers/net/ethernet/ti/Makefile
··· 13 13 ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o 14 14 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o 15 15 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o 16 - obj-$(CONFIG_TI_CPTS_MOD) += cpts.o 16 + obj-$(CONFIG_TI_CPTS) += cpts.o 17 17 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o 18 18 ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o 19 19 obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o
+2 -1
drivers/net/hamradio/bpqether.c
··· 127 127 { 128 128 struct bpqdev *bpq; 129 129 130 - list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) { 130 + list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list, 131 + lockdep_rtnl_is_held()) { 131 132 if (bpq->ethdev == dev) 132 133 return bpq->axdev; 133 134 }
+3 -2
drivers/net/ipa/gsi_trans.c
··· 399 399 /* assert(which < trans->tre_count); */ 400 400 401 401 /* Set the page information for the buffer. We also need to fill in 402 - * the DMA address for the buffer (something dma_map_sg() normally 403 - * does). 402 + * the DMA address and length for the buffer (something dma_map_sg() 403 + * normally does). 404 404 */ 405 405 sg = &trans->sgl[which]; 406 406 407 407 sg_set_buf(sg, buf, size); 408 408 sg_dma_address(sg) = addr; 409 + sg_dma_len(sg) = sg->length; 409 410 410 411 info = &trans->info[which]; 411 412 info->opcode = opcode;
+3 -11
drivers/net/ipa/ipa_cmd.c
··· 628 628 629 629 void ipa_cmd_tag_process_add(struct gsi_trans *trans) 630 630 { 631 - ipa_cmd_register_write_add(trans, 0, 0, 0, true); 632 - #if 1 633 - /* Reference these functions to avoid a compile error */ 634 - (void)ipa_cmd_ip_packet_init_add; 635 - (void)ipa_cmd_ip_tag_status_add; 636 - (void) ipa_cmd_transfer_add; 637 - #else 638 631 struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); 639 - struct gsi_endpoint *endpoint; 632 + struct ipa_endpoint *endpoint; 640 633 641 634 endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; 635 + 636 + ipa_cmd_register_write_add(trans, 0, 0, 0, true); 642 637 ipa_cmd_ip_packet_init_add(trans, endpoint->endpoint_id); 643 - 644 638 ipa_cmd_ip_tag_status_add(trans, 0xcba987654321); 645 - 646 639 ipa_cmd_transfer_add(trans, 4); 647 - #endif 648 640 } 649 641 650 642 /* Returns the number of commands required for the tag process */
+1 -1
drivers/net/ipa/ipa_smp2p.c
··· 53 53 * @clock_on: Whether IPA clock is on 54 54 * @notified: Whether modem has been notified of clock state 55 55 * @disabled: Whether setup ready interrupt handling is disabled 56 - * @mutex mutex: Motex protecting ready interrupt/shutdown interlock 56 + * @mutex: Mutex protecting ready-interrupt/shutdown interlock 57 57 * @panic_notifier: Panic notifier structure 58 58 */ 59 59 struct ipa_smp2p {
+6 -2
drivers/net/phy/broadcom.c
··· 225 225 else 226 226 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; 227 227 228 - if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) 229 - val |= BCM54XX_SHD_SCR3_TRDDAPD; 228 + if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { 229 + if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) 230 + val |= BCM54810_SHD_SCR3_TRDDAPD; 231 + else 232 + val |= BCM54XX_SHD_SCR3_TRDDAPD; 233 + } 230 234 231 235 if (orig != val) 232 236 bcm_phy_write_shadow(phydev, BCM54XX_SHD_SCR3, val);
+5 -3
drivers/net/phy/phy.c
··· 1132 1132 /* Restart autonegotiation so the new modes get sent to the 1133 1133 * link partner. 1134 1134 */ 1135 - ret = phy_restart_aneg(phydev); 1136 - if (ret < 0) 1137 - return ret; 1135 + if (phydev->autoneg == AUTONEG_ENABLE) { 1136 + ret = phy_restart_aneg(phydev); 1137 + if (ret < 0) 1138 + return ret; 1139 + } 1138 1140 } 1139 1141 1140 1142 return 0;
+3
drivers/net/ppp/pppoe.c
··· 490 490 if (!skb) 491 491 goto out; 492 492 493 + if (skb->pkt_type != PACKET_HOST) 494 + goto abort; 495 + 493 496 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) 494 497 goto abort; 495 498
+1 -1
drivers/net/usb/hso.c
··· 2659 2659 if (! 2660 2660 (serial->out_endp = 2661 2661 hso_get_ep(interface, USB_ENDPOINT_XFER_BULK, USB_DIR_OUT))) { 2662 - dev_err(&interface->dev, "Failed to find BULK IN ep\n"); 2662 + dev_err(&interface->dev, "Failed to find BULK OUT ep\n"); 2663 2663 goto exit2; 2664 2664 } 2665 2665
+4 -2
drivers/net/virtio_net.c
··· 1243 1243 break; 1244 1244 } while (rq->vq->num_free); 1245 1245 if (virtqueue_kick_prepare(rq->vq) && virtqueue_notify(rq->vq)) { 1246 - u64_stats_update_begin(&rq->stats.syncp); 1246 + unsigned long flags; 1247 + 1248 + flags = u64_stats_update_begin_irqsave(&rq->stats.syncp); 1247 1249 rq->stats.kicks++; 1248 - u64_stats_update_end(&rq->stats.syncp); 1250 + u64_stats_update_end_irqrestore(&rq->stats.syncp, flags); 1249 1251 } 1250 1252 1251 1253 return !oom;
+3 -1
drivers/s390/net/ism_drv.c
··· 521 521 522 522 ism->smcd = smcd_alloc_dev(&pdev->dev, dev_name(&pdev->dev), &ism_ops, 523 523 ISM_NR_DMBS); 524 - if (!ism->smcd) 524 + if (!ism->smcd) { 525 + ret = -ENOMEM; 525 526 goto err_resource; 527 + } 526 528 527 529 ism->smcd->priv = ism; 528 530 ret = ism_dev_init(ism);
+1
include/linux/brcmphy.h
··· 245 245 #define BCM54810_EXP_BROADREACH_LRE_MISC_CTL_EN (1 << 0) 246 246 #define BCM54810_SHD_CLK_CTL 0x3 247 247 #define BCM54810_SHD_CLK_CTL_GTXCLK_EN (1 << 9) 248 + #define BCM54810_SHD_SCR3_TRDDAPD 0x0100 248 249 249 250 /* BCM54612E Registers */ 250 251 #define BCM54612E_EXP_SPARE0 (MII_BCM54XX_EXP_SEL_ETC + 0x34)
+1 -1
include/linux/lsm_hook_defs.h
··· 243 243 char **value) 244 244 LSM_HOOK(int, -EINVAL, setprocattr, const char *name, void *value, size_t size) 245 245 LSM_HOOK(int, 0, ismaclabel, const char *name) 246 - LSM_HOOK(int, 0, secid_to_secctx, u32 secid, char **secdata, 246 + LSM_HOOK(int, -EOPNOTSUPP, secid_to_secctx, u32 secid, char **secdata, 247 247 u32 *seclen) 248 248 LSM_HOOK(int, 0, secctx_to_secid, const char *secdata, u32 seclen, u32 *secid) 249 249 LSM_HOOK(void, LSM_RET_VOID, release_secctx, char *secdata, u32 seclen)
+4 -4
include/linux/ptp_clock_kernel.h
··· 105 105 * parameter func: the desired function to use. 106 106 * parameter chan: the function channel index to use. 107 107 * 108 - * @do_work: Request driver to perform auxiliary (periodic) operations 109 - * Driver should return delay of the next auxiliary work scheduling 110 - * time (>=0) or negative value in case further scheduling 111 - * is not required. 108 + * @do_aux_work: Request driver to perform auxiliary (periodic) operations 109 + * Driver should return delay of the next auxiliary work 110 + * scheduling time (>=0) or negative value in case further 111 + * scheduling is not required. 112 112 * 113 113 * Drivers should embed their ptp_clock_info within a private 114 114 * structure, obtaining a reference to it using container_of().
+1
include/linux/skmsg.h
··· 187 187 dst->sg.data[which] = src->sg.data[which]; 188 188 dst->sg.data[which].length = size; 189 189 dst->sg.size += size; 190 + src->sg.size -= size; 190 191 src->sg.data[which].length -= size; 191 192 src->sg.data[which].offset += size; 192 193 }
+1 -1
include/net/netfilter/nf_conntrack.h
··· 87 87 struct hlist_node nat_bysource; 88 88 #endif 89 89 /* all members below initialized via memset */ 90 - u8 __nfct_init_offset[0]; 90 + struct { } __nfct_init_offset; 91 91 92 92 /* If we were expected by an expectation, this will be it */ 93 93 struct nf_conn *master;
+1
include/net/netfilter/nf_flow_table.h
··· 127 127 NF_FLOW_HW_DYING, 128 128 NF_FLOW_HW_DEAD, 129 129 NF_FLOW_HW_REFRESH, 130 + NF_FLOW_HW_PENDING, 130 131 }; 131 132 132 133 enum flow_offload_type {
+13 -1
include/net/tcp.h
··· 1376 1376 rx_opt->num_sacks = 0; 1377 1377 } 1378 1378 1379 - u32 tcp_default_init_rwnd(u32 mss); 1380 1379 void tcp_cwnd_restart(struct sock *sk, s32 delta); 1381 1380 1382 1381 static inline void tcp_slow_start_after_idle_check(struct sock *sk) ··· 1418 1419 static inline int tcp_full_space(const struct sock *sk) 1419 1420 { 1420 1421 return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); 1422 + } 1423 + 1424 + /* We provision sk_rcvbuf around 200% of sk_rcvlowat. 1425 + * If 87.5 % (7/8) of the space has been consumed, we want to override 1426 + * SO_RCVLOWAT constraint, since we are receiving skbs with too small 1427 + * len/truesize ratio. 1428 + */ 1429 + static inline bool tcp_rmem_pressure(const struct sock *sk) 1430 + { 1431 + int rcvbuf = READ_ONCE(sk->sk_rcvbuf); 1432 + int threshold = rcvbuf - (rcvbuf >> 3); 1433 + 1434 + return atomic_read(&sk->sk_rmem_alloc) > threshold; 1421 1435 } 1422 1436 1423 1437 extern void tcp_openreq_init_rwin(struct request_sock *req,
-2
include/net/udp_tunnel.h
··· 143 143 __be16 df, __be16 src_port, __be16 dst_port, 144 144 bool xnet, bool nocheck); 145 145 146 - #if IS_ENABLED(CONFIG_IPV6) 147 146 int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, 148 147 struct sk_buff *skb, 149 148 struct net_device *dev, struct in6_addr *saddr, 150 149 struct in6_addr *daddr, 151 150 __u8 prio, __u8 ttl, __be32 label, 152 151 __be16 src_port, __be16 dst_port, bool nocheck); 153 - #endif 154 152 155 153 void udp_tunnel_sock_release(struct socket *sock); 156 154
+3
init/Kconfig
··· 2261 2261 2262 2262 source "kernel/Kconfig.locks" 2263 2263 2264 + config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 2265 + bool 2266 + 2264 2267 config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE 2265 2268 bool 2266 2269
+6 -1
kernel/bpf/arraymap.c
··· 486 486 if (!(map->map_flags & BPF_F_MMAPABLE)) 487 487 return -EINVAL; 488 488 489 - return remap_vmalloc_range(vma, array_map_vmalloc_addr(array), pgoff); 489 + if (vma->vm_pgoff * PAGE_SIZE + (vma->vm_end - vma->vm_start) > 490 + PAGE_ALIGN((u64)array->map.max_entries * array->elem_size)) 491 + return -EINVAL; 492 + 493 + return remap_vmalloc_range(vma, array_map_vmalloc_addr(array), 494 + vma->vm_pgoff + pgoff); 490 495 } 491 496 492 497 const struct bpf_map_ops array_map_ops = {
+3 -1
kernel/bpf/syscall.c
··· 1485 1485 if (err) 1486 1486 goto free_value; 1487 1487 1488 - if (copy_to_user(uvalue, value, value_size) != 0) 1488 + if (copy_to_user(uvalue, value, value_size) != 0) { 1489 + err = -EFAULT; 1489 1490 goto free_value; 1491 + } 1490 1492 1491 1493 err = 0; 1492 1494
+20 -1
kernel/bpf/verifier.c
··· 4340 4340 4341 4341 if (ret_type != RET_INTEGER || 4342 4342 (func_id != BPF_FUNC_get_stack && 4343 - func_id != BPF_FUNC_probe_read_str)) 4343 + func_id != BPF_FUNC_probe_read_str && 4344 + func_id != BPF_FUNC_probe_read_kernel_str && 4345 + func_id != BPF_FUNC_probe_read_user_str)) 4344 4346 return; 4345 4347 4346 4348 ret_reg->smax_value = meta->msize_max_value; ··· 7061 7059 return 0; 7062 7060 range = tnum_const(0); 7063 7061 break; 7062 + case BPF_PROG_TYPE_TRACING: 7063 + switch (env->prog->expected_attach_type) { 7064 + case BPF_TRACE_FENTRY: 7065 + case BPF_TRACE_FEXIT: 7066 + range = tnum_const(0); 7067 + break; 7068 + case BPF_TRACE_RAW_TP: 7069 + case BPF_MODIFY_RETURN: 7070 + return 0; 7071 + default: 7072 + return -ENOTSUPP; 7073 + } 7074 + break; 7075 + case BPF_PROG_TYPE_EXT: 7076 + /* freplace program can return anything as its return value 7077 + * depends on the to-be-replaced kernel func or bpf program. 7078 + */ 7064 7079 default: 7065 7080 return 0; 7066 7081 }
+66 -34
kernel/trace/bpf_trace.c
··· 323 323 324 324 /* 325 325 * Only limited trace_printk() conversion specifiers allowed: 326 - * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %s 326 + * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %pks %pus %s 327 327 */ 328 328 BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1, 329 329 u64, arg2, u64, arg3) 330 330 { 331 + int i, mod[3] = {}, fmt_cnt = 0; 332 + char buf[64], fmt_ptype; 333 + void *unsafe_ptr = NULL; 331 334 bool str_seen = false; 332 - int mod[3] = {}; 333 - int fmt_cnt = 0; 334 - u64 unsafe_addr; 335 - char buf[64]; 336 - int i; 337 335 338 336 /* 339 337 * bpf_check()->check_func_arg()->check_stack_boundary() ··· 357 359 if (fmt[i] == 'l') { 358 360 mod[fmt_cnt]++; 359 361 i++; 360 - } else if (fmt[i] == 'p' || fmt[i] == 's') { 362 + } else if (fmt[i] == 'p') { 361 363 mod[fmt_cnt]++; 364 + if ((fmt[i + 1] == 'k' || 365 + fmt[i + 1] == 'u') && 366 + fmt[i + 2] == 's') { 367 + fmt_ptype = fmt[i + 1]; 368 + i += 2; 369 + goto fmt_str; 370 + } 371 + 362 372 /* disallow any further format extensions */ 363 373 if (fmt[i + 1] != 0 && 364 374 !isspace(fmt[i + 1]) && 365 375 !ispunct(fmt[i + 1])) 366 376 return -EINVAL; 367 - fmt_cnt++; 368 - if (fmt[i] == 's') { 369 - if (str_seen) 370 - /* allow only one '%s' per fmt string */ 371 - return -EINVAL; 372 - str_seen = true; 373 377 374 - switch (fmt_cnt) { 375 - case 1: 376 - unsafe_addr = arg1; 377 - arg1 = (long) buf; 378 - break; 379 - case 2: 380 - unsafe_addr = arg2; 381 - arg2 = (long) buf; 382 - break; 383 - case 3: 384 - unsafe_addr = arg3; 385 - arg3 = (long) buf; 386 - break; 387 - } 388 - buf[0] = 0; 389 - strncpy_from_unsafe(buf, 390 - (void *) (long) unsafe_addr, 391 - sizeof(buf)); 378 + goto fmt_next; 379 + } else if (fmt[i] == 's') { 380 + mod[fmt_cnt]++; 381 + fmt_ptype = fmt[i]; 382 + fmt_str: 383 + if (str_seen) 384 + /* allow only one '%s' per fmt string */ 385 + return -EINVAL; 386 + str_seen = true; 387 + 388 + if (fmt[i + 1] != 0 && 389 + !isspace(fmt[i + 1]) && 390 + !ispunct(fmt[i + 1])) 391 + return -EINVAL; 392 + 393 + switch (fmt_cnt) { 394 + case 0: 395 + unsafe_ptr = (void *)(long)arg1; 396 + arg1 = (long)buf; 397 + break; 398 + case 1: 399 + unsafe_ptr = (void *)(long)arg2; 400 + arg2 = (long)buf; 401 + break; 402 + case 2: 403 + unsafe_ptr = (void *)(long)arg3; 404 + arg3 = (long)buf; 405 + break; 392 406 } 393 - continue; 407 + 408 + buf[0] = 0; 409 + switch (fmt_ptype) { 410 + case 's': 411 + #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 412 + strncpy_from_unsafe(buf, unsafe_ptr, 413 + sizeof(buf)); 414 + break; 415 + #endif 416 + case 'k': 417 + strncpy_from_unsafe_strict(buf, unsafe_ptr, 418 + sizeof(buf)); 419 + break; 420 + case 'u': 421 + strncpy_from_unsafe_user(buf, 422 + (__force void __user *)unsafe_ptr, 423 + sizeof(buf)); 424 + break; 425 + } 426 + goto fmt_next; 394 427 } 395 428 396 429 if (fmt[i] == 'l') { ··· 432 403 if (fmt[i] != 'i' && fmt[i] != 'd' && 433 404 fmt[i] != 'u' && fmt[i] != 'x') 434 405 return -EINVAL; 406 + fmt_next: 435 407 fmt_cnt++; 436 408 } 437 409 ··· 855 825 return &bpf_probe_read_user_proto; 856 826 case BPF_FUNC_probe_read_kernel: 857 827 return &bpf_probe_read_kernel_proto; 858 - case BPF_FUNC_probe_read: 859 - return &bpf_probe_read_compat_proto; 860 828 case BPF_FUNC_probe_read_user_str: 861 829 return &bpf_probe_read_user_str_proto; 862 830 case BPF_FUNC_probe_read_kernel_str: 863 831 return &bpf_probe_read_kernel_str_proto; 832 + #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 833 + case BPF_FUNC_probe_read: 834 + return &bpf_probe_read_compat_proto; 864 835 case BPF_FUNC_probe_read_str: 865 836 return &bpf_probe_read_compat_str_proto; 837 + #endif 866 838 #ifdef CONFIG_CGROUPS 867 839 case BPF_FUNC_get_current_cgroup_id: 868 840 return &bpf_get_current_cgroup_id_proto;
+6
kernel/umh.c
··· 475 475 { 476 476 struct umh_info *umh_info = info->data; 477 477 478 + /* cleanup if umh_pipe_setup() was successful but exec failed */ 479 + if (info->pid && info->retval) { 480 + fput(umh_info->pipe_to_umh); 481 + fput(umh_info->pipe_from_umh); 482 + } 483 + 478 484 argv_free(info->argv); 479 485 umh_info->pid = info->pid; 480 486 }
+12
lib/vsprintf.c
··· 2168 2168 * f full name 2169 2169 * P node name, including a possible unit address 2170 2170 * - 'x' For printing the address. Equivalent to "%lx". 2171 + * - '[ku]s' For a BPF/tracing related format specifier, e.g. used out of 2172 + * bpf_trace_printk() where [ku] prefix specifies either kernel (k) 2173 + * or user (u) memory to probe, and: 2174 + * s a string, equivalent to "%s" on direct vsnprintf() use 2171 2175 * 2172 2176 * ** When making changes please also update: 2173 2177 * Documentation/core-api/printk-formats.rst ··· 2255 2251 if (!IS_ERR(ptr)) 2256 2252 break; 2257 2253 return err_ptr(buf, end, ptr, spec); 2254 + case 'u': 2255 + case 'k': 2256 + switch (fmt[1]) { 2257 + case 's': 2258 + return string(buf, end, ptr, spec); 2259 + default: 2260 + return error_string(buf, end, "(einval)", spec); 2261 + } 2258 2262 } 2259 2263 2260 2264 /* default is to _not_ leak addresses, hash before printing */
+3 -1
net/core/dev.c
··· 8907 8907 netdev_dbg(upper, "Disabling feature %pNF on lower dev %s.\n", 8908 8908 &feature, lower->name); 8909 8909 lower->wanted_features &= ~feature; 8910 - netdev_update_features(lower); 8910 + __netdev_update_features(lower); 8911 8911 8912 8912 if (unlikely(lower->features & feature)) 8913 8913 netdev_WARN(upper, "failed to disable %pNF on %s!\n", 8914 8914 &feature, lower->name); 8915 + else 8916 + netdev_features_change(lower); 8915 8917 } 8916 8918 } 8917 8919 }
+1 -1
net/core/filter.c
··· 2590 2590 } 2591 2591 pop = 0; 2592 2592 } else if (pop >= sge->length - a) { 2593 - sge->length = a; 2594 2593 pop -= (sge->length - a); 2594 + sge->length = a; 2595 2595 } 2596 2596 } 2597 2597
+2
net/core/netprio_cgroup.c
··· 236 236 struct task_struct *p; 237 237 struct cgroup_subsys_state *css; 238 238 239 + cgroup_sk_alloc_disable(); 240 + 239 241 cgroup_taskset_for_each(p, css, tset) { 240 242 void *v = (void *)(unsigned long)css->id; 241 243
+4 -2
net/ipv4/cipso_ipv4.c
··· 1258 1258 return ret_val; 1259 1259 } 1260 1260 1261 - secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1261 + if (secattr->attr.mls.cat) 1262 + secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1262 1263 } 1263 1264 1264 1265 return 0; ··· 1440 1439 return ret_val; 1441 1440 } 1442 1441 1443 - secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1442 + if (secattr->attr.mls.cat) 1443 + secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1444 1444 } 1445 1445 1446 1446 return 0;
+4 -2
net/ipv4/ipmr.c
··· 109 109 static void ipmr_expire_process(struct timer_list *t); 110 110 111 111 #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES 112 - #define ipmr_for_each_table(mrt, net) \ 113 - list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list) 112 + #define ipmr_for_each_table(mrt, net) \ 113 + list_for_each_entry_rcu(mrt, &net->ipv4.mr_tables, list, \ 114 + lockdep_rtnl_is_held() || \ 115 + list_empty(&net->ipv4.mr_tables)) 114 116 115 117 static struct mr_table *ipmr_mr_table_iter(struct net *net, 116 118 struct mr_table *mrt)
+1 -1
net/ipv4/route.c
··· 915 915 /* Check for load limit; set rate_last to the latest sent 916 916 * redirect. 917 917 */ 918 - if (peer->rate_tokens == 0 || 918 + if (peer->n_redirects == 0 || 919 919 time_after(jiffies, 920 920 (peer->rate_last + 921 921 (ip_rt_redirect_load << peer->n_redirects)))) {
+19 -8
net/ipv4/tcp.c
··· 476 476 static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, 477 477 int target, struct sock *sk) 478 478 { 479 - return (READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq) >= target) || 480 - (sk->sk_prot->stream_memory_read ? 481 - sk->sk_prot->stream_memory_read(sk) : false); 479 + int avail = READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq); 480 + 481 + if (avail > 0) { 482 + if (avail >= target) 483 + return true; 484 + if (tcp_rmem_pressure(sk)) 485 + return true; 486 + } 487 + if (sk->sk_prot->stream_memory_read) 488 + return sk->sk_prot->stream_memory_read(sk); 489 + return false; 482 490 } 483 491 484 492 /* ··· 1764 1756 1765 1757 down_read(&current->mm->mmap_sem); 1766 1758 1767 - ret = -EINVAL; 1768 1759 vma = find_vma(current->mm, address); 1769 - if (!vma || vma->vm_start > address || vma->vm_ops != &tcp_vm_ops) 1770 - goto out; 1760 + if (!vma || vma->vm_start > address || vma->vm_ops != &tcp_vm_ops) { 1761 + up_read(&current->mm->mmap_sem); 1762 + return -EINVAL; 1763 + } 1771 1764 zc->length = min_t(unsigned long, zc->length, vma->vm_end - address); 1772 1765 1773 1766 tp = tcp_sk(sk); ··· 2163 2154 tp->urg_data = 0; 2164 2155 tcp_fast_path_check(sk); 2165 2156 } 2166 - if (used + offset < skb->len) 2167 - continue; 2168 2157 2169 2158 if (TCP_SKB_CB(skb)->has_rxtstamp) { 2170 2159 tcp_update_recv_tstamps(skb, &tss); 2171 2160 cmsg_flags |= 2; 2172 2161 } 2162 + 2163 + if (used + offset < skb->len) 2164 + continue; 2165 + 2173 2166 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) 2174 2167 goto found_fin_ok; 2175 2168 if (!(flags & MSG_PEEK))
+6 -4
net/ipv4/tcp_bpf.c
··· 125 125 126 126 if (!ret) { 127 127 msg->sg.start = i; 128 - msg->sg.size -= apply_bytes; 129 128 sk_psock_queue_msg(psock, tmp); 130 129 sk_psock_data_ready(sk, psock); 131 130 } else { ··· 261 262 struct sk_psock *psock; 262 263 int copied, ret; 263 264 265 + if (unlikely(flags & MSG_ERRQUEUE)) 266 + return inet_recv_error(sk, msg, len, addr_len); 267 + 264 268 psock = sk_psock_get(sk); 265 269 if (unlikely(!psock)) 266 270 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); 267 - if (unlikely(flags & MSG_ERRQUEUE)) 268 - return inet_recv_error(sk, msg, len, addr_len); 269 271 if (!skb_queue_empty(&sk->sk_receive_queue) && 270 - sk_psock_queue_empty(psock)) 272 + sk_psock_queue_empty(psock)) { 273 + sk_psock_put(sk, psock); 271 274 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); 275 + } 272 276 lock_sock(sk); 273 277 msg_bytes_ready: 274 278 copied = __tcp_bpf_recvmsg(sk, psock, msg, len, flags);
+2 -1
net/ipv4/tcp_input.c
··· 4757 4757 const struct tcp_sock *tp = tcp_sk(sk); 4758 4758 int avail = tp->rcv_nxt - tp->copied_seq; 4759 4759 4760 - if (avail < sk->sk_rcvlowat && !sock_flag(sk, SOCK_DONE)) 4760 + if (avail < sk->sk_rcvlowat && !tcp_rmem_pressure(sk) && 4761 + !sock_flag(sk, SOCK_DONE)) 4761 4762 return; 4762 4763 4763 4764 sk->sk_data_ready(sk);
+2 -1
net/ipv6/calipso.c
··· 1047 1047 goto getattr_return; 1048 1048 } 1049 1049 1050 - secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1050 + if (secattr->attr.mls.cat) 1051 + secattr->flags |= NETLBL_SECATTR_MLS_CAT; 1051 1052 } 1052 1053 1053 1054 secattr->type = NETLBL_NLTYPE_CALIPSO;
+4 -2
net/ipv6/route.c
··· 2722 2722 const struct in6_addr *daddr, *saddr; 2723 2723 struct rt6_info *rt6 = (struct rt6_info *)dst; 2724 2724 2725 - if (dst_metric_locked(dst, RTAX_MTU)) 2726 - return; 2725 + /* Note: do *NOT* check dst_metric_locked(dst, RTAX_MTU) 2726 + * IPv6 pmtu discovery isn't optional, so 'mtu lock' cannot disable it. 2727 + * [see also comment in rt6_mtu_change_route()] 2728 + */ 2727 2729 2728 2730 if (iph) { 2729 2731 daddr = &iph->daddr;
+2
net/mptcp/protocol.c
··· 1629 1629 1630 1630 ret = mptcp_pm_allow_new_subflow(msk); 1631 1631 if (ret) { 1632 + subflow->map_seq = msk->ack_seq; 1633 + 1632 1634 /* active connections are already on conn_list */ 1633 1635 spin_lock_bh(&msk->join_list_lock); 1634 1636 if (!WARN_ON_ONCE(!list_empty(&subflow->node)))
+10
net/mptcp/subflow.c
··· 1012 1012 if (err) 1013 1013 return err; 1014 1014 1015 + /* the newly created socket really belongs to the owning MPTCP master 1016 + * socket, even if for additional subflows the allocation is performed 1017 + * by a kernel workqueue. Adjust inode references, so that the 1018 + * procfs/diag interaces really show this one belonging to the correct 1019 + * user. 1020 + */ 1021 + SOCK_INODE(sf)->i_ino = SOCK_INODE(sk->sk_socket)->i_ino; 1022 + SOCK_INODE(sf)->i_uid = SOCK_INODE(sk->sk_socket)->i_uid; 1023 + SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid; 1024 + 1015 1025 subflow = mptcp_subflow_ctx(sf->sk); 1016 1026 pr_debug("subflow=%p", subflow); 1017 1027
+14 -3
net/netfilter/nf_conntrack_core.c
··· 1519 1519 ct->status = 0; 1520 1520 ct->timeout = 0; 1521 1521 write_pnet(&ct->ct_net, net); 1522 - memset(&ct->__nfct_init_offset[0], 0, 1522 + memset(&ct->__nfct_init_offset, 0, 1523 1523 offsetof(struct nf_conn, proto) - 1524 - offsetof(struct nf_conn, __nfct_init_offset[0])); 1524 + offsetof(struct nf_conn, __nfct_init_offset)); 1525 1525 1526 1526 nf_ct_zone_add(ct, zone); 1527 1527 ··· 2139 2139 nf_conntrack_lock(lockp); 2140 2140 if (*bucket < nf_conntrack_htable_size) { 2141 2141 hlist_nulls_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnnode) { 2142 - if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL) 2142 + if (NF_CT_DIRECTION(h) != IP_CT_DIR_REPLY) 2143 2143 continue; 2144 + /* All nf_conn objects are added to hash table twice, one 2145 + * for original direction tuple, once for the reply tuple. 2146 + * 2147 + * Exception: In the IPS_NAT_CLASH case, only the reply 2148 + * tuple is added (the original tuple already existed for 2149 + * a different object). 2150 + * 2151 + * We only need to call the iterator once for each 2152 + * conntrack, so we just use the 'reply' direction 2153 + * tuple while iterating. 2154 + */ 2144 2155 ct = nf_ct_tuplehash_to_ctrack(h); 2145 2156 if (iter(ct, data)) 2146 2157 goto found;
+5 -3
net/netfilter/nf_flow_table_core.c
··· 284 284 285 285 if (nf_flow_has_expired(flow)) 286 286 flow_offload_fixup_ct(flow->ct); 287 - else if (test_bit(NF_FLOW_TEARDOWN, &flow->flags)) 287 + else 288 288 flow_offload_fixup_ct_timeout(flow->ct); 289 289 290 290 flow_offload_free(flow); ··· 361 361 { 362 362 struct nf_flowtable *flow_table = data; 363 363 364 - if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct) || 365 - test_bit(NF_FLOW_TEARDOWN, &flow->flags)) { 364 + if (nf_flow_has_expired(flow) || nf_ct_is_dying(flow->ct)) 365 + set_bit(NF_FLOW_TEARDOWN, &flow->flags); 366 + 367 + if (test_bit(NF_FLOW_TEARDOWN, &flow->flags)) { 366 368 if (test_bit(NF_FLOW_HW, &flow->flags)) { 367 369 if (!test_bit(NF_FLOW_HW_DYING, &flow->flags)) 368 370 nf_flow_offload_del(flow_table, flow);
+9 -3
net/netfilter/nf_flow_table_offload.c
··· 817 817 WARN_ON_ONCE(1); 818 818 } 819 819 820 + clear_bit(NF_FLOW_HW_PENDING, &offload->flow->flags); 820 821 kfree(offload); 821 822 } 822 823 ··· 832 831 { 833 832 struct flow_offload_work *offload; 834 833 835 - offload = kmalloc(sizeof(struct flow_offload_work), GFP_ATOMIC); 836 - if (!offload) 834 + if (test_and_set_bit(NF_FLOW_HW_PENDING, &flow->flags)) 837 835 return NULL; 836 + 837 + offload = kmalloc(sizeof(struct flow_offload_work), GFP_ATOMIC); 838 + if (!offload) { 839 + clear_bit(NF_FLOW_HW_PENDING, &flow->flags); 840 + return NULL; 841 + } 838 842 839 843 offload->cmd = cmd; 840 844 offload->flow = flow; ··· 1062 1056 int nf_flow_table_offload_init(void) 1063 1057 { 1064 1058 nf_flow_offload_wq = alloc_workqueue("nf_flow_table_offload", 1065 - WQ_UNBOUND | WQ_MEM_RECLAIM, 0); 1059 + WQ_UNBOUND, 0); 1066 1060 if (!nf_flow_offload_wq) 1067 1061 return -ENOMEM; 1068 1062
+11
net/netfilter/nft_set_rbtree.c
··· 79 79 parent = rcu_dereference_raw(parent->rb_left); 80 80 continue; 81 81 } 82 + 83 + if (nft_set_elem_expired(&rbe->ext)) 84 + return false; 85 + 82 86 if (nft_rbtree_interval_end(rbe)) { 83 87 if (nft_set_is_anonymous(set)) 84 88 return false; ··· 98 94 99 95 if (set->flags & NFT_SET_INTERVAL && interval != NULL && 100 96 nft_set_elem_active(&interval->ext, genmask) && 97 + !nft_set_elem_expired(&interval->ext) && 101 98 nft_rbtree_interval_start(interval)) { 102 99 *ext = &interval->ext; 103 100 return true; ··· 159 154 continue; 160 155 } 161 156 157 + if (nft_set_elem_expired(&rbe->ext)) 158 + return false; 159 + 162 160 if (!nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) || 163 161 (*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END) == 164 162 (flags & NFT_SET_ELEM_INTERVAL_END)) { ··· 178 170 179 171 if (set->flags & NFT_SET_INTERVAL && interval != NULL && 180 172 nft_set_elem_active(&interval->ext, genmask) && 173 + !nft_set_elem_expired(&interval->ext) && 181 174 ((!nft_rbtree_interval_end(interval) && 182 175 !(flags & NFT_SET_ELEM_INTERVAL_END)) || 183 176 (nft_rbtree_interval_end(interval) && ··· 426 417 rbe = rb_entry(node, struct nft_rbtree_elem, node); 427 418 428 419 if (iter->count < iter->skip) 420 + goto cont; 421 + if (nft_set_elem_expired(&rbe->ext)) 429 422 goto cont; 430 423 if (!nft_set_elem_active(&rbe->ext, iter->genmask)) 431 424 goto cont;
+6
net/netlabel/netlabel_kapi.c
··· 734 734 if ((off & (BITS_PER_LONG - 1)) != 0) 735 735 return -EINVAL; 736 736 737 + /* a null catmap is equivalent to an empty one */ 738 + if (!catmap) { 739 + *offset = (u32)-1; 740 + return 0; 741 + } 742 + 737 743 if (off < catmap->startbit) { 738 744 off = catmap->startbit; 739 745 *offset = off;
+31 -11
net/tipc/socket.c
··· 1739 1739 return 0; 1740 1740 } 1741 1741 1742 - static void tipc_sk_send_ack(struct tipc_sock *tsk) 1742 + static struct sk_buff *tipc_sk_build_ack(struct tipc_sock *tsk) 1743 1743 { 1744 1744 struct sock *sk = &tsk->sk; 1745 - struct net *net = sock_net(sk); 1746 1745 struct sk_buff *skb = NULL; 1747 1746 struct tipc_msg *msg; 1748 1747 u32 peer_port = tsk_peer_port(tsk); 1749 1748 u32 dnode = tsk_peer_node(tsk); 1750 1749 1751 1750 if (!tipc_sk_connected(sk)) 1752 - return; 1751 + return NULL; 1753 1752 skb = tipc_msg_create(CONN_MANAGER, CONN_ACK, INT_H_SIZE, 0, 1754 1753 dnode, tsk_own_node(tsk), peer_port, 1755 1754 tsk->portid, TIPC_OK); 1756 1755 if (!skb) 1757 - return; 1756 + return NULL; 1758 1757 msg = buf_msg(skb); 1759 1758 msg_set_conn_ack(msg, tsk->rcv_unacked); 1760 1759 tsk->rcv_unacked = 0; ··· 1763 1764 tsk->rcv_win = tsk_adv_blocks(tsk->sk.sk_rcvbuf); 1764 1765 msg_set_adv_win(msg, tsk->rcv_win); 1765 1766 } 1766 - tipc_node_xmit_skb(net, skb, dnode, msg_link_selector(msg)); 1767 + return skb; 1768 + } 1769 + 1770 + static void tipc_sk_send_ack(struct tipc_sock *tsk) 1771 + { 1772 + struct sk_buff *skb; 1773 + 1774 + skb = tipc_sk_build_ack(tsk); 1775 + if (!skb) 1776 + return; 1777 + 1778 + tipc_node_xmit_skb(sock_net(&tsk->sk), skb, tsk_peer_node(tsk), 1779 + msg_link_selector(buf_msg(skb))); 1767 1780 } 1768 1781 1769 1782 static int tipc_wait_for_rcvmsg(struct socket *sock, long *timeop) ··· 1949 1938 bool peek = flags & MSG_PEEK; 1950 1939 int offset, required, copy, copied = 0; 1951 1940 int hlen, dlen, err, rc; 1952 - bool ack = false; 1953 1941 long timeout; 1954 1942 1955 1943 /* Catch invalid receive attempts */ ··· 1993 1983 1994 1984 /* Copy data if msg ok, otherwise return error/partial data */ 1995 1985 if (likely(!err)) { 1996 - ack = msg_ack_required(hdr); 1997 1986 offset = skb_cb->bytes_read; 1998 1987 copy = min_t(int, dlen - offset, buflen - copied); 1999 1988 rc = skb_copy_datagram_msg(skb, hlen + offset, m, copy); ··· 2020 2011 2021 2012 /* Send connection flow control advertisement when applicable */ 2022 2013 tsk->rcv_unacked += tsk_inc(tsk, hlen + dlen); 2023 - if (ack || tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) 2014 + if (tsk->rcv_unacked >= tsk->rcv_win / TIPC_ACK_RATE) 2024 2015 tipc_sk_send_ack(tsk); 2025 2016 2026 2017 /* Exit if all requested data or FIN/error received */ ··· 2114 2105 * tipc_sk_filter_connect - check incoming message for a connection-based socket 2115 2106 * @tsk: TIPC socket 2116 2107 * @skb: pointer to message buffer. 2108 + * @xmitq: for Nagle ACK if any 2117 2109 * Returns true if message should be added to receive queue, false otherwise 2118 2110 */ 2119 - static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb) 2111 + static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb, 2112 + struct sk_buff_head *xmitq) 2120 2113 { 2121 2114 struct sock *sk = &tsk->sk; 2122 2115 struct net *net = sock_net(sk); ··· 2182 2171 if (!skb_queue_empty(&sk->sk_write_queue)) 2183 2172 tipc_sk_push_backlog(tsk); 2184 2173 /* Accept only connection-based messages sent by peer */ 2185 - if (likely(con_msg && !err && pport == oport && pnode == onode)) 2174 + if (likely(con_msg && !err && pport == oport && 2175 + pnode == onode)) { 2176 + if (msg_ack_required(hdr)) { 2177 + struct sk_buff *skb; 2178 + 2179 + skb = tipc_sk_build_ack(tsk); 2180 + if (skb) 2181 + __skb_queue_tail(xmitq, skb); 2182 + } 2186 2183 return true; 2184 + } 2187 2185 if (!tsk_peer_msg(tsk, hdr)) 2188 2186 return false; 2189 2187 if (!err) ··· 2287 2267 while ((skb = __skb_dequeue(&inputq))) { 2288 2268 hdr = buf_msg(skb); 2289 2269 limit = rcvbuf_limit(sk, skb); 2290 - if ((sk_conn && !tipc_sk_filter_connect(tsk, skb)) || 2270 + if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) || 2291 2271 (!sk_conn && msg_connected(hdr)) || 2292 2272 (!grp && msg_in_group(hdr))) 2293 2273 err = TIPC_ERR_NO_PORT;
+10
net/tipc/subscr.h
··· 96 96 (swap_ ? swab32(val__) : val__); \ 97 97 }) 98 98 99 + /* tipc_sub_write - write val_ to field_ of struct sub_ in user endian format 100 + */ 101 + #define tipc_sub_write(sub_, field_, val_) \ 102 + ({ \ 103 + struct tipc_subscr *sub__ = sub_; \ 104 + u32 val__ = val_; \ 105 + int swap_ = !((sub__)->filter & TIPC_FILTER_MASK); \ 106 + (sub__)->field_ = swap_ ? swab32(val__) : val__; \ 107 + }) 108 + 99 109 /* tipc_evt_write - write val_ to field_ of struct evt_ in user endian format 100 110 */ 101 111 #define tipc_evt_write(evt_, field_, val_) \
+8 -5
net/tipc/topsrv.c
··· 237 237 if (!s || !memcmp(s, &sub->evt.s, sizeof(*s))) { 238 238 tipc_sub_unsubscribe(sub); 239 239 atomic_dec(&tn->subscription_count); 240 - } else if (s) { 241 - break; 240 + if (s) 241 + break; 242 242 } 243 243 } 244 244 spin_unlock_bh(&con->sub_lock); ··· 362 362 { 363 363 struct tipc_net *tn = tipc_net(srv->net); 364 364 struct tipc_subscription *sub; 365 + u32 s_filter = tipc_sub_read(s, filter); 365 366 366 - if (tipc_sub_read(s, filter) & TIPC_SUB_CANCEL) { 367 - s->filter &= __constant_ntohl(~TIPC_SUB_CANCEL); 367 + if (s_filter & TIPC_SUB_CANCEL) { 368 + tipc_sub_write(s, filter, s_filter & ~TIPC_SUB_CANCEL); 368 369 tipc_conn_delete_sub(con, s); 369 370 return 0; 370 371 } ··· 401 400 return -EWOULDBLOCK; 402 401 if (ret == sizeof(s)) { 403 402 read_lock_bh(&sk->sk_callback_lock); 404 - ret = tipc_conn_rcv_sub(srv, con, &s); 403 + /* RACE: the connection can be closed in the meantime */ 404 + if (likely(connected(con))) 405 + ret = tipc_conn_rcv_sub(srv, con, &s); 405 406 read_unlock_bh(&sk->sk_callback_lock); 406 407 if (!ret) 407 408 return 0;
-2
samples/bpf/lwt_len_hist_user.c
··· 15 15 #define MAX_INDEX 64 16 16 #define MAX_STARS 38 17 17 18 - char bpf_log_buf[BPF_LOG_BUF_SIZE]; 19 - 20 18 static void stars(char *str, long val, long max, int width) 21 19 { 22 20 int i;
+2 -2
tools/lib/bpf/bpf_tracing.h
··· 148 148 #define PT_REGS_PARM3_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[4]) 149 149 #define PT_REGS_PARM4_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[5]) 150 150 #define PT_REGS_PARM5_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[6]) 151 - #define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), grps[14]) 151 + #define PT_REGS_RET_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[14]) 152 152 #define PT_REGS_FP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[11]) 153 153 #define PT_REGS_RC_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[2]) 154 154 #define PT_REGS_SP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), gprs[15]) 155 - #define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), pdw.addr) 155 + #define PT_REGS_IP_CORE(x) BPF_CORE_READ((PT_REGS_S390 *)(x), psw.addr) 156 156 157 157 #elif defined(bpf_target_arm) 158 158
+8
tools/testing/selftests/bpf/prog_tests/mmap.c
··· 217 217 218 218 munmap(tmp2, 4 * page_size); 219 219 220 + /* map all 4 pages, but with pg_off=1 page, should fail */ 221 + tmp1 = mmap(NULL, 4 * page_size, PROT_READ, MAP_SHARED | MAP_FIXED, 222 + data_map_fd, page_size /* initial page shift */); 223 + if (CHECK(tmp1 != MAP_FAILED, "adv_mmap7", "unexpected success")) { 224 + munmap(tmp1, 4 * page_size); 225 + goto cleanup; 226 + } 227 + 220 228 tmp1 = mmap(NULL, map_sz, PROT_READ, MAP_SHARED, data_map_fd, 0); 221 229 if (CHECK(tmp1 == MAP_FAILED, "last_mmap", "failed %d\n", errno)) 222 230 goto cleanup;
+2 -2
tools/testing/selftests/bpf/progs/test_overhead.c
··· 30 30 SEC("fentry/__set_task_comm") 31 31 int BPF_PROG(prog4, struct task_struct *tsk, const char *buf, bool exec) 32 32 { 33 - return !tsk; 33 + return 0; 34 34 } 35 35 36 36 SEC("fexit/__set_task_comm") 37 37 int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec) 38 38 { 39 - return !tsk; 39 + return 0; 40 40 } 41 41 42 42 char _license[] SEC("license") = "GPL";
+1 -1
tools/testing/selftests/net/mptcp/pm_netlink.sh
··· 30 30 31 31 cleanup() 32 32 { 33 - rm -f $out 33 + rm -f $err 34 34 ip netns del $ns1 35 35 } 36 36