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

Configure Feed

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

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

Pull networking fixes from Jakub Kicinski:
"Networking fixes for 5.13-rc1, including fixes from bpf, can and
netfilter trees. Self-contained fixes, nothing risky.

Current release - new code bugs:

- dsa: ksz: fix a few bugs found by static-checker in the new driver

- stmmac: fix frame preemption handshake not triggering after
interface restart

Previous releases - regressions:

- make nla_strcmp handle more then one trailing null character

- fix stack OOB reads while fragmenting IPv4 packets in openvswitch
and net/sched

- sctp: do asoc update earlier in sctp_sf_do_dupcook_a

- sctp: delay auto_asconf init until binding the first addr

- stmmac: clear receive all(RA) bit when promiscuous mode is off

- can: mcp251x: fix resume from sleep before interface was brought up

Previous releases - always broken:

- bpf: fix leakage of uninitialized bpf stack under speculation

- bpf: fix masking negation logic upon negative dst register

- netfilter: don't assume that skb_header_pointer() will never fail

- only allow init netns to set default tcp cong to a restricted algo

- xsk: fix xp_aligned_validate_desc() when len == chunk_size to avoid
false positive errors

- ethtool: fix missing NLM_F_MULTI flag when dumping

- can: m_can: m_can_tx_work_queue(): fix tx_skb race condition

- sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b

- bridge: fix NULL-deref caused by a races between assigning
rx_handler_data and setting the IFF_BRIDGE_PORT bit

Latecomer:

- seg6: add counters support for SRv6 Behaviors"

* tag 'net-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (73 commits)
atm: firestream: Use fallthrough pseudo-keyword
net: stmmac: Do not enable RX FIFO overflow interrupts
mptcp: fix splat when closing unaccepted socket
i40e: Remove LLDP frame filters
i40e: Fix PHY type identifiers for 2.5G and 5G adapters
i40e: fix the restart auto-negotiation after FEC modified
i40e: Fix use-after-free in i40e_client_subtask()
i40e: fix broken XDP support
netfilter: nftables: avoid potential overflows on 32bit arches
netfilter: nftables: avoid overflows in nft_hash_buckets()
tcp: Specify cmsgbuf is user pointer for receive zerocopy.
mlxsw: spectrum_mr: Update egress RIF list before route's action
net: ipa: fix inter-EE IRQ register definitions
can: m_can: m_can_tx_work_queue(): fix tx_skb race condition
can: mcp251x: fix resume from sleep before interface was brought up
can: mcp251xfd: mcp251xfd_probe(): add missing can_rx_offload_del() in error path
can: mcp251xfd: mcp251xfd_probe(): fix an error pointer dereference in probe
netfilter: nftables: Fix a memleak from userdata error path in new objects
netfilter: remove BUG_ON() after skb_header_pointer()
netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check
...

+688 -329
+5
CREDITS
··· 1874 1874 S: 181 00 Praha 8 1875 1875 S: Czech Republic 1876 1876 1877 + N: Murali Karicheri 1878 + E: m-karicheri2@ti.com 1879 + D: Keystone NetCP driver 1880 + D: Keystone PCIe host controller driver 1881 + 1877 1882 N: Jan "Yenya" Kasprzak 1878 1883 E: kas@fi.muni.cz 1879 1884 D: Author of the COSA/SRP sync serial board driver.
+16
Documentation/ABI/testing/sysfs-class-net-qmi
··· 58 58 59 59 Indicates the mux id associated to the qmimux network interface 60 60 during its creation. 61 + 62 + What: /sys/class/net/<iface>/qmi/pass_through 63 + Date: January 2021 64 + KernelVersion: 5.12 65 + Contact: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org> 66 + Description: 67 + Boolean. Default: 'N' 68 + 69 + Set this to 'Y' to enable 'pass-through' mode, allowing packets 70 + in MAP format to be passed on to the stack. 71 + 72 + Normally the rmnet driver (CONFIG_RMNET) is then used to process 73 + and demultiplex these packets. 74 + 75 + 'Pass-through' mode can be enabled when the device is in 76 + 'raw-ip' mode only.
+2 -14
MAINTAINERS
··· 624 624 625 625 AFS FILESYSTEM 626 626 M: David Howells <dhowells@redhat.com> 627 + M: Marc Dionne <marc.dionne@auristor.com> 627 628 L: linux-afs@lists.infradead.org 628 629 S: Supported 629 630 W: https://www.infradead.org/~dhowells/kafs/ ··· 14100 14099 F: drivers/pci/controller/cadence/pci-j721e.c 14101 14100 F: drivers/pci/controller/dwc/pci-dra7xx.c 14102 14101 14103 - PCI DRIVER FOR TI KEYSTONE 14104 - M: Murali Karicheri <m-karicheri2@ti.com> 14105 - L: linux-pci@vger.kernel.org 14106 - L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 14107 - S: Maintained 14108 - F: drivers/pci/controller/dwc/pci-keystone.c 14109 - 14110 14102 PCI DRIVER FOR V3 SEMICONDUCTOR V360EPC 14111 14103 M: Linus Walleij <linus.walleij@linaro.org> 14112 14104 L: linux-pci@vger.kernel.org ··· 15885 15891 15886 15892 RXRPC SOCKETS (AF_RXRPC) 15887 15893 M: David Howells <dhowells@redhat.com> 15894 + M: Marc Dionne <marc.dionne@auristor.com> 15888 15895 L: linux-afs@lists.infradead.org 15889 15896 S: Supported 15890 15897 W: https://www.infradead.org/~dhowells/kafs/ ··· 18301 18306 S: Maintained 18302 18307 F: sound/soc/codecs/isabelle* 18303 18308 F: sound/soc/codecs/lm49453* 18304 - 18305 - TI NETCP ETHERNET DRIVER 18306 - M: Wingman Kwok <w-kwok2@ti.com> 18307 - M: Murali Karicheri <m-karicheri2@ti.com> 18308 - L: netdev@vger.kernel.org 18309 - S: Maintained 18310 - F: drivers/net/ethernet/ti/netcp* 18311 18309 18312 18310 TI PCM3060 ASoC CODEC DRIVER 18313 18311 M: Kirill Marinushkin <kmarinushkin@birdec.com>
+1
drivers/atm/firestream.c
··· 795 795 switch (STATUS_CODE (qe)) { 796 796 case 0x1: 797 797 /* Fall through for streaming mode */ 798 + fallthrough; 798 799 case 0x2:/* Packet received OK.... */ 799 800 if (atm_vcc) { 800 801 skb = pe->skb;
+2 -1
drivers/net/can/m_can/m_can.c
··· 1562 1562 int i; 1563 1563 int putidx; 1564 1564 1565 + cdev->tx_skb = NULL; 1566 + 1565 1567 /* Generate ID field for TX buffer Element */ 1566 1568 /* Common to all supported M_CAN versions */ 1567 1569 if (cf->can_id & CAN_EFF_FLAG) { ··· 1680 1678 tx_work); 1681 1679 1682 1680 m_can_tx_handler(cdev); 1683 - cdev->tx_skb = NULL; 1684 1681 } 1685 1682 1686 1683 static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
+18 -17
drivers/net/can/spi/mcp251x.c
··· 956 956 957 957 priv->force_quit = 1; 958 958 free_irq(spi->irq, priv); 959 - destroy_workqueue(priv->wq); 960 - priv->wq = NULL; 961 959 962 960 mutex_lock(&priv->mcp_lock); 963 961 ··· 1222 1224 goto out_close; 1223 1225 } 1224 1226 1225 - priv->wq = alloc_workqueue("mcp251x_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM, 1226 - 0); 1227 - if (!priv->wq) { 1228 - ret = -ENOMEM; 1229 - goto out_clean; 1230 - } 1231 - INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); 1232 - INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); 1233 - 1234 1227 ret = mcp251x_hw_wake(spi); 1235 1228 if (ret) 1236 - goto out_free_wq; 1229 + goto out_free_irq; 1237 1230 ret = mcp251x_setup(net, spi); 1238 1231 if (ret) 1239 - goto out_free_wq; 1232 + goto out_free_irq; 1240 1233 ret = mcp251x_set_normal_mode(spi); 1241 1234 if (ret) 1242 - goto out_free_wq; 1235 + goto out_free_irq; 1243 1236 1244 1237 can_led_event(net, CAN_LED_EVENT_OPEN); 1245 1238 ··· 1239 1250 1240 1251 return 0; 1241 1252 1242 - out_free_wq: 1243 - destroy_workqueue(priv->wq); 1244 - out_clean: 1253 + out_free_irq: 1245 1254 free_irq(spi->irq, priv); 1246 1255 mcp251x_hw_sleep(spi); 1247 1256 out_close: ··· 1360 1373 if (ret) 1361 1374 goto out_clk; 1362 1375 1376 + priv->wq = alloc_workqueue("mcp251x_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM, 1377 + 0); 1378 + if (!priv->wq) { 1379 + ret = -ENOMEM; 1380 + goto out_clk; 1381 + } 1382 + INIT_WORK(&priv->tx_work, mcp251x_tx_work_handler); 1383 + INIT_WORK(&priv->restart_work, mcp251x_restart_work_handler); 1384 + 1363 1385 priv->spi = spi; 1364 1386 mutex_init(&priv->mcp_lock); 1365 1387 ··· 1413 1417 return 0; 1414 1418 1415 1419 error_probe: 1420 + destroy_workqueue(priv->wq); 1421 + priv->wq = NULL; 1416 1422 mcp251x_power_enable(priv->power, 0); 1417 1423 1418 1424 out_clk: ··· 1435 1437 unregister_candev(net); 1436 1438 1437 1439 mcp251x_power_enable(priv->power, 0); 1440 + 1441 + destroy_workqueue(priv->wq); 1442 + priv->wq = NULL; 1438 1443 1439 1444 clk_disable_unprepare(priv->clk); 1440 1445
+5 -3
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
··· 2885 2885 2886 2886 clk = devm_clk_get(&spi->dev, NULL); 2887 2887 if (IS_ERR(clk)) 2888 - dev_err_probe(&spi->dev, PTR_ERR(clk), 2889 - "Failed to get Oscillator (clock)!\n"); 2888 + return dev_err_probe(&spi->dev, PTR_ERR(clk), 2889 + "Failed to get Oscillator (clock)!\n"); 2890 2890 freq = clk_get_rate(clk); 2891 2891 2892 2892 /* Sanity check */ ··· 2986 2986 2987 2987 err = mcp251xfd_register(priv); 2988 2988 if (err) 2989 - goto out_free_candev; 2989 + goto out_can_rx_offload_del; 2990 2990 2991 2991 return 0; 2992 2992 2993 + out_can_rx_offload_del: 2994 + can_rx_offload_del(&priv->offload); 2993 2995 out_free_candev: 2994 2996 spi->max_speed_hz = priv->spi_max_speed_hz_orig; 2995 2997
+3
drivers/net/dsa/microchip/ksz8795_spi.c
··· 41 41 int i, ret = 0; 42 42 43 43 ksz8 = devm_kzalloc(&spi->dev, sizeof(struct ksz8), GFP_KERNEL); 44 + if (!ksz8) 45 + return -ENOMEM; 46 + 44 47 ksz8->priv = spi; 45 48 46 49 dev = ksz_switch_alloc(&spi->dev, ksz8);
+4 -1
drivers/net/dsa/microchip/ksz8863_smi.c
··· 147 147 int i; 148 148 149 149 ksz8 = devm_kzalloc(&mdiodev->dev, sizeof(struct ksz8), GFP_KERNEL); 150 + if (!ksz8) 151 + return -ENOMEM; 152 + 150 153 ksz8->priv = mdiodev; 151 154 152 155 dev = ksz_switch_alloc(&mdiodev->dev, ksz8); 153 156 if (!dev) 154 - return -EINVAL; 157 + return -ENOMEM; 155 158 156 159 for (i = 0; i < ARRAY_SIZE(ksz8863_regmap_config); i++) { 157 160 rc = ksz8863_regmap_config[i];
+1 -1
drivers/net/ethernet/atheros/alx/main.c
··· 2016 2016 module_pci_driver(alx_driver); 2017 2017 MODULE_DEVICE_TABLE(pci, alx_pci_tbl); 2018 2018 MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>"); 2019 - MODULE_AUTHOR("Qualcomm Corporation, <nic-devel@qualcomm.com>"); 2019 + MODULE_AUTHOR("Qualcomm Corporation"); 2020 2020 MODULE_DESCRIPTION( 2021 2021 "Qualcomm Atheros(R) AR816x/AR817x PCI-E Ethernet Network Driver"); 2022 2022 MODULE_LICENSE("GPL");
+1 -1
drivers/net/ethernet/atheros/atl1c/atl1c_main.c
··· 32 32 MODULE_DEVICE_TABLE(pci, atl1c_pci_tbl); 33 33 34 34 MODULE_AUTHOR("Jie Yang"); 35 - MODULE_AUTHOR("Qualcomm Atheros Inc., <nic-devel@qualcomm.com>"); 35 + MODULE_AUTHOR("Qualcomm Atheros Inc."); 36 36 MODULE_DESCRIPTION("Qualcomm Atheros 100/1000M Ethernet Network Driver"); 37 37 MODULE_LICENSE("GPL"); 38 38
-1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
··· 1192 1192 return 0; 1193 1193 } 1194 1194 1195 - err = -EIO; 1196 1195 /* verify ari is enabled */ 1197 1196 if (!pci_ari_enabled(bp->pdev->bus)) { 1198 1197 BNX2X_ERR("ARI not supported (check pci bridge ARI forwarding), SRIOV can not be enabled\n");
+1 -1
drivers/net/ethernet/brocade/bna/bnad.c
··· 1764 1764 } 1765 1765 } 1766 1766 1767 - /* Check for BNAD_CF_DIM_ENABLED, does not eleminate a race */ 1767 + /* Check for BNAD_CF_DIM_ENABLED, does not eliminate a race */ 1768 1768 if (test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) 1769 1769 mod_timer(&bnad->dim_timer, 1770 1770 jiffies + msecs_to_jiffies(BNAD_DIM_TIMER_FREQ));
+2 -2
drivers/net/ethernet/cadence/macb_main.c
··· 4852 4852 { 4853 4853 struct net_device *netdev = dev_get_drvdata(dev); 4854 4854 struct macb *bp = netdev_priv(netdev); 4855 - struct macb_queue *queue = bp->queues; 4855 + struct macb_queue *queue; 4856 4856 unsigned long flags; 4857 4857 unsigned int q; 4858 4858 int err; ··· 4939 4939 { 4940 4940 struct net_device *netdev = dev_get_drvdata(dev); 4941 4941 struct macb *bp = netdev_priv(netdev); 4942 - struct macb_queue *queue = bp->queues; 4942 + struct macb_queue *queue; 4943 4943 unsigned long flags; 4944 4944 unsigned int q; 4945 4945 int err;
+9 -7
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 2563 2563 spin_lock_bh(&eosw_txq->lock); 2564 2564 if (tc != FW_SCHED_CLS_NONE) { 2565 2565 if (eosw_txq->state != CXGB4_EO_STATE_CLOSED) 2566 - goto out_unlock; 2566 + goto out_free_skb; 2567 2567 2568 2568 next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND; 2569 2569 } else { 2570 2570 if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE) 2571 - goto out_unlock; 2571 + goto out_free_skb; 2572 2572 2573 2573 next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND; 2574 2574 } ··· 2604 2604 eosw_txq_flush_pending_skbs(eosw_txq); 2605 2605 2606 2606 ret = eosw_txq_enqueue(eosw_txq, skb); 2607 - if (ret) { 2608 - dev_consume_skb_any(skb); 2609 - goto out_unlock; 2610 - } 2607 + if (ret) 2608 + goto out_free_skb; 2611 2609 2612 2610 eosw_txq->state = next_state; 2613 2611 eosw_txq->flowc_idx = eosw_txq->pidx; 2614 2612 eosw_txq_advance(eosw_txq, 1); 2615 2613 ethofld_xmit(dev, eosw_txq); 2616 2614 2617 - out_unlock: 2615 + spin_unlock_bh(&eosw_txq->lock); 2616 + return 0; 2617 + 2618 + out_free_skb: 2619 + dev_consume_skb_any(skb); 2618 2620 spin_unlock_bh(&eosw_txq->lock); 2619 2621 return ret; 2620 2622 }
+5 -2
drivers/net/ethernet/cisco/enic/enic_main.c
··· 768 768 return err; 769 769 } 770 770 771 - static inline void enic_queue_wq_skb(struct enic *enic, 771 + static inline int enic_queue_wq_skb(struct enic *enic, 772 772 struct vnic_wq *wq, struct sk_buff *skb) 773 773 { 774 774 unsigned int mss = skb_shinfo(skb)->gso_size; ··· 814 814 wq->to_use = buf->next; 815 815 dev_kfree_skb(skb); 816 816 } 817 + return err; 817 818 } 818 819 819 820 /* netif_tx_lock held, process context with BHs disabled, or BH */ ··· 858 857 return NETDEV_TX_BUSY; 859 858 } 860 859 861 - enic_queue_wq_skb(enic, wq, skb); 860 + if (enic_queue_wq_skb(enic, wq, skb)) 861 + goto error; 862 862 863 863 if (vnic_wq_desc_avail(wq) < MAX_SKB_FRAGS + ENIC_DESC_MAX_SPLITS) 864 864 netif_tx_stop_queue(txq); ··· 867 865 if (!netdev_xmit_more() || netif_xmit_stopped(txq)) 868 866 vnic_wq_doorbell(wq); 869 867 868 + error: 870 869 spin_unlock(&enic->wq_lock[txq_map]); 871 870 872 871 return NETDEV_TX_OK;
+9 -3
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 575 575 if (h->ae_algo->ops->set_timer_task) 576 576 h->ae_algo->ops->set_timer_task(priv->ae_handle, false); 577 577 578 - netif_tx_stop_all_queues(netdev); 579 578 netif_carrier_off(netdev); 579 + netif_tx_disable(netdev); 580 580 581 581 hns3_nic_net_down(netdev); 582 582 ··· 824 824 * and it is udp packet, which has a dest port as the IANA assigned. 825 825 * the hardware is expected to do the checksum offload, but the 826 826 * hardware will not do the checksum offload when udp dest port is 827 - * 4789 or 6081. 827 + * 4789, 4790 or 6081. 828 828 */ 829 829 static bool hns3_tunnel_csum_bug(struct sk_buff *skb) 830 830 { ··· 842 842 843 843 if (!(!skb->encapsulation && 844 844 (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) || 845 - l4.udp->dest == htons(GENEVE_UDP_PORT)))) 845 + l4.udp->dest == htons(GENEVE_UDP_PORT) || 846 + l4.udp->dest == htons(4790)))) 846 847 return false; 847 848 848 849 skb_checksum_help(skb); ··· 4616 4615 struct hnae3_knic_private_info *kinfo = &handle->kinfo; 4617 4616 struct hns3_nic_priv *priv = netdev_priv(kinfo->netdev); 4618 4617 int ret = 0; 4618 + 4619 + if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state)) { 4620 + netdev_err(kinfo->netdev, "device is not initialized yet\n"); 4621 + return -EFAULT; 4622 + } 4619 4623 4620 4624 clear_bit(HNS3_NIC_STATE_RESETTING, &priv->state); 4621 4625
+2 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
··· 753 753 754 754 /* configure IGU,EGU error interrupts */ 755 755 hclge_cmd_setup_basic_desc(&desc, HCLGE_IGU_COMMON_INT_EN, false); 756 + desc.data[0] = cpu_to_le32(HCLGE_IGU_ERR_INT_TYPE); 756 757 if (en) 757 - desc.data[0] = cpu_to_le32(HCLGE_IGU_ERR_INT_EN); 758 + desc.data[0] |= cpu_to_le32(HCLGE_IGU_ERR_INT_EN); 758 759 759 760 desc.data[1] = cpu_to_le32(HCLGE_IGU_ERR_INT_EN_MASK); 760 761
+2 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h
··· 32 32 #define HCLGE_TQP_ECC_ERR_INT_EN_MASK 0x0FFF 33 33 #define HCLGE_MSIX_SRAM_ECC_ERR_INT_EN_MASK 0x0F000000 34 34 #define HCLGE_MSIX_SRAM_ECC_ERR_INT_EN 0x0F000000 35 - #define HCLGE_IGU_ERR_INT_EN 0x0000066F 35 + #define HCLGE_IGU_ERR_INT_EN 0x0000000F 36 + #define HCLGE_IGU_ERR_INT_TYPE 0x00000660 36 37 #define HCLGE_IGU_ERR_INT_EN_MASK 0x000F 37 38 #define HCLGE_IGU_TNL_ERR_INT_EN 0x0002AABF 38 39 #define HCLGE_IGU_TNL_ERR_INT_EN_MASK 0x003F
+6
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 3978 3978 struct hnae3_ae_dev *ae_dev = pci_get_drvdata(hdev->pdev); 3979 3979 enum hnae3_reset_type reset_level; 3980 3980 3981 + /* reset request will not be set during reset, so clear 3982 + * pending reset request to avoid unnecessary reset 3983 + * caused by the same reason. 3984 + */ 3985 + hclge_get_reset_level(ae_dev, &hdev->reset_request); 3986 + 3981 3987 /* if default_reset_request has a higher level reset request, 3982 3988 * it should be handled as soon as possible. since some errors 3983 3989 * need this kind of reset to fix.
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 533 533 unsigned long advertising; 534 534 unsigned long supported; 535 535 unsigned long send_data; 536 - u8 msg_data[10]; 536 + u8 msg_data[10] = {}; 537 537 u8 dest_vfid; 538 538 539 539 advertising = hdev->hw.mac.advertising[0];
+2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
··· 255 255 if (!phydev) 256 256 return; 257 257 258 + phy_loopback(phydev, false); 259 + 258 260 phy_start(phydev); 259 261 } 260 262
-1
drivers/net/ethernet/intel/i40e/i40e.h
··· 1144 1144 return !!(pf->flags & I40E_FLAG_DISABLE_FW_LLDP); 1145 1145 } 1146 1146 1147 - void i40e_set_lldp_forwarding(struct i40e_pf *pf, bool enable); 1148 1147 #ifdef CONFIG_I40E_DCB 1149 1148 void i40e_dcbnl_flush_apps(struct i40e_pf *pf, 1150 1149 struct i40e_dcbx_config *old_cfg,
+4 -2
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h
··· 1566 1566 I40E_PHY_TYPE_25GBASE_LR = 0x22, 1567 1567 I40E_PHY_TYPE_25GBASE_AOC = 0x23, 1568 1568 I40E_PHY_TYPE_25GBASE_ACC = 0x24, 1569 - I40E_PHY_TYPE_2_5GBASE_T = 0x30, 1570 - I40E_PHY_TYPE_5GBASE_T = 0x31, 1569 + I40E_PHY_TYPE_2_5GBASE_T = 0x26, 1570 + I40E_PHY_TYPE_5GBASE_T = 0x27, 1571 + I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS = 0x30, 1572 + I40E_PHY_TYPE_5GBASE_T_LINK_STATUS = 0x31, 1571 1573 I40E_PHY_TYPE_MAX, 1572 1574 I40E_PHY_TYPE_NOT_SUPPORTED_HIGH_TEMP = 0xFD, 1573 1575 I40E_PHY_TYPE_EMPTY = 0xFE,
+1
drivers/net/ethernet/intel/i40e/i40e_client.c
··· 375 375 clear_bit(__I40E_CLIENT_INSTANCE_OPENED, 376 376 &cdev->state); 377 377 i40e_client_del_instance(pf); 378 + return; 378 379 } 379 380 } 380 381 }
+2 -2
drivers/net/ethernet/intel/i40e/i40e_common.c
··· 1154 1154 break; 1155 1155 case I40E_PHY_TYPE_100BASE_TX: 1156 1156 case I40E_PHY_TYPE_1000BASE_T: 1157 - case I40E_PHY_TYPE_2_5GBASE_T: 1158 - case I40E_PHY_TYPE_5GBASE_T: 1157 + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: 1158 + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: 1159 1159 case I40E_PHY_TYPE_10GBASE_T: 1160 1160 media = I40E_MEDIA_TYPE_BASET; 1161 1161 break;
+4 -4
drivers/net/ethernet/intel/i40e/i40e_ethtool.c
··· 841 841 10000baseT_Full); 842 842 break; 843 843 case I40E_PHY_TYPE_10GBASE_T: 844 - case I40E_PHY_TYPE_5GBASE_T: 845 - case I40E_PHY_TYPE_2_5GBASE_T: 844 + case I40E_PHY_TYPE_5GBASE_T_LINK_STATUS: 845 + case I40E_PHY_TYPE_2_5GBASE_T_LINK_STATUS: 846 846 case I40E_PHY_TYPE_1000BASE_T: 847 847 case I40E_PHY_TYPE_100BASE_TX: 848 848 ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg); ··· 1409 1409 1410 1410 memset(&config, 0, sizeof(config)); 1411 1411 config.phy_type = abilities.phy_type; 1412 - config.abilities = abilities.abilities; 1412 + config.abilities = abilities.abilities | 1413 + I40E_AQ_PHY_ENABLE_ATOMIC_LINK; 1413 1414 config.phy_type_ext = abilities.phy_type_ext; 1414 1415 config.link_speed = abilities.link_speed; 1415 1416 config.eee_capability = abilities.eee_capability; ··· 5282 5281 i40e_aq_cfg_lldp_mib_change_event(&pf->hw, false, NULL); 5283 5282 i40e_aq_stop_lldp(&pf->hw, true, false, NULL); 5284 5283 } else { 5285 - i40e_set_lldp_forwarding(pf, false); 5286 5284 status = i40e_aq_start_lldp(&pf->hw, false, NULL); 5287 5285 if (status) { 5288 5286 adq_err = pf->hw.aq.asq_last_status;
-42
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 6880 6880 #endif /* CONFIG_I40E_DCB */ 6881 6881 6882 6882 /** 6883 - * i40e_set_lldp_forwarding - set forwarding of lldp frames 6884 - * @pf: PF being configured 6885 - * @enable: if forwarding to OS shall be enabled 6886 - * 6887 - * Toggle forwarding of lldp frames behavior, 6888 - * When passing DCB control from firmware to software 6889 - * lldp frames must be forwarded to the software based 6890 - * lldp agent. 6891 - */ 6892 - void i40e_set_lldp_forwarding(struct i40e_pf *pf, bool enable) 6893 - { 6894 - if (pf->lan_vsi == I40E_NO_VSI) 6895 - return; 6896 - 6897 - if (!pf->vsi[pf->lan_vsi]) 6898 - return; 6899 - 6900 - /* No need to check the outcome, commands may fail 6901 - * if desired value is already set 6902 - */ 6903 - i40e_aq_add_rem_control_packet_filter(&pf->hw, NULL, ETH_P_LLDP, 6904 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX | 6905 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC, 6906 - pf->vsi[pf->lan_vsi]->seid, 0, 6907 - enable, NULL, NULL); 6908 - 6909 - i40e_aq_add_rem_control_packet_filter(&pf->hw, NULL, ETH_P_LLDP, 6910 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX | 6911 - I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC, 6912 - pf->vsi[pf->lan_vsi]->seid, 0, 6913 - enable, NULL, NULL); 6914 - } 6915 - 6916 - /** 6917 6883 * i40e_print_link_message - print link up or down 6918 6884 * @vsi: the VSI for which link needs a message 6919 6885 * @isup: true of link is up, false otherwise ··· 10702 10736 */ 10703 10737 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, 10704 10738 pf->main_vsi_seid); 10705 - #ifdef CONFIG_I40E_DCB 10706 - if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) 10707 - i40e_set_lldp_forwarding(pf, true); 10708 - #endif /* CONFIG_I40E_DCB */ 10709 10739 10710 10740 /* restart the VSIs that were rebuilt and running before the reset */ 10711 10741 i40e_pf_unquiesce_all_vsi(pf); ··· 15734 15772 */ 15735 15773 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw, 15736 15774 pf->main_vsi_seid); 15737 - #ifdef CONFIG_I40E_DCB 15738 - if (pf->flags & I40E_FLAG_DISABLE_FW_LLDP) 15739 - i40e_set_lldp_forwarding(pf, true); 15740 - #endif /* CONFIG_I40E_DCB */ 15741 15775 15742 15776 if ((pf->hw.device_id == I40E_DEV_ID_10G_BASE_T) || 15743 15777 (pf->hw.device_id == I40E_DEV_ID_10G_BASE_T4))
+2 -6
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 1961 1961 union i40e_rx_desc *rx_desc) 1962 1962 1963 1963 { 1964 - /* XDP packets use error pointer so abort at this point */ 1965 - if (IS_ERR(skb)) 1966 - return true; 1967 - 1968 1964 /* ERR_MASK will only have valid bits if EOP set, and 1969 1965 * what we are doing here is actually checking 1970 1966 * I40E_RX_DESC_ERROR_RXE_SHIFT, since it is the zeroth bit in ··· 2530 2534 } 2531 2535 2532 2536 /* exit if we failed to retrieve a buffer */ 2533 - if (!skb) { 2537 + if (!xdp_res && !skb) { 2534 2538 rx_ring->rx_stats.alloc_buff_failed++; 2535 2539 rx_buffer->pagecnt_bias++; 2536 2540 break; ··· 2543 2547 if (i40e_is_non_eop(rx_ring, rx_desc)) 2544 2548 continue; 2545 2549 2546 - if (i40e_cleanup_headers(rx_ring, skb, rx_desc)) { 2550 + if (xdp_res || i40e_cleanup_headers(rx_ring, skb, rx_desc)) { 2547 2551 skb = NULL; 2548 2552 continue; 2549 2553 }
+2 -5
drivers/net/ethernet/intel/i40e/i40e_type.h
··· 239 239 #define I40E_CAP_PHY_TYPE_25GBASE_ACC BIT_ULL(I40E_PHY_TYPE_25GBASE_ACC + \ 240 240 I40E_PHY_TYPE_OFFSET) 241 241 /* Offset for 2.5G/5G PHY Types value to bit number conversion */ 242 - #define I40E_PHY_TYPE_OFFSET2 (-10) 243 - #define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T + \ 244 - I40E_PHY_TYPE_OFFSET2) 245 - #define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T + \ 246 - I40E_PHY_TYPE_OFFSET2) 242 + #define I40E_CAP_PHY_TYPE_2_5GBASE_T BIT_ULL(I40E_PHY_TYPE_2_5GBASE_T) 243 + #define I40E_CAP_PHY_TYPE_5GBASE_T BIT_ULL(I40E_PHY_TYPE_5GBASE_T) 247 244 #define I40E_HW_CAP_MAX_GPIO 30 248 245 /* Capabilities of a PF or a VF or the whole device */ 249 246 struct i40e_hw_capabilities {
+15 -15
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
··· 535 535 u16 erif_index = 0; 536 536 int err; 537 537 538 + /* Add the eRIF */ 539 + if (mlxsw_sp_mr_vif_valid(rve->mr_vif)) { 540 + erif_index = mlxsw_sp_rif_index(rve->mr_vif->rif); 541 + err = mr->mr_ops->route_erif_add(mlxsw_sp, 542 + rve->mr_route->route_priv, 543 + erif_index); 544 + if (err) 545 + return err; 546 + } 547 + 538 548 /* Update the route action, as the new eVIF can be a tunnel or a pimreg 539 549 * device which will require updating the action. 540 550 */ ··· 554 544 rve->mr_route->route_priv, 555 545 route_action); 556 546 if (err) 557 - return err; 558 - } 559 - 560 - /* Add the eRIF */ 561 - if (mlxsw_sp_mr_vif_valid(rve->mr_vif)) { 562 - erif_index = mlxsw_sp_rif_index(rve->mr_vif->rif); 563 - err = mr->mr_ops->route_erif_add(mlxsw_sp, 564 - rve->mr_route->route_priv, 565 - erif_index); 566 - if (err) 567 - goto err_route_erif_add; 547 + goto err_route_action_update; 568 548 } 569 549 570 550 /* Update the minimum MTU */ ··· 572 572 return 0; 573 573 574 574 err_route_min_mtu_update: 575 - if (mlxsw_sp_mr_vif_valid(rve->mr_vif)) 576 - mr->mr_ops->route_erif_del(mlxsw_sp, rve->mr_route->route_priv, 577 - erif_index); 578 - err_route_erif_add: 579 575 if (route_action != rve->mr_route->route_action) 580 576 mr->mr_ops->route_action_update(mlxsw_sp, 581 577 rve->mr_route->route_priv, 582 578 rve->mr_route->route_action); 579 + err_route_action_update: 580 + if (mlxsw_sp_mr_vif_valid(rve->mr_vif)) 581 + mr->mr_ops->route_erif_del(mlxsw_sp, rve->mr_route->route_priv, 582 + erif_index); 583 583 return err; 584 584 } 585 585
+1
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
··· 642 642 value &= ~GMAC_PACKET_FILTER_PCF; 643 643 value &= ~GMAC_PACKET_FILTER_PM; 644 644 value &= ~GMAC_PACKET_FILTER_PR; 645 + value &= ~GMAC_PACKET_FILTER_RA; 645 646 if (dev->flags & IFF_PROMISC) { 646 647 /* VLAN Tag Filter Fail Packets Queuing */ 647 648 if (hw->vlan_fail_q_en) {
+1 -6
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
··· 232 232 u32 channel, int fifosz, u8 qmode) 233 233 { 234 234 unsigned int rqs = fifosz / 256 - 1; 235 - u32 mtl_rx_op, mtl_rx_int; 235 + u32 mtl_rx_op; 236 236 237 237 mtl_rx_op = readl(ioaddr + MTL_CHAN_RX_OP_MODE(channel)); 238 238 ··· 293 293 } 294 294 295 295 writel(mtl_rx_op, ioaddr + MTL_CHAN_RX_OP_MODE(channel)); 296 - 297 - /* Enable MTL RX overflow */ 298 - mtl_rx_int = readl(ioaddr + MTL_CHAN_INT_CTRL(channel)); 299 - writel(mtl_rx_int | MTL_RX_OVERFLOW_INT_EN, 300 - ioaddr + MTL_CHAN_INT_CTRL(channel)); 301 296 } 302 297 303 298 static void dwmac4_dma_tx_chan_op_mode(void __iomem *ioaddr, int mode,
-1
drivers/net/ethernet/stmicro/stmmac/hwif.h
··· 564 564 #define stmmac_clean_desc3(__priv, __args...) \ 565 565 stmmac_do_void_callback(__priv, mode, clean_desc3, __args) 566 566 567 - struct stmmac_priv; 568 567 struct tc_cls_u32_offload; 569 568 struct tc_cbs_qopt_offload; 570 569 struct flow_cls_offload;
+3 -12
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 3180 3180 char *name; 3181 3181 3182 3182 clear_bit(__FPE_TASK_SCHED, &priv->fpe_task_state); 3183 + clear_bit(__FPE_REMOVING, &priv->fpe_task_state); 3183 3184 3184 3185 name = priv->wq_name; 3185 3186 sprintf(name, "%s-fpe", priv->dev->name); ··· 5587 5586 /* To handle GMAC own interrupts */ 5588 5587 if ((priv->plat->has_gmac) || xmac) { 5589 5588 int status = stmmac_host_irq_status(priv, priv->hw, &priv->xstats); 5590 - int mtl_status; 5591 5589 5592 5590 if (unlikely(status)) { 5593 5591 /* For LPI we need to save the tx status */ ··· 5597 5597 } 5598 5598 5599 5599 for (queue = 0; queue < queues_count; queue++) { 5600 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; 5601 - 5602 - mtl_status = stmmac_host_mtl_irq_status(priv, priv->hw, 5603 - queue); 5604 - if (mtl_status != -EINVAL) 5605 - status |= mtl_status; 5606 - 5607 - if (status & CORE_IRQ_MTL_RX_OVERFLOW) 5608 - stmmac_set_rx_tail_ptr(priv, priv->ioaddr, 5609 - rx_q->rx_tail_addr, 5610 - queue); 5600 + status = stmmac_host_mtl_irq_status(priv, priv->hw, 5601 + queue); 5611 5602 } 5612 5603 5613 5604 /* PCS link status */
+2 -2
drivers/net/ipa/gsi.c
··· 211 211 iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET); 212 212 213 213 /* The inter-EE registers are in the non-adjusted address range */ 214 - iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_CH_IRQ_OFFSET); 215 - iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET); 214 + iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET); 215 + iowrite32(0, gsi->virt_raw + GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET); 216 216 217 217 iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); 218 218 }
+8 -8
drivers/net/ipa/gsi_reg.h
··· 53 53 #define GSI_EE_REG_ADJUST 0x0000d000 /* IPA v4.5+ */ 54 54 55 55 /* The two inter-EE IRQ register offsets are relative to gsi->virt_raw */ 56 - #define GSI_INTER_EE_SRC_CH_IRQ_OFFSET \ 57 - GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(GSI_EE_AP) 58 - #define GSI_INTER_EE_N_SRC_CH_IRQ_OFFSET(ee) \ 59 - (0x0000c018 + 0x1000 * (ee)) 56 + #define GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET \ 57 + GSI_INTER_EE_N_SRC_CH_IRQ_MSK_OFFSET(GSI_EE_AP) 58 + #define GSI_INTER_EE_N_SRC_CH_IRQ_MSK_OFFSET(ee) \ 59 + (0x0000c020 + 0x1000 * (ee)) 60 60 61 - #define GSI_INTER_EE_SRC_EV_CH_IRQ_OFFSET \ 62 - GSI_INTER_EE_N_SRC_EV_CH_IRQ_OFFSET(GSI_EE_AP) 63 - #define GSI_INTER_EE_N_SRC_EV_CH_IRQ_OFFSET(ee) \ 64 - (0x0000c01c + 0x1000 * (ee)) 61 + #define GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET \ 62 + GSI_INTER_EE_N_SRC_EV_CH_IRQ_MSK_OFFSET(GSI_EE_AP) 63 + #define GSI_INTER_EE_N_SRC_EV_CH_IRQ_MSK_OFFSET(ee) \ 64 + (0x0000c024 + 0x1000 * (ee)) 65 65 66 66 /* All other register offsets are relative to gsi->virt */ 67 67
+50 -12
drivers/net/phy/marvell.c
··· 1088 1088 } 1089 1089 } 1090 1090 1091 + static int m88e1112_config_init(struct phy_device *phydev) 1092 + { 1093 + int err; 1094 + 1095 + err = m88e1011_set_downshift(phydev, 3); 1096 + if (err < 0) 1097 + return err; 1098 + 1099 + return m88e1111_config_init(phydev); 1100 + } 1101 + 1102 + static int m88e1111gbe_config_init(struct phy_device *phydev) 1103 + { 1104 + int err; 1105 + 1106 + err = m88e1111_set_downshift(phydev, 3); 1107 + if (err < 0) 1108 + return err; 1109 + 1110 + return m88e1111_config_init(phydev); 1111 + } 1112 + 1113 + static int marvell_1011gbe_config_init(struct phy_device *phydev) 1114 + { 1115 + int err; 1116 + 1117 + err = m88e1011_set_downshift(phydev, 3); 1118 + if (err < 0) 1119 + return err; 1120 + 1121 + return marvell_config_init(phydev); 1122 + } 1091 1123 static int m88e1116r_config_init(struct phy_device *phydev) 1092 1124 { 1093 1125 int err; ··· 1200 1168 if (err < 0) 1201 1169 return err; 1202 1170 } 1171 + err = m88e1011_set_downshift(phydev, 3); 1172 + if (err < 0) 1173 + return err; 1203 1174 1204 1175 return m88e1318_config_init(phydev); 1205 1176 } ··· 1355 1320 if (err < 0) 1356 1321 return err; 1357 1322 } 1323 + err = m88e1111_set_downshift(phydev, 3); 1324 + if (err < 0) 1325 + return err; 1358 1326 1359 1327 err = marvell_of_reg_init(phydev); 1360 1328 if (err < 0) ··· 2736 2698 .name = "Marvell 88E1112", 2737 2699 /* PHY_GBIT_FEATURES */ 2738 2700 .probe = marvell_probe, 2739 - .config_init = m88e1111_config_init, 2701 + .config_init = m88e1112_config_init, 2740 2702 .config_aneg = marvell_config_aneg, 2741 2703 .config_intr = marvell_config_intr, 2742 2704 .handle_interrupt = marvell_handle_interrupt, ··· 2756 2718 .name = "Marvell 88E1111", 2757 2719 /* PHY_GBIT_FEATURES */ 2758 2720 .probe = marvell_probe, 2759 - .config_init = m88e1111_config_init, 2721 + .config_init = m88e1111gbe_config_init, 2760 2722 .config_aneg = m88e1111_config_aneg, 2761 2723 .read_status = marvell_read_status, 2762 2724 .config_intr = marvell_config_intr, ··· 2777 2739 .name = "Marvell 88E1111 (Finisar)", 2778 2740 /* PHY_GBIT_FEATURES */ 2779 2741 .probe = marvell_probe, 2780 - .config_init = m88e1111_config_init, 2742 + .config_init = m88e1111gbe_config_init, 2781 2743 .config_aneg = m88e1111_config_aneg, 2782 2744 .read_status = marvell_read_status, 2783 2745 .config_intr = marvell_config_intr, ··· 2817 2779 .driver_data = DEF_MARVELL_HWMON_OPS(m88e1121_hwmon_ops), 2818 2780 /* PHY_GBIT_FEATURES */ 2819 2781 .probe = marvell_probe, 2820 - .config_init = marvell_config_init, 2782 + .config_init = marvell_1011gbe_config_init, 2821 2783 .config_aneg = m88e1121_config_aneg, 2822 2784 .read_status = marvell_read_status, 2823 2785 .config_intr = marvell_config_intr, ··· 2897 2859 .name = "Marvell 88E1240", 2898 2860 /* PHY_GBIT_FEATURES */ 2899 2861 .probe = marvell_probe, 2900 - .config_init = m88e1111_config_init, 2862 + .config_init = m88e1112_config_init, 2901 2863 .config_aneg = marvell_config_aneg, 2902 2864 .config_intr = marvell_config_intr, 2903 2865 .handle_interrupt = marvell_handle_interrupt, ··· 2967 2929 /* PHY_GBIT_FEATURES */ 2968 2930 .flags = PHY_POLL_CABLE_TEST, 2969 2931 .probe = marvell_probe, 2970 - .config_init = marvell_config_init, 2932 + .config_init = marvell_1011gbe_config_init, 2971 2933 .config_aneg = m88e1510_config_aneg, 2972 2934 .read_status = marvell_read_status, 2973 2935 .config_intr = marvell_config_intr, ··· 2993 2955 .probe = marvell_probe, 2994 2956 /* PHY_GBIT_FEATURES */ 2995 2957 .flags = PHY_POLL_CABLE_TEST, 2996 - .config_init = marvell_config_init, 2958 + .config_init = marvell_1011gbe_config_init, 2997 2959 .config_aneg = m88e1510_config_aneg, 2998 2960 .read_status = marvell_read_status, 2999 2961 .config_intr = marvell_config_intr, ··· 3038 3000 /* PHY_GBIT_FEATURES */ 3039 3001 .flags = PHY_POLL_CABLE_TEST, 3040 3002 .probe = marvell_probe, 3041 - .config_init = marvell_config_init, 3003 + .config_init = marvell_1011gbe_config_init, 3042 3004 .config_aneg = m88e6390_config_aneg, 3043 3005 .read_status = marvell_read_status, 3044 3006 .config_intr = marvell_config_intr, ··· 3064 3026 /* PHY_GBIT_FEATURES */ 3065 3027 .flags = PHY_POLL_CABLE_TEST, 3066 3028 .probe = marvell_probe, 3067 - .config_init = marvell_config_init, 3029 + .config_init = marvell_1011gbe_config_init, 3068 3030 .config_aneg = m88e6390_config_aneg, 3069 3031 .read_status = marvell_read_status, 3070 3032 .config_intr = marvell_config_intr, ··· 3090 3052 /* PHY_GBIT_FEATURES */ 3091 3053 .flags = PHY_POLL_CABLE_TEST, 3092 3054 .probe = marvell_probe, 3093 - .config_init = marvell_config_init, 3055 + .config_init = marvell_1011gbe_config_init, 3094 3056 .config_aneg = m88e1510_config_aneg, 3095 3057 .read_status = marvell_read_status, 3096 3058 .config_intr = marvell_config_intr, ··· 3115 3077 .driver_data = DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), 3116 3078 .probe = marvell_probe, 3117 3079 /* PHY_GBIT_FEATURES */ 3118 - .config_init = marvell_config_init, 3080 + .config_init = marvell_1011gbe_config_init, 3119 3081 .config_aneg = m88e1510_config_aneg, 3120 3082 .read_status = marvell_read_status, 3121 3083 .config_intr = marvell_config_intr, ··· 3137 3099 .driver_data = DEF_MARVELL_HWMON_OPS(m88e1510_hwmon_ops), 3138 3100 .probe = marvell_probe, 3139 3101 .features = PHY_GBIT_FIBRE_FEATURES, 3140 - .config_init = marvell_config_init, 3102 + .config_init = marvell_1011gbe_config_init, 3141 3103 .config_aneg = m88e1510_config_aneg, 3142 3104 .read_status = marvell_read_status, 3143 3105 .config_intr = marvell_config_intr,
+2 -3
drivers/net/wan/hdlc_fr.c
··· 415 415 416 416 if (pad > 0) { /* Pad the frame with zeros */ 417 417 if (__skb_pad(skb, pad, false)) 418 - goto out; 418 + goto drop; 419 419 skb_put(skb, pad); 420 420 } 421 421 } ··· 448 448 return NETDEV_TX_OK; 449 449 450 450 drop: 451 - kfree_skb(skb); 452 - out: 453 451 dev->stats.tx_dropped++; 452 + kfree_skb(skb); 454 453 return NETDEV_TX_OK; 455 454 } 456 455
+3 -2
include/linux/bpf_verifier.h
··· 302 302 }; 303 303 304 304 /* Possible states for alu_state member. */ 305 - #define BPF_ALU_SANITIZE_SRC 1U 306 - #define BPF_ALU_SANITIZE_DST 2U 305 + #define BPF_ALU_SANITIZE_SRC (1U << 0) 306 + #define BPF_ALU_SANITIZE_DST (1U << 1) 307 307 #define BPF_ALU_NEG_VALUE (1U << 2) 308 308 #define BPF_ALU_NON_POINTER (1U << 3) 309 + #define BPF_ALU_IMMEDIATE (1U << 4) 309 310 #define BPF_ALU_SANITIZE (BPF_ALU_SANITIZE_SRC | \ 310 311 BPF_ALU_SANITIZE_DST) 311 312
+1 -2
include/linux/netfilter_arp/arp_tables.h
··· 53 53 const struct arpt_replace *repl, 54 54 const struct nf_hook_ops *ops); 55 55 void arpt_unregister_table(struct net *net, const char *name); 56 - void arpt_unregister_table_pre_exit(struct net *net, const char *name, 57 - const struct nf_hook_ops *ops); 56 + void arpt_unregister_table_pre_exit(struct net *net, const char *name); 58 57 extern unsigned int arpt_do_table(struct sk_buff *skb, 59 58 const struct nf_hook_state *state, 60 59 struct xt_table *table);
-1
include/net/sctp/command.h
··· 68 68 SCTP_CMD_ASSOC_FAILED, /* Handle association failure. */ 69 69 SCTP_CMD_DISCARD_PACKET, /* Discard the whole packet. */ 70 70 SCTP_CMD_GEN_SHUTDOWN, /* Generate a SHUTDOWN chunk. */ 71 - SCTP_CMD_UPDATE_ASSOC, /* Update association information. */ 72 71 SCTP_CMD_PURGE_OUTQUEUE, /* Purge all data waiting to be sent. */ 73 72 SCTP_CMD_SETUP_T2, /* Hi-level, setup T2-shutdown parms. */ 74 73 SCTP_CMD_RTO_PENDING, /* Set transport's rto_pending. */
+6
include/uapi/linux/netfilter/xt_SECMARK.h
··· 20 20 char secctx[SECMARK_SECCTX_MAX]; 21 21 }; 22 22 23 + struct xt_secmark_target_info_v1 { 24 + __u8 mode; 25 + char secctx[SECMARK_SECCTX_MAX]; 26 + __u32 secid; 27 + }; 28 + 23 29 #endif /*_XT_SECMARK_H_target */
+30
include/uapi/linux/seg6_local.h
··· 27 27 SEG6_LOCAL_OIF, 28 28 SEG6_LOCAL_BPF, 29 29 SEG6_LOCAL_VRFTABLE, 30 + SEG6_LOCAL_COUNTERS, 30 31 __SEG6_LOCAL_MAX, 31 32 }; 32 33 #define SEG6_LOCAL_MAX (__SEG6_LOCAL_MAX - 1) ··· 78 77 }; 79 78 80 79 #define SEG6_LOCAL_BPF_PROG_MAX (__SEG6_LOCAL_BPF_PROG_MAX - 1) 80 + 81 + /* SRv6 Behavior counters are encoded as netlink attributes guaranteeing the 82 + * correct alignment. 83 + * Each counter is identified by a different attribute type (i.e. 84 + * SEG6_LOCAL_CNT_PACKETS). 85 + * 86 + * - SEG6_LOCAL_CNT_PACKETS: identifies a counter that counts the number of 87 + * packets that have been CORRECTLY processed by an SRv6 Behavior instance 88 + * (i.e., packets that generate errors or are dropped are NOT counted). 89 + * 90 + * - SEG6_LOCAL_CNT_BYTES: identifies a counter that counts the total amount 91 + * of traffic in bytes of all packets that have been CORRECTLY processed by 92 + * an SRv6 Behavior instance (i.e., packets that generate errors or are 93 + * dropped are NOT counted). 94 + * 95 + * - SEG6_LOCAL_CNT_ERRORS: identifies a counter that counts the number of 96 + * packets that have NOT been properly processed by an SRv6 Behavior instance 97 + * (i.e., packets that generate errors or are dropped). 98 + */ 99 + enum { 100 + SEG6_LOCAL_CNT_UNSPEC, 101 + SEG6_LOCAL_CNT_PAD, /* pad for 64 bits values */ 102 + SEG6_LOCAL_CNT_PACKETS, 103 + SEG6_LOCAL_CNT_BYTES, 104 + SEG6_LOCAL_CNT_ERRORS, 105 + __SEG6_LOCAL_CNT_MAX, 106 + }; 107 + 108 + #define SEG6_LOCAL_CNT_MAX (__SEG6_LOCAL_CNT_MAX - 1) 81 109 82 110 #endif
+18 -15
kernel/bpf/verifier.c
··· 6496 6496 { 6497 6497 struct bpf_insn_aux_data *aux = commit_window ? cur_aux(env) : tmp_aux; 6498 6498 struct bpf_verifier_state *vstate = env->cur_state; 6499 + bool off_is_imm = tnum_is_const(off_reg->var_off); 6499 6500 bool off_is_neg = off_reg->smin_value < 0; 6500 6501 bool ptr_is_dst_reg = ptr_reg == dst_reg; 6501 6502 u8 opcode = BPF_OP(insn->code); ··· 6527 6526 alu_limit = abs(tmp_aux->alu_limit - alu_limit); 6528 6527 } else { 6529 6528 alu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0; 6529 + alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0; 6530 6530 alu_state |= ptr_is_dst_reg ? 6531 6531 BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST; 6532 6532 } ··· 12373 12371 const u8 code_add = BPF_ALU64 | BPF_ADD | BPF_X; 12374 12372 const u8 code_sub = BPF_ALU64 | BPF_SUB | BPF_X; 12375 12373 struct bpf_insn *patch = &insn_buf[0]; 12376 - bool issrc, isneg; 12374 + bool issrc, isneg, isimm; 12377 12375 u32 off_reg; 12378 12376 12379 12377 aux = &env->insn_aux_data[i + delta]; ··· 12384 12382 isneg = aux->alu_state & BPF_ALU_NEG_VALUE; 12385 12383 issrc = (aux->alu_state & BPF_ALU_SANITIZE) == 12386 12384 BPF_ALU_SANITIZE_SRC; 12385 + isimm = aux->alu_state & BPF_ALU_IMMEDIATE; 12387 12386 12388 12387 off_reg = issrc ? insn->src_reg : insn->dst_reg; 12389 - if (isneg) 12390 - *patch++ = BPF_ALU64_IMM(BPF_MUL, off_reg, -1); 12391 - *patch++ = BPF_MOV32_IMM(BPF_REG_AX, aux->alu_limit); 12392 - *patch++ = BPF_ALU64_REG(BPF_SUB, BPF_REG_AX, off_reg); 12393 - *patch++ = BPF_ALU64_REG(BPF_OR, BPF_REG_AX, off_reg); 12394 - *patch++ = BPF_ALU64_IMM(BPF_NEG, BPF_REG_AX, 0); 12395 - *patch++ = BPF_ALU64_IMM(BPF_ARSH, BPF_REG_AX, 63); 12396 - if (issrc) { 12397 - *patch++ = BPF_ALU64_REG(BPF_AND, BPF_REG_AX, 12398 - off_reg); 12399 - insn->src_reg = BPF_REG_AX; 12388 + if (isimm) { 12389 + *patch++ = BPF_MOV32_IMM(BPF_REG_AX, aux->alu_limit); 12400 12390 } else { 12401 - *patch++ = BPF_ALU64_REG(BPF_AND, off_reg, 12402 - BPF_REG_AX); 12391 + if (isneg) 12392 + *patch++ = BPF_ALU64_IMM(BPF_MUL, off_reg, -1); 12393 + *patch++ = BPF_MOV32_IMM(BPF_REG_AX, aux->alu_limit); 12394 + *patch++ = BPF_ALU64_REG(BPF_SUB, BPF_REG_AX, off_reg); 12395 + *patch++ = BPF_ALU64_REG(BPF_OR, BPF_REG_AX, off_reg); 12396 + *patch++ = BPF_ALU64_IMM(BPF_NEG, BPF_REG_AX, 0); 12397 + *patch++ = BPF_ALU64_IMM(BPF_ARSH, BPF_REG_AX, 63); 12398 + *patch++ = BPF_ALU64_REG(BPF_AND, BPF_REG_AX, off_reg); 12403 12399 } 12400 + if (!issrc) 12401 + *patch++ = BPF_MOV64_REG(insn->dst_reg, insn->src_reg); 12402 + insn->src_reg = BPF_REG_AX; 12404 12403 if (isneg) 12405 12404 insn->code = insn->code == code_add ? 12406 12405 code_sub : code_add; 12407 12406 *patch++ = *insn; 12408 - if (issrc && isneg) 12407 + if (issrc && isneg && !isimm) 12409 12408 *patch++ = BPF_ALU64_IMM(BPF_MUL, off_reg, -1); 12410 12409 cnt = patch - insn_buf; 12411 12410
+1 -1
lib/nlattr.c
··· 828 828 int attrlen = nla_len(nla); 829 829 int d; 830 830 831 - if (attrlen > 0 && buf[attrlen - 1] == '\0') 831 + while (attrlen > 0 && buf[attrlen - 1] == '\0') 832 832 attrlen--; 833 833 834 834 d = attrlen - len;
+3 -2
net/bridge/br_netlink.c
··· 103 103 104 104 rcu_read_lock(); 105 105 if (netif_is_bridge_port(dev)) { 106 - p = br_port_get_rcu(dev); 107 - vg = nbp_vlan_group_rcu(p); 106 + p = br_port_get_check_rcu(dev); 107 + if (p) 108 + vg = nbp_vlan_group_rcu(p); 108 109 } else if (dev->priv_flags & IFF_EBRIDGE) { 109 110 br = netdev_priv(dev); 110 111 vg = br_vlan_group_rcu(br);
+2 -1
net/ethtool/netlink.c
··· 387 387 int ret; 388 388 389 389 ehdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, 390 - &ethtool_genl_family, 0, ctx->ops->reply_cmd); 390 + &ethtool_genl_family, NLM_F_MULTI, 391 + ctx->ops->reply_cmd); 391 392 if (!ehdr) 392 393 return -EMSGSIZE; 393 394
+4
net/hsr/hsr_forward.c
··· 520 520 struct ethhdr *ethhdr; 521 521 __be16 proto; 522 522 523 + /* Check if skb contains hsr_ethhdr */ 524 + if (skb->mac_len < sizeof(struct hsr_ethhdr)) 525 + return -EINVAL; 526 + 523 527 memset(frame, 0, sizeof(*frame)); 524 528 frame->is_supervision = is_supervision_frame(port->hsr, skb); 525 529 frame->node_src = hsr_get_node(port, &hsr->node_db, skb,
+2 -3
net/ipv4/netfilter/arp_tables.c
··· 1556 1556 return ret; 1557 1557 } 1558 1558 1559 - void arpt_unregister_table_pre_exit(struct net *net, const char *name, 1560 - const struct nf_hook_ops *ops) 1559 + void arpt_unregister_table_pre_exit(struct net *net, const char *name) 1561 1560 { 1562 1561 struct xt_table *table = xt_find_table(net, NFPROTO_ARP, name); 1563 1562 1564 1563 if (table) 1565 - nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks)); 1564 + nf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks)); 1566 1565 } 1567 1566 EXPORT_SYMBOL(arpt_unregister_table_pre_exit); 1568 1567
+1 -1
net/ipv4/netfilter/arptable_filter.c
··· 54 54 55 55 static void __net_exit arptable_filter_net_pre_exit(struct net *net) 56 56 { 57 - arpt_unregister_table_pre_exit(net, "filter", arpfilter_ops); 57 + arpt_unregister_table_pre_exit(net, "filter"); 58 58 } 59 59 60 60 static void __net_exit arptable_filter_net_exit(struct net *net)
+1
net/ipv4/tcp.c
··· 2039 2039 (__kernel_size_t)zc->msg_controllen; 2040 2040 cmsg_dummy.msg_flags = in_compat_syscall() 2041 2041 ? MSG_CMSG_COMPAT : 0; 2042 + cmsg_dummy.msg_control_is_user = true; 2042 2043 zc->msg_flags = 0; 2043 2044 if (zc->msg_control == msg_control_addr && 2044 2045 zc->msg_controllen == cmsg_dummy.msg_controllen) {
+4
net/ipv4/tcp_cong.c
··· 230 230 ret = -ENOENT; 231 231 } else if (!bpf_try_module_get(ca, ca->owner)) { 232 232 ret = -EBUSY; 233 + } else if (!net_eq(net, &init_net) && 234 + !(ca->flags & TCP_CONG_NON_RESTRICTED)) { 235 + /* Only init netns can set default to a restricted algorithm */ 236 + ret = -EPERM; 233 237 } else { 234 238 prev = xchg(&net->ipv4.tcp_congestion_control, ca); 235 239 if (prev)
-3
net/ipv6/seg6.c
··· 122 122 hinfo = seg6_hmac_info_lookup(net, hmackeyid); 123 123 124 124 if (!slen) { 125 - if (!hinfo) 126 - err = -ENOENT; 127 - 128 125 err = seg6_hmac_info_del(net, hmackeyid); 129 126 130 127 goto out_unlock;
+196 -2
net/ipv6/seg6_local.c
··· 93 93 int hdrlen; 94 94 }; 95 95 96 + struct pcpu_seg6_local_counters { 97 + u64_stats_t packets; 98 + u64_stats_t bytes; 99 + u64_stats_t errors; 100 + 101 + struct u64_stats_sync syncp; 102 + }; 103 + 104 + /* This struct groups all the SRv6 Behavior counters supported so far. 105 + * 106 + * put_nla_counters() makes use of this data structure to collect all counter 107 + * values after the per-CPU counter evaluation has been performed. 108 + * Finally, each counter value (in seg6_local_counters) is stored in the 109 + * corresponding netlink attribute and sent to user space. 110 + * 111 + * NB: we don't want to expose this structure to user space! 112 + */ 113 + struct seg6_local_counters { 114 + __u64 packets; 115 + __u64 bytes; 116 + __u64 errors; 117 + }; 118 + 119 + #define seg6_local_alloc_pcpu_counters(__gfp) \ 120 + __netdev_alloc_pcpu_stats(struct pcpu_seg6_local_counters, \ 121 + ((__gfp) | __GFP_ZERO)) 122 + 123 + #define SEG6_F_LOCAL_COUNTERS SEG6_F_ATTR(SEG6_LOCAL_COUNTERS) 124 + 96 125 struct seg6_local_lwt { 97 126 int action; 98 127 struct ipv6_sr_hdr *srh; ··· 134 105 #ifdef CONFIG_NET_L3_MASTER_DEV 135 106 struct seg6_end_dt_info dt_info; 136 107 #endif 108 + struct pcpu_seg6_local_counters __percpu *pcpu_counters; 137 109 138 110 int headroom; 139 111 struct seg6_action_desc *desc; ··· 908 878 { 909 879 .action = SEG6_LOCAL_ACTION_END, 910 880 .attrs = 0, 881 + .optattrs = SEG6_F_LOCAL_COUNTERS, 911 882 .input = input_action_end, 912 883 }, 913 884 { 914 885 .action = SEG6_LOCAL_ACTION_END_X, 915 886 .attrs = SEG6_F_ATTR(SEG6_LOCAL_NH6), 887 + .optattrs = SEG6_F_LOCAL_COUNTERS, 916 888 .input = input_action_end_x, 917 889 }, 918 890 { 919 891 .action = SEG6_LOCAL_ACTION_END_T, 920 892 .attrs = SEG6_F_ATTR(SEG6_LOCAL_TABLE), 893 + .optattrs = SEG6_F_LOCAL_COUNTERS, 921 894 .input = input_action_end_t, 922 895 }, 923 896 { 924 897 .action = SEG6_LOCAL_ACTION_END_DX2, 925 898 .attrs = SEG6_F_ATTR(SEG6_LOCAL_OIF), 899 + .optattrs = SEG6_F_LOCAL_COUNTERS, 926 900 .input = input_action_end_dx2, 927 901 }, 928 902 { 929 903 .action = SEG6_LOCAL_ACTION_END_DX6, 930 904 .attrs = SEG6_F_ATTR(SEG6_LOCAL_NH6), 905 + .optattrs = SEG6_F_LOCAL_COUNTERS, 931 906 .input = input_action_end_dx6, 932 907 }, 933 908 { 934 909 .action = SEG6_LOCAL_ACTION_END_DX4, 935 910 .attrs = SEG6_F_ATTR(SEG6_LOCAL_NH4), 911 + .optattrs = SEG6_F_LOCAL_COUNTERS, 936 912 .input = input_action_end_dx4, 937 913 }, 938 914 { 939 915 .action = SEG6_LOCAL_ACTION_END_DT4, 940 916 .attrs = SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE), 917 + .optattrs = SEG6_F_LOCAL_COUNTERS, 941 918 #ifdef CONFIG_NET_L3_MASTER_DEV 942 919 .input = input_action_end_dt4, 943 920 .slwt_ops = { ··· 956 919 .action = SEG6_LOCAL_ACTION_END_DT6, 957 920 #ifdef CONFIG_NET_L3_MASTER_DEV 958 921 .attrs = 0, 959 - .optattrs = SEG6_F_ATTR(SEG6_LOCAL_TABLE) | 922 + .optattrs = SEG6_F_LOCAL_COUNTERS | 923 + SEG6_F_ATTR(SEG6_LOCAL_TABLE) | 960 924 SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE), 961 925 .slwt_ops = { 962 926 .build_state = seg6_end_dt6_build, 963 927 }, 964 928 #else 965 929 .attrs = SEG6_F_ATTR(SEG6_LOCAL_TABLE), 930 + .optattrs = SEG6_F_LOCAL_COUNTERS, 966 931 #endif 967 932 .input = input_action_end_dt6, 968 933 }, 969 934 { 970 935 .action = SEG6_LOCAL_ACTION_END_B6, 971 936 .attrs = SEG6_F_ATTR(SEG6_LOCAL_SRH), 937 + .optattrs = SEG6_F_LOCAL_COUNTERS, 972 938 .input = input_action_end_b6, 973 939 }, 974 940 { 975 941 .action = SEG6_LOCAL_ACTION_END_B6_ENCAP, 976 942 .attrs = SEG6_F_ATTR(SEG6_LOCAL_SRH), 943 + .optattrs = SEG6_F_LOCAL_COUNTERS, 977 944 .input = input_action_end_b6_encap, 978 945 .static_headroom = sizeof(struct ipv6hdr), 979 946 }, 980 947 { 981 948 .action = SEG6_LOCAL_ACTION_END_BPF, 982 949 .attrs = SEG6_F_ATTR(SEG6_LOCAL_BPF), 950 + .optattrs = SEG6_F_LOCAL_COUNTERS, 983 951 .input = input_action_end_bpf, 984 952 }, 985 953 ··· 1005 963 return NULL; 1006 964 } 1007 965 966 + static bool seg6_lwtunnel_counters_enabled(struct seg6_local_lwt *slwt) 967 + { 968 + return slwt->parsed_optattrs & SEG6_F_LOCAL_COUNTERS; 969 + } 970 + 971 + static void seg6_local_update_counters(struct seg6_local_lwt *slwt, 972 + unsigned int len, int err) 973 + { 974 + struct pcpu_seg6_local_counters *pcounters; 975 + 976 + pcounters = this_cpu_ptr(slwt->pcpu_counters); 977 + u64_stats_update_begin(&pcounters->syncp); 978 + 979 + if (likely(!err)) { 980 + u64_stats_inc(&pcounters->packets); 981 + u64_stats_add(&pcounters->bytes, len); 982 + } else { 983 + u64_stats_inc(&pcounters->errors); 984 + } 985 + 986 + u64_stats_update_end(&pcounters->syncp); 987 + } 988 + 1008 989 static int seg6_local_input(struct sk_buff *skb) 1009 990 { 1010 991 struct dst_entry *orig_dst = skb_dst(skb); 1011 992 struct seg6_action_desc *desc; 1012 993 struct seg6_local_lwt *slwt; 994 + unsigned int len = skb->len; 995 + int rc; 1013 996 1014 997 if (skb->protocol != htons(ETH_P_IPV6)) { 1015 998 kfree_skb(skb); ··· 1044 977 slwt = seg6_local_lwtunnel(orig_dst->lwtstate); 1045 978 desc = slwt->desc; 1046 979 1047 - return desc->input(skb, slwt); 980 + rc = desc->input(skb, slwt); 981 + 982 + if (!seg6_lwtunnel_counters_enabled(slwt)) 983 + return rc; 984 + 985 + seg6_local_update_counters(slwt, len, rc); 986 + 987 + return rc; 1048 988 } 1049 989 1050 990 static const struct nla_policy seg6_local_policy[SEG6_LOCAL_MAX + 1] = { ··· 1066 992 [SEG6_LOCAL_IIF] = { .type = NLA_U32 }, 1067 993 [SEG6_LOCAL_OIF] = { .type = NLA_U32 }, 1068 994 [SEG6_LOCAL_BPF] = { .type = NLA_NESTED }, 995 + [SEG6_LOCAL_COUNTERS] = { .type = NLA_NESTED }, 1069 996 }; 1070 997 1071 998 static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt) ··· 1371 1296 bpf_prog_put(slwt->bpf.prog); 1372 1297 } 1373 1298 1299 + static const struct 1300 + nla_policy seg6_local_counters_policy[SEG6_LOCAL_CNT_MAX + 1] = { 1301 + [SEG6_LOCAL_CNT_PACKETS] = { .type = NLA_U64 }, 1302 + [SEG6_LOCAL_CNT_BYTES] = { .type = NLA_U64 }, 1303 + [SEG6_LOCAL_CNT_ERRORS] = { .type = NLA_U64 }, 1304 + }; 1305 + 1306 + static int parse_nla_counters(struct nlattr **attrs, 1307 + struct seg6_local_lwt *slwt) 1308 + { 1309 + struct pcpu_seg6_local_counters __percpu *pcounters; 1310 + struct nlattr *tb[SEG6_LOCAL_CNT_MAX + 1]; 1311 + int ret; 1312 + 1313 + ret = nla_parse_nested_deprecated(tb, SEG6_LOCAL_CNT_MAX, 1314 + attrs[SEG6_LOCAL_COUNTERS], 1315 + seg6_local_counters_policy, NULL); 1316 + if (ret < 0) 1317 + return ret; 1318 + 1319 + /* basic support for SRv6 Behavior counters requires at least: 1320 + * packets, bytes and errors. 1321 + */ 1322 + if (!tb[SEG6_LOCAL_CNT_PACKETS] || !tb[SEG6_LOCAL_CNT_BYTES] || 1323 + !tb[SEG6_LOCAL_CNT_ERRORS]) 1324 + return -EINVAL; 1325 + 1326 + /* counters are always zero initialized */ 1327 + pcounters = seg6_local_alloc_pcpu_counters(GFP_KERNEL); 1328 + if (!pcounters) 1329 + return -ENOMEM; 1330 + 1331 + slwt->pcpu_counters = pcounters; 1332 + 1333 + return 0; 1334 + } 1335 + 1336 + static int seg6_local_fill_nla_counters(struct sk_buff *skb, 1337 + struct seg6_local_counters *counters) 1338 + { 1339 + if (nla_put_u64_64bit(skb, SEG6_LOCAL_CNT_PACKETS, counters->packets, 1340 + SEG6_LOCAL_CNT_PAD)) 1341 + return -EMSGSIZE; 1342 + 1343 + if (nla_put_u64_64bit(skb, SEG6_LOCAL_CNT_BYTES, counters->bytes, 1344 + SEG6_LOCAL_CNT_PAD)) 1345 + return -EMSGSIZE; 1346 + 1347 + if (nla_put_u64_64bit(skb, SEG6_LOCAL_CNT_ERRORS, counters->errors, 1348 + SEG6_LOCAL_CNT_PAD)) 1349 + return -EMSGSIZE; 1350 + 1351 + return 0; 1352 + } 1353 + 1354 + static int put_nla_counters(struct sk_buff *skb, struct seg6_local_lwt *slwt) 1355 + { 1356 + struct seg6_local_counters counters = { 0, 0, 0 }; 1357 + struct nlattr *nest; 1358 + int rc, i; 1359 + 1360 + nest = nla_nest_start(skb, SEG6_LOCAL_COUNTERS); 1361 + if (!nest) 1362 + return -EMSGSIZE; 1363 + 1364 + for_each_possible_cpu(i) { 1365 + struct pcpu_seg6_local_counters *pcounters; 1366 + u64 packets, bytes, errors; 1367 + unsigned int start; 1368 + 1369 + pcounters = per_cpu_ptr(slwt->pcpu_counters, i); 1370 + do { 1371 + start = u64_stats_fetch_begin_irq(&pcounters->syncp); 1372 + 1373 + packets = u64_stats_read(&pcounters->packets); 1374 + bytes = u64_stats_read(&pcounters->bytes); 1375 + errors = u64_stats_read(&pcounters->errors); 1376 + 1377 + } while (u64_stats_fetch_retry_irq(&pcounters->syncp, start)); 1378 + 1379 + counters.packets += packets; 1380 + counters.bytes += bytes; 1381 + counters.errors += errors; 1382 + } 1383 + 1384 + rc = seg6_local_fill_nla_counters(skb, &counters); 1385 + if (rc < 0) { 1386 + nla_nest_cancel(skb, nest); 1387 + return rc; 1388 + } 1389 + 1390 + return nla_nest_end(skb, nest); 1391 + } 1392 + 1393 + static int cmp_nla_counters(struct seg6_local_lwt *a, struct seg6_local_lwt *b) 1394 + { 1395 + /* a and b are equal if both have pcpu_counters set or not */ 1396 + return (!!((unsigned long)a->pcpu_counters)) ^ 1397 + (!!((unsigned long)b->pcpu_counters)); 1398 + } 1399 + 1400 + static void destroy_attr_counters(struct seg6_local_lwt *slwt) 1401 + { 1402 + free_percpu(slwt->pcpu_counters); 1403 + } 1404 + 1374 1405 struct seg6_action_param { 1375 1406 int (*parse)(struct nlattr **attrs, struct seg6_local_lwt *slwt); 1376 1407 int (*put)(struct sk_buff *skb, struct seg6_local_lwt *slwt); ··· 1524 1343 .put = put_nla_vrftable, 1525 1344 .cmp = cmp_nla_vrftable }, 1526 1345 1346 + [SEG6_LOCAL_COUNTERS] = { .parse = parse_nla_counters, 1347 + .put = put_nla_counters, 1348 + .cmp = cmp_nla_counters, 1349 + .destroy = destroy_attr_counters }, 1527 1350 }; 1528 1351 1529 1352 /* call the destroy() callback (if available) for each set attribute in ··· 1829 1644 1830 1645 if (attrs & SEG6_F_ATTR(SEG6_LOCAL_VRFTABLE)) 1831 1646 nlsize += nla_total_size(4); 1647 + 1648 + if (attrs & SEG6_F_LOCAL_COUNTERS) 1649 + nlsize += nla_total_size(0) + /* nest SEG6_LOCAL_COUNTERS */ 1650 + /* SEG6_LOCAL_CNT_PACKETS */ 1651 + nla_total_size_64bit(sizeof(__u64)) + 1652 + /* SEG6_LOCAL_CNT_BYTES */ 1653 + nla_total_size_64bit(sizeof(__u64)) + 1654 + /* SEG6_LOCAL_CNT_ERRORS */ 1655 + nla_total_size_64bit(sizeof(__u64)); 1832 1656 1833 1657 return nlsize; 1834 1658 }
+1 -2
net/mptcp/subflow.c
··· 546 546 * ESTABLISHED state and will not have the SOCK_DEAD flag. 547 547 * Both result in warnings from inet_sock_destruct. 548 548 */ 549 - 550 - if (sk->sk_state == TCP_ESTABLISHED) { 549 + if ((1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { 551 550 sk->sk_state = TCP_CLOSE; 552 551 WARN_ON_ONCE(sk->sk_socket); 553 552 sock_orphan(sk);
+4 -1
net/netfilter/nf_conntrack_ftp.c
··· 413 413 414 414 spin_lock_bh(&nf_ftp_lock); 415 415 fb_ptr = skb_header_pointer(skb, dataoff, datalen, ftp_buffer); 416 - BUG_ON(fb_ptr == NULL); 416 + if (!fb_ptr) { 417 + spin_unlock_bh(&nf_ftp_lock); 418 + return NF_ACCEPT; 419 + } 417 420 418 421 ends_in_nl = (fb_ptr[datalen - 1] == '\n'); 419 422 seq = ntohl(th->seq) + datalen;
+2 -1
net/netfilter/nf_conntrack_h323_main.c
··· 146 146 /* Get first TPKT pointer */ 147 147 tpkt = skb_header_pointer(skb, tcpdataoff, tcpdatalen, 148 148 h323_buffer); 149 - BUG_ON(tpkt == NULL); 149 + if (!tpkt) 150 + goto clear_out; 150 151 151 152 /* Validate TPKT identifier */ 152 153 if (tcpdatalen < 4 || tpkt[0] != 0x03 || tpkt[1] != 0) {
+4 -1
net/netfilter/nf_conntrack_irc.c
··· 143 143 spin_lock_bh(&irc_buffer_lock); 144 144 ib_ptr = skb_header_pointer(skb, dataoff, skb->len - dataoff, 145 145 irc_buffer); 146 - BUG_ON(ib_ptr == NULL); 146 + if (!ib_ptr) { 147 + spin_unlock_bh(&irc_buffer_lock); 148 + return NF_ACCEPT; 149 + } 147 150 148 151 data = ib_ptr; 149 152 data_limit = ib_ptr + skb->len - dataoff;
+3 -1
net/netfilter/nf_conntrack_pptp.c
··· 544 544 545 545 nexthdr_off = protoff; 546 546 tcph = skb_header_pointer(skb, nexthdr_off, sizeof(_tcph), &_tcph); 547 - BUG_ON(!tcph); 547 + if (!tcph) 548 + return NF_ACCEPT; 549 + 548 550 nexthdr_off += tcph->doff * 4; 549 551 datalen = tcplen - tcph->doff * 4; 550 552
+4 -2
net/netfilter/nf_conntrack_proto_tcp.c
··· 338 338 339 339 ptr = skb_header_pointer(skb, dataoff + sizeof(struct tcphdr), 340 340 length, buff); 341 - BUG_ON(ptr == NULL); 341 + if (!ptr) 342 + return; 342 343 343 344 state->td_scale = 344 345 state->flags = 0; ··· 395 394 396 395 ptr = skb_header_pointer(skb, dataoff + sizeof(struct tcphdr), 397 396 length, buff); 398 - BUG_ON(ptr == NULL); 397 + if (!ptr) 398 + return; 399 399 400 400 /* Fast path for timestamp-only option */ 401 401 if (length == TCPOLEN_TSTAMP_ALIGNED
+4 -1
net/netfilter/nf_conntrack_sane.c
··· 95 95 96 96 spin_lock_bh(&nf_sane_lock); 97 97 sb_ptr = skb_header_pointer(skb, dataoff, datalen, sane_buffer); 98 - BUG_ON(sb_ptr == NULL); 98 + if (!sb_ptr) { 99 + spin_unlock_bh(&nf_sane_lock); 100 + return NF_ACCEPT; 101 + } 99 102 100 103 if (dir == IP_CT_DIR_ORIGINAL) { 101 104 if (datalen != sizeof(struct sane_request))
+7 -4
net/netfilter/nf_tables_api.c
··· 4184 4184 unsigned char *udata; 4185 4185 struct nft_set *set; 4186 4186 struct nft_ctx ctx; 4187 + size_t alloc_size; 4187 4188 u64 timeout; 4188 4189 char *name; 4189 4190 int err, i; ··· 4330 4329 size = 0; 4331 4330 if (ops->privsize != NULL) 4332 4331 size = ops->privsize(nla, &desc); 4333 - 4334 - set = kvzalloc(sizeof(*set) + size + udlen, GFP_KERNEL); 4332 + alloc_size = sizeof(*set) + size + udlen; 4333 + if (alloc_size < size) 4334 + return -ENOMEM; 4335 + set = kvzalloc(alloc_size, GFP_KERNEL); 4335 4336 if (!set) 4336 4337 return -ENOMEM; 4337 4338 ··· 6618 6615 INIT_LIST_HEAD(&obj->list); 6619 6616 return err; 6620 6617 err_trans: 6621 - kfree(obj->key.name); 6622 - err_userdata: 6623 6618 kfree(obj->udata); 6619 + err_userdata: 6620 + kfree(obj->key.name); 6624 6621 err_strdup: 6625 6622 if (obj->ops->destroy) 6626 6623 obj->ops->destroy(&ctx, obj);
+1
net/netfilter/nfnetlink.c
··· 295 295 nfnl_unlock(subsys_id); 296 296 break; 297 297 default: 298 + rcu_read_unlock(); 298 299 err = -EINVAL; 299 300 break; 300 301 }
+14 -6
net/netfilter/nft_set_hash.c
··· 412 412 (void *)set); 413 413 } 414 414 415 + /* Number of buckets is stored in u32, so cap our result to 1U<<31 */ 416 + #define NFT_MAX_BUCKETS (1U << 31) 417 + 415 418 static u32 nft_hash_buckets(u32 size) 416 419 { 417 - return roundup_pow_of_two(size * 4 / 3); 420 + u64 val = div_u64((u64)size * 4, 3); 421 + 422 + if (val >= NFT_MAX_BUCKETS) 423 + return NFT_MAX_BUCKETS; 424 + 425 + return roundup_pow_of_two(val); 418 426 } 419 427 420 428 static bool nft_rhash_estimate(const struct nft_set_desc *desc, u32 features, ··· 623 615 const struct nft_set_desc *desc) 624 616 { 625 617 return sizeof(struct nft_hash) + 626 - nft_hash_buckets(desc->size) * sizeof(struct hlist_head); 618 + (u64)nft_hash_buckets(desc->size) * sizeof(struct hlist_head); 627 619 } 628 620 629 621 static int nft_hash_init(const struct nft_set *set, ··· 663 655 return false; 664 656 665 657 est->size = sizeof(struct nft_hash) + 666 - nft_hash_buckets(desc->size) * sizeof(struct hlist_head) + 667 - desc->size * sizeof(struct nft_hash_elem); 658 + (u64)nft_hash_buckets(desc->size) * sizeof(struct hlist_head) + 659 + (u64)desc->size * sizeof(struct nft_hash_elem); 668 660 est->lookup = NFT_SET_CLASS_O_1; 669 661 est->space = NFT_SET_CLASS_O_N; 670 662 ··· 681 673 return false; 682 674 683 675 est->size = sizeof(struct nft_hash) + 684 - nft_hash_buckets(desc->size) * sizeof(struct hlist_head) + 685 - desc->size * sizeof(struct nft_hash_elem); 676 + (u64)nft_hash_buckets(desc->size) * sizeof(struct hlist_head) + 677 + (u64)desc->size * sizeof(struct nft_hash_elem); 686 678 est->lookup = NFT_SET_CLASS_O_1; 687 679 est->space = NFT_SET_CLASS_O_N; 688 680
+69 -19
net/netfilter/xt_SECMARK.c
··· 24 24 static u8 mode; 25 25 26 26 static unsigned int 27 - secmark_tg(struct sk_buff *skb, const struct xt_action_param *par) 27 + secmark_tg(struct sk_buff *skb, const struct xt_secmark_target_info_v1 *info) 28 28 { 29 29 u32 secmark = 0; 30 - const struct xt_secmark_target_info *info = par->targinfo; 31 30 32 31 switch (mode) { 33 32 case SECMARK_MODE_SEL: ··· 40 41 return XT_CONTINUE; 41 42 } 42 43 43 - static int checkentry_lsm(struct xt_secmark_target_info *info) 44 + static int checkentry_lsm(struct xt_secmark_target_info_v1 *info) 44 45 { 45 46 int err; 46 47 ··· 72 73 return 0; 73 74 } 74 75 75 - static int secmark_tg_check(const struct xt_tgchk_param *par) 76 + static int 77 + secmark_tg_check(const char *table, struct xt_secmark_target_info_v1 *info) 76 78 { 77 - struct xt_secmark_target_info *info = par->targinfo; 78 79 int err; 79 80 80 - if (strcmp(par->table, "mangle") != 0 && 81 - strcmp(par->table, "security") != 0) { 81 + if (strcmp(table, "mangle") != 0 && 82 + strcmp(table, "security") != 0) { 82 83 pr_info_ratelimited("only valid in \'mangle\' or \'security\' table, not \'%s\'\n", 83 - par->table); 84 + table); 84 85 return -EINVAL; 85 86 } 86 87 ··· 115 116 } 116 117 } 117 118 118 - static struct xt_target secmark_tg_reg __read_mostly = { 119 - .name = "SECMARK", 120 - .revision = 0, 121 - .family = NFPROTO_UNSPEC, 122 - .checkentry = secmark_tg_check, 123 - .destroy = secmark_tg_destroy, 124 - .target = secmark_tg, 125 - .targetsize = sizeof(struct xt_secmark_target_info), 126 - .me = THIS_MODULE, 119 + static int secmark_tg_check_v0(const struct xt_tgchk_param *par) 120 + { 121 + struct xt_secmark_target_info *info = par->targinfo; 122 + struct xt_secmark_target_info_v1 newinfo = { 123 + .mode = info->mode, 124 + }; 125 + int ret; 126 + 127 + memcpy(newinfo.secctx, info->secctx, SECMARK_SECCTX_MAX); 128 + 129 + ret = secmark_tg_check(par->table, &newinfo); 130 + info->secid = newinfo.secid; 131 + 132 + return ret; 133 + } 134 + 135 + static unsigned int 136 + secmark_tg_v0(struct sk_buff *skb, const struct xt_action_param *par) 137 + { 138 + const struct xt_secmark_target_info *info = par->targinfo; 139 + struct xt_secmark_target_info_v1 newinfo = { 140 + .secid = info->secid, 141 + }; 142 + 143 + return secmark_tg(skb, &newinfo); 144 + } 145 + 146 + static int secmark_tg_check_v1(const struct xt_tgchk_param *par) 147 + { 148 + return secmark_tg_check(par->table, par->targinfo); 149 + } 150 + 151 + static unsigned int 152 + secmark_tg_v1(struct sk_buff *skb, const struct xt_action_param *par) 153 + { 154 + return secmark_tg(skb, par->targinfo); 155 + } 156 + 157 + static struct xt_target secmark_tg_reg[] __read_mostly = { 158 + { 159 + .name = "SECMARK", 160 + .revision = 0, 161 + .family = NFPROTO_UNSPEC, 162 + .checkentry = secmark_tg_check_v0, 163 + .destroy = secmark_tg_destroy, 164 + .target = secmark_tg_v0, 165 + .targetsize = sizeof(struct xt_secmark_target_info), 166 + .me = THIS_MODULE, 167 + }, 168 + { 169 + .name = "SECMARK", 170 + .revision = 1, 171 + .family = NFPROTO_UNSPEC, 172 + .checkentry = secmark_tg_check_v1, 173 + .destroy = secmark_tg_destroy, 174 + .target = secmark_tg_v1, 175 + .targetsize = sizeof(struct xt_secmark_target_info_v1), 176 + .usersize = offsetof(struct xt_secmark_target_info_v1, secid), 177 + .me = THIS_MODULE, 178 + }, 127 179 }; 128 180 129 181 static int __init secmark_tg_init(void) 130 182 { 131 - return xt_register_target(&secmark_tg_reg); 183 + return xt_register_targets(secmark_tg_reg, ARRAY_SIZE(secmark_tg_reg)); 132 184 } 133 185 134 186 static void __exit secmark_tg_exit(void) 135 187 { 136 - xt_unregister_target(&secmark_tg_reg); 188 + xt_unregister_targets(secmark_tg_reg, ARRAY_SIZE(secmark_tg_reg)); 137 189 } 138 190 139 191 module_init(secmark_tg_init);
+4
net/nfc/llcp_sock.c
··· 109 109 GFP_KERNEL); 110 110 if (!llcp_sock->service_name) { 111 111 nfc_llcp_local_put(llcp_sock->local); 112 + llcp_sock->local = NULL; 112 113 ret = -ENOMEM; 113 114 goto put_dev; 114 115 } 115 116 llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); 116 117 if (llcp_sock->ssap == LLCP_SAP_MAX) { 117 118 nfc_llcp_local_put(llcp_sock->local); 119 + llcp_sock->local = NULL; 118 120 kfree(llcp_sock->service_name); 119 121 llcp_sock->service_name = NULL; 120 122 ret = -EADDRINUSE; ··· 711 709 llcp_sock->ssap = nfc_llcp_get_local_ssap(local); 712 710 if (llcp_sock->ssap == LLCP_SAP_MAX) { 713 711 nfc_llcp_local_put(llcp_sock->local); 712 + llcp_sock->local = NULL; 714 713 ret = -ENOMEM; 715 714 goto put_dev; 716 715 } ··· 759 756 sock_llcp_release: 760 757 nfc_llcp_put_ssap(local, llcp_sock->ssap); 761 758 nfc_llcp_local_put(llcp_sock->local); 759 + llcp_sock->local = NULL; 762 760 763 761 put_dev: 764 762 nfc_put_device(dev);
+4 -4
net/openvswitch/actions.c
··· 827 827 } 828 828 829 829 if (key->eth.type == htons(ETH_P_IP)) { 830 - struct dst_entry ovs_dst; 830 + struct rtable ovs_rt = { 0 }; 831 831 unsigned long orig_dst; 832 832 833 833 prepare_frag(vport, skb, orig_network_offset, 834 834 ovs_key_mac_proto(key)); 835 - dst_init(&ovs_dst, &ovs_dst_ops, NULL, 1, 835 + dst_init(&ovs_rt.dst, &ovs_dst_ops, NULL, 1, 836 836 DST_OBSOLETE_NONE, DST_NOCOUNT); 837 - ovs_dst.dev = vport->dev; 837 + ovs_rt.dst.dev = vport->dev; 838 838 839 839 orig_dst = skb->_skb_refdst; 840 - skb_dst_set_noref(skb, &ovs_dst); 840 + skb_dst_set_noref(skb, &ovs_rt.dst); 841 841 IPCB(skb)->frag_max_size = mru; 842 842 843 843 ip_do_fragment(net, skb->sk, skb, ovs_vport_output);
+4 -4
net/sched/sch_frag.c
··· 90 90 } 91 91 92 92 if (skb_protocol(skb, true) == htons(ETH_P_IP)) { 93 - struct dst_entry sch_frag_dst; 93 + struct rtable sch_frag_rt = { 0 }; 94 94 unsigned long orig_dst; 95 95 96 96 sch_frag_prepare_frag(skb, xmit); 97 - dst_init(&sch_frag_dst, &sch_frag_dst_ops, NULL, 1, 97 + dst_init(&sch_frag_rt.dst, &sch_frag_dst_ops, NULL, 1, 98 98 DST_OBSOLETE_NONE, DST_NOCOUNT); 99 - sch_frag_dst.dev = skb->dev; 99 + sch_frag_rt.dst.dev = skb->dev; 100 100 101 101 orig_dst = skb->_skb_refdst; 102 - skb_dst_set_noref(skb, &sch_frag_dst); 102 + skb_dst_set_noref(skb, &sch_frag_rt.dst); 103 103 IPCB(skb)->frag_max_size = mru; 104 104 105 105 ret = ip_do_fragment(net, skb->sk, skb, sch_frag_xmit);
+1 -5
net/sctp/sm_make_chunk.c
··· 858 858 struct sctp_chunk *retval; 859 859 __u32 ctsn; 860 860 861 - if (chunk && chunk->asoc) 862 - ctsn = sctp_tsnmap_get_ctsn(&chunk->asoc->peer.tsn_map); 863 - else 864 - ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); 865 - 861 + ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); 866 862 shut.cum_tsn_ack = htonl(ctsn); 867 863 868 864 retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0,
-26
net/sctp/sm_sideeffect.c
··· 826 826 asoc->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] = t->rto; 827 827 } 828 828 829 - static void sctp_cmd_assoc_update(struct sctp_cmd_seq *cmds, 830 - struct sctp_association *asoc, 831 - struct sctp_association *new) 832 - { 833 - struct net *net = asoc->base.net; 834 - struct sctp_chunk *abort; 835 - 836 - if (!sctp_assoc_update(asoc, new)) 837 - return; 838 - 839 - abort = sctp_make_abort(asoc, NULL, sizeof(struct sctp_errhdr)); 840 - if (abort) { 841 - sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); 842 - sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 843 - } 844 - sctp_add_cmd_sf(cmds, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); 845 - sctp_add_cmd_sf(cmds, SCTP_CMD_ASSOC_FAILED, 846 - SCTP_PERR(SCTP_ERROR_RSRC_LOW)); 847 - SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); 848 - SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB); 849 - } 850 - 851 829 /* Helper function to change the state of an association. */ 852 830 static void sctp_cmd_new_state(struct sctp_cmd_seq *cmds, 853 831 struct sctp_association *asoc, ··· 1278 1300 BUG_ON(asoc->peer.primary_path == NULL); 1279 1301 sctp_endpoint_add_asoc(ep, asoc); 1280 1302 break; 1281 - 1282 - case SCTP_CMD_UPDATE_ASSOC: 1283 - sctp_cmd_assoc_update(commands, asoc, cmd->obj.asoc); 1284 - break; 1285 1303 1286 1304 case SCTP_CMD_PURGE_OUTQUEUE: 1287 1305 sctp_outq_teardown(&asoc->outqueue);
+38 -9
net/sctp/sm_statefuns.c
··· 1773 1773 return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands); 1774 1774 } 1775 1775 1776 + static int sctp_sf_do_assoc_update(struct sctp_association *asoc, 1777 + struct sctp_association *new, 1778 + struct sctp_cmd_seq *cmds) 1779 + { 1780 + struct net *net = asoc->base.net; 1781 + struct sctp_chunk *abort; 1782 + 1783 + if (!sctp_assoc_update(asoc, new)) 1784 + return 0; 1785 + 1786 + abort = sctp_make_abort(asoc, NULL, sizeof(struct sctp_errhdr)); 1787 + if (abort) { 1788 + sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); 1789 + sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 1790 + } 1791 + sctp_add_cmd_sf(cmds, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNABORTED)); 1792 + sctp_add_cmd_sf(cmds, SCTP_CMD_ASSOC_FAILED, 1793 + SCTP_PERR(SCTP_ERROR_RSRC_LOW)); 1794 + SCTP_INC_STATS(net, SCTP_MIB_ABORTEDS); 1795 + SCTP_DEC_STATS(net, SCTP_MIB_CURRESTAB); 1796 + 1797 + return -ENOMEM; 1798 + } 1799 + 1776 1800 /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') 1777 1801 * 1778 1802 * Section 5.2.4 ··· 1876 1852 SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); 1877 1853 sctp_add_cmd_sf(commands, SCTP_CMD_PURGE_ASCONF_QUEUE, SCTP_NULL()); 1878 1854 1879 - repl = sctp_make_cookie_ack(new_asoc, chunk); 1855 + /* Update the content of current association. */ 1856 + if (sctp_sf_do_assoc_update((struct sctp_association *)asoc, new_asoc, commands)) 1857 + goto nomem; 1858 + 1859 + repl = sctp_make_cookie_ack(asoc, chunk); 1880 1860 if (!repl) 1881 1861 goto nomem; 1882 1862 1883 1863 /* Report association restart to upper layer. */ 1884 1864 ev = sctp_ulpevent_make_assoc_change(asoc, 0, SCTP_RESTART, 0, 1885 - new_asoc->c.sinit_num_ostreams, 1886 - new_asoc->c.sinit_max_instreams, 1865 + asoc->c.sinit_num_ostreams, 1866 + asoc->c.sinit_max_instreams, 1887 1867 NULL, GFP_ATOMIC); 1888 1868 if (!ev) 1889 1869 goto nomem_ev; 1890 1870 1891 - /* Update the content of current association. */ 1892 - sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); 1893 1871 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); 1894 1872 if ((sctp_state(asoc, SHUTDOWN_PENDING) || 1895 1873 sctp_state(asoc, SHUTDOWN_SENT)) && ··· 1951 1925 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) 1952 1926 return SCTP_DISPOSITION_DISCARD; 1953 1927 1954 - /* Update the content of current association. */ 1955 - sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); 1956 1928 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 1957 1929 SCTP_STATE(SCTP_STATE_ESTABLISHED)); 1958 - SCTP_INC_STATS(net, SCTP_MIB_CURRESTAB); 1930 + if (asoc->state < SCTP_STATE_ESTABLISHED) 1931 + SCTP_INC_STATS(net, SCTP_MIB_CURRESTAB); 1959 1932 sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL()); 1960 1933 1961 - repl = sctp_make_cookie_ack(new_asoc, chunk); 1934 + /* Update the content of current association. */ 1935 + if (sctp_sf_do_assoc_update((struct sctp_association *)asoc, new_asoc, commands)) 1936 + goto nomem; 1937 + 1938 + repl = sctp_make_cookie_ack(asoc, chunk); 1962 1939 if (!repl) 1963 1940 goto nomem; 1964 1941
+22 -16
net/sctp/socket.c
··· 357 357 return af; 358 358 } 359 359 360 + static void sctp_auto_asconf_init(struct sctp_sock *sp) 361 + { 362 + struct net *net = sock_net(&sp->inet.sk); 363 + 364 + if (net->sctp.default_auto_asconf) { 365 + spin_lock(&net->sctp.addr_wq_lock); 366 + list_add_tail(&sp->auto_asconf_list, &net->sctp.auto_asconf_splist); 367 + spin_unlock(&net->sctp.addr_wq_lock); 368 + sp->do_auto_asconf = 1; 369 + } 370 + } 371 + 360 372 /* Bind a local address either to an endpoint or to an association. */ 361 373 static int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len) 362 374 { ··· 430 418 return -EADDRINUSE; 431 419 432 420 /* Refresh ephemeral port. */ 433 - if (!bp->port) 421 + if (!bp->port) { 434 422 bp->port = inet_sk(sk)->inet_num; 423 + sctp_auto_asconf_init(sp); 424 + } 435 425 436 426 /* Add the address to the bind address list. 437 427 * Use GFP_ATOMIC since BHs will be disabled. ··· 1534 1520 1535 1521 /* Supposedly, no process has access to the socket, but 1536 1522 * the net layers still may. 1523 + * Also, sctp_destroy_sock() needs to be called with addr_wq_lock 1524 + * held and that should be grabbed before socket lock. 1537 1525 */ 1538 - local_bh_disable(); 1539 - bh_lock_sock(sk); 1526 + spin_lock_bh(&net->sctp.addr_wq_lock); 1527 + bh_lock_sock_nested(sk); 1540 1528 1541 1529 /* Hold the sock, since sk_common_release() will put sock_put() 1542 1530 * and we have just a little more cleanup. ··· 1547 1531 sk_common_release(sk); 1548 1532 1549 1533 bh_unlock_sock(sk); 1550 - local_bh_enable(); 1534 + spin_unlock_bh(&net->sctp.addr_wq_lock); 1551 1535 1552 1536 sock_put(sk); 1553 1537 ··· 5007 4991 sk_sockets_allocated_inc(sk); 5008 4992 sock_prot_inuse_add(net, sk->sk_prot, 1); 5009 4993 5010 - if (net->sctp.default_auto_asconf) { 5011 - spin_lock(&sock_net(sk)->sctp.addr_wq_lock); 5012 - list_add_tail(&sp->auto_asconf_list, 5013 - &net->sctp.auto_asconf_splist); 5014 - sp->do_auto_asconf = 1; 5015 - spin_unlock(&sock_net(sk)->sctp.addr_wq_lock); 5016 - } else { 5017 - sp->do_auto_asconf = 0; 5018 - } 5019 - 5020 4994 local_bh_enable(); 5021 4995 5022 4996 return 0; ··· 5031 5025 5032 5026 if (sp->do_auto_asconf) { 5033 5027 sp->do_auto_asconf = 0; 5034 - spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock); 5035 5028 list_del(&sp->auto_asconf_list); 5036 - spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock); 5037 5029 } 5038 5030 sctp_endpoint_free(sp->ep); 5039 5031 local_bh_disable(); ··· 9401 9397 if (err) 9402 9398 return err; 9403 9399 } 9400 + 9401 + sctp_auto_asconf_init(newsp); 9404 9402 9405 9403 /* Move any messages in the old socket's receive queue that are for the 9406 9404 * peeled off association to the new socket's receive queue.
+3 -1
net/smc/af_smc.c
··· 2161 2161 struct smc_sock *smc; 2162 2162 int val, rc; 2163 2163 2164 + if (level == SOL_TCP && optname == TCP_ULP) 2165 + return -EOPNOTSUPP; 2166 + 2164 2167 smc = smc_sk(sk); 2165 2168 2166 2169 /* generic setsockopts reaching us here always apply to the ··· 2188 2185 if (rc || smc->use_fallback) 2189 2186 goto out; 2190 2187 switch (optname) { 2191 - case TCP_ULP: 2192 2188 case TCP_FASTOPEN: 2193 2189 case TCP_FASTOPEN_CONNECT: 2194 2190 case TCP_FASTOPEN_KEY:
-2
net/vmw_vsock/vmci_transport.c
··· 944 944 bool old_request = false; 945 945 bool old_pkt_proto = false; 946 946 947 - err = 0; 948 - 949 947 /* Because we are in the listen state, we could be receiving a packet 950 948 * for ourself or any previous connection requests that we received. 951 949 * If it's the latter, we try to find a socket in our list of pending
+3 -4
net/xdp/xsk_queue.h
··· 128 128 static inline bool xp_aligned_validate_desc(struct xsk_buff_pool *pool, 129 129 struct xdp_desc *desc) 130 130 { 131 - u64 chunk, chunk_end; 131 + u64 chunk; 132 132 133 - chunk = xp_aligned_extract_addr(pool, desc->addr); 134 - chunk_end = xp_aligned_extract_addr(pool, desc->addr + desc->len); 135 - if (chunk != chunk_end) 133 + if (desc->len > pool->chunk_size) 136 134 return false; 137 135 136 + chunk = xp_aligned_extract_addr(pool, desc->addr); 138 137 if (chunk >= pool->addrs_cnt) 139 138 return false; 140 139
+21 -9
tools/lib/bpf/ringbuf.c
··· 202 202 return (len + 7) / 8 * 8; 203 203 } 204 204 205 - static int ringbuf_process_ring(struct ring* r) 205 + static int64_t ringbuf_process_ring(struct ring* r) 206 206 { 207 - int *len_ptr, len, err, cnt = 0; 207 + int *len_ptr, len, err; 208 + /* 64-bit to avoid overflow in case of extreme application behavior */ 209 + int64_t cnt = 0; 208 210 unsigned long cons_pos, prod_pos; 209 211 bool got_new_data; 210 212 void *sample; ··· 246 244 } 247 245 248 246 /* Consume available ring buffer(s) data without event polling. 249 - * Returns number of records consumed across all registered ring buffers, or 250 - * negative number if any of the callbacks return error. 247 + * Returns number of records consumed across all registered ring buffers (or 248 + * INT_MAX, whichever is less), or negative number if any of the callbacks 249 + * return error. 251 250 */ 252 251 int ring_buffer__consume(struct ring_buffer *rb) 253 252 { 254 - int i, err, res = 0; 253 + int64_t err, res = 0; 254 + int i; 255 255 256 256 for (i = 0; i < rb->ring_cnt; i++) { 257 257 struct ring *ring = &rb->rings[i]; ··· 263 259 return err; 264 260 res += err; 265 261 } 262 + if (res > INT_MAX) 263 + return INT_MAX; 266 264 return res; 267 265 } 268 266 269 267 /* Poll for available data and consume records, if any are available. 270 - * Returns number of records consumed, or negative number, if any of the 271 - * registered callbacks returned error. 268 + * Returns number of records consumed (or INT_MAX, whichever is less), or 269 + * negative number, if any of the registered callbacks returned error. 272 270 */ 273 271 int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms) 274 272 { 275 - int i, cnt, err, res = 0; 273 + int i, cnt; 274 + int64_t err, res = 0; 276 275 277 276 cnt = epoll_wait(rb->epoll_fd, rb->events, rb->ring_cnt, timeout_ms); 277 + if (cnt < 0) 278 + return -errno; 279 + 278 280 for (i = 0; i < cnt; i++) { 279 281 __u32 ring_id = rb->events[i].data.fd; 280 282 struct ring *ring = &rb->rings[ring_id]; ··· 290 280 return err; 291 281 res += err; 292 282 } 293 - return cnt < 0 ? -errno : res; 283 + if (res > INT_MAX) 284 + return INT_MAX; 285 + return res; 294 286 } 295 287 296 288 /* Get an fd that can be used to sleep until data is available in the ring(s) */
+2
tools/testing/selftests/bpf/prog_tests/snprintf.c
··· 43 43 if (!ASSERT_OK_PTR(skel, "skel_open")) 44 44 return; 45 45 46 + skel->bss->pid = getpid(); 47 + 46 48 if (!ASSERT_OK(test_snprintf__attach(skel), "skel_attach")) 47 49 goto cleanup; 48 50
+5
tools/testing/selftests/bpf/progs/test_snprintf.c
··· 5 5 #include <bpf/bpf_helpers.h> 6 6 #include <bpf/bpf_tracing.h> 7 7 8 + __u32 pid = 0; 9 + 8 10 char num_out[64] = {}; 9 11 long num_ret = 0; 10 12 ··· 43 41 const __u8 ex_ipv6[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; 44 42 static const char str1[] = "str1"; 45 43 static const char longstr[] = "longstr"; 44 + 45 + if ((int)bpf_get_current_pid_tgid() != pid) 46 + return 0; 46 47 47 48 /* Integer types */ 48 49 num_ret = BPF_SNPRINTF(num_out, sizeof(num_out),