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) Encap offset calculation is incorrect in esp6, from Sabrina Dubroca.

2) Better parameter validation in pfkey_dump(), from Mark Salyzyn.

3) Fix several clang issues on powerpc in selftests, from Tanner Love.

4) cmsghdr_from_user_compat_to_kern() uses the wrong length, from Al
Viro.

5) Out of bounds access in mlx5e driver, from Raed Salem.

6) Fix transfer buffer memleak in lan78xx, from Johan Havold.

7) RCU fixups in rhashtable, from Herbert Xu.

8) Fix ipv6 nexthop refcnt leak, from Xiyu Yang.

9) vxlan FDB dump must be done under RCU, from Ido Schimmel.

10) Fix use after free in mlxsw, from Ido Schimmel.

11) Fix map leak in HASH_OF_MAPS bpf code, from Andrii Nakryiko.

12) Fix bug in mac80211 Tx ack status reporting, from Vasanthakumar
Thiagarajan.

13) Fix memory leaks in IPV6_ADDRFORM code, from Cong Wang.

14) Fix bpf program reference count leaks in mlx5 during
mlx5e_alloc_rq(), from Xin Xiong.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (86 commits)
vxlan: fix memleak of fdb
rds: Prevent kernel-infoleak in rds_notify_queue_get()
net/sched: The error lable position is corrected in ct_init_module
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq
net/mlx5e: E-Switch, Specify flow_source for rule with no in_port
net/mlx5e: E-Switch, Add misc bit when misc fields changed for mirroring
net/mlx5e: CT: Support restore ipv6 tunnel
net: gemini: Fix missing clk_disable_unprepare() in error path of gemini_ethernet_port_probe()
ionic: unlock queue mutex in error path
atm: fix atm_dev refcnt leaks in atmtcp_remove_persistent
net: ethernet: mtk_eth_soc: fix MTU warnings
net: nixge: fix potential memory leak in nixge_probe()
devlink: ignore -EOPNOTSUPP errors on dumpit
rxrpc: Fix race between recvmsg and sendmsg on immediate call failure
MAINTAINERS: Replace Thor Thayer as Altera Triple Speed Ethernet maintainer
selftests/bpf: fix netdevsim trap_flow_action_cookie read
ipv6: fix memory leaks on IPV6_ADDRFORM path
net/bpfilter: Initialize pos in __bpfilter_process_sockopt
igb: reinit_locked() should be called with rtnl_lock
e1000e: continue to init PHY even when failed to disable ULP
...

+783 -452
+2 -3
Documentation/networking/bareudp.rst
··· 8 8 leverage the UDP based load balancing capability of different networks. 9 9 MPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them. 10 10 11 - The Bareudp tunnel module provides a generic L3 encapsulation tunnelling 12 - support for tunnelling different L3 protocols like MPLS, IP, NSH etc. inside 13 - a UDP tunnel. 11 + The Bareudp tunnel module provides a generic L3 encapsulation support for 12 + tunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel. 14 13 15 14 Special Handling 16 15 ----------------
+1 -1
MAINTAINERS
··· 782 782 F: include/linux/mfd/altera-a10sr.h 783 783 784 784 ALTERA TRIPLE SPEED ETHERNET DRIVER 785 - M: Thor Thayer <thor.thayer@linux.intel.com> 785 + M: Joyce Ooi <joyce.ooi@intel.com> 786 786 L: netdev@vger.kernel.org 787 787 S: Maintained 788 788 F: drivers/net/ethernet/altera/
+8 -2
drivers/atm/atmtcp.c
··· 433 433 return -EMEDIUMTYPE; 434 434 } 435 435 dev_data = PRIV(dev); 436 - if (!dev_data->persist) return 0; 436 + if (!dev_data->persist) { 437 + atm_dev_put(dev); 438 + return 0; 439 + } 437 440 dev_data->persist = 0; 438 - if (PRIV(dev)->vcc) return 0; 441 + if (PRIV(dev)->vcc) { 442 + atm_dev_put(dev); 443 + return 0; 444 + } 439 445 kfree(dev_data); 440 446 atm_dev_put(dev); 441 447 atm_dev_deregister(dev);
+22 -7
drivers/net/bareudp.c
··· 407 407 return err; 408 408 } 409 409 410 + static bool bareudp_proto_valid(struct bareudp_dev *bareudp, __be16 proto) 411 + { 412 + if (bareudp->ethertype == proto) 413 + return true; 414 + 415 + if (!bareudp->multi_proto_mode) 416 + return false; 417 + 418 + if (bareudp->ethertype == htons(ETH_P_MPLS_UC) && 419 + proto == htons(ETH_P_MPLS_MC)) 420 + return true; 421 + 422 + if (bareudp->ethertype == htons(ETH_P_IP) && 423 + proto == htons(ETH_P_IPV6)) 424 + return true; 425 + 426 + return false; 427 + } 428 + 410 429 static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) 411 430 { 412 431 struct bareudp_dev *bareudp = netdev_priv(dev); 413 432 struct ip_tunnel_info *info = NULL; 414 433 int err; 415 434 416 - if (skb->protocol != bareudp->ethertype) { 417 - if (!bareudp->multi_proto_mode || 418 - (skb->protocol != htons(ETH_P_MPLS_MC) && 419 - skb->protocol != htons(ETH_P_IPV6))) { 420 - err = -EINVAL; 421 - goto tx_error; 422 - } 435 + if (!bareudp_proto_valid(bareudp, skb->protocol)) { 436 + err = -EINVAL; 437 + goto tx_error; 423 438 } 424 439 425 440 info = skb_tunnel_info(skb);
+4 -1
drivers/net/ethernet/cortina/gemini.c
··· 2446 2446 port->reset = devm_reset_control_get_exclusive(dev, NULL); 2447 2447 if (IS_ERR(port->reset)) { 2448 2448 dev_err(dev, "no reset\n"); 2449 + clk_disable_unprepare(port->pclk); 2449 2450 return PTR_ERR(port->reset); 2450 2451 } 2451 2452 reset_control_reset(port->reset); ··· 2502 2501 IRQF_SHARED, 2503 2502 port_names[port->id], 2504 2503 port); 2505 - if (ret) 2504 + if (ret) { 2505 + clk_disable_unprepare(port->pclk); 2506 2506 return ret; 2507 + } 2507 2508 2508 2509 ret = register_netdev(netdev); 2509 2510 if (!ret) {
+7 -11
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 1093 1093 int k, sizeoflast; 1094 1094 dma_addr_t dma; 1095 1095 1096 - if (type == DESC_TYPE_SKB) { 1097 - struct sk_buff *skb = (struct sk_buff *)priv; 1098 - int ret; 1099 - 1100 - ret = hns3_fill_skb_desc(ring, skb, desc); 1101 - if (unlikely(ret < 0)) 1102 - return ret; 1103 - 1104 - dma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE); 1105 - } else if (type == DESC_TYPE_FRAGLIST_SKB) { 1096 + if (type == DESC_TYPE_FRAGLIST_SKB || 1097 + type == DESC_TYPE_SKB) { 1106 1098 struct sk_buff *skb = (struct sk_buff *)priv; 1107 1099 1108 1100 dma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE); ··· 1430 1438 } 1431 1439 1432 1440 next_to_use_head = ring->next_to_use; 1441 + 1442 + ret = hns3_fill_skb_desc(ring, skb, &ring->desc[ring->next_to_use]); 1443 + if (unlikely(ret < 0)) 1444 + goto fill_err; 1433 1445 1434 1446 ret = hns3_fill_skb_to_desc(ring, skb, DESC_TYPE_SKB); 1435 1447 if (unlikely(ret < 0)) ··· 4136 4140 return; 4137 4141 4138 4142 if (linkup) { 4139 - netif_carrier_on(netdev); 4140 4143 netif_tx_wake_all_queues(netdev); 4144 + netif_carrier_on(netdev); 4141 4145 if (netif_msg_link(handle)) 4142 4146 netdev_info(netdev, "link up\n"); 4143 4147 } else {
+19 -16
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 5806 5806 /* to avoid rule conflict, when user configure rule by ethtool, 5807 5807 * we need to clear all arfs rules 5808 5808 */ 5809 + spin_lock_bh(&hdev->fd_rule_lock); 5809 5810 hclge_clear_arfs_rules(handle); 5810 5811 5811 - spin_lock_bh(&hdev->fd_rule_lock); 5812 5812 ret = hclge_fd_config_rule(hdev, rule); 5813 5813 5814 5814 spin_unlock_bh(&hdev->fd_rule_lock); ··· 5851 5851 return ret; 5852 5852 } 5853 5853 5854 + /* make sure being called after lock up with fd_rule_lock */ 5854 5855 static void hclge_del_all_fd_entries(struct hnae3_handle *handle, 5855 5856 bool clear_list) 5856 5857 { ··· 5864 5863 if (!hnae3_dev_fd_supported(hdev)) 5865 5864 return; 5866 5865 5867 - spin_lock_bh(&hdev->fd_rule_lock); 5868 5866 for_each_set_bit(location, hdev->fd_bmap, 5869 5867 hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) 5870 5868 hclge_fd_tcam_config(hdev, HCLGE_FD_STAGE_1, true, location, ··· 5880 5880 bitmap_zero(hdev->fd_bmap, 5881 5881 hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]); 5882 5882 } 5883 - 5884 - spin_unlock_bh(&hdev->fd_rule_lock); 5885 5883 } 5886 5884 5887 5885 static int hclge_restore_fd_entries(struct hnae3_handle *handle) ··· 6261 6263 u16 flow_id, struct flow_keys *fkeys) 6262 6264 { 6263 6265 struct hclge_vport *vport = hclge_get_vport(handle); 6264 - struct hclge_fd_rule_tuples new_tuples; 6266 + struct hclge_fd_rule_tuples new_tuples = {}; 6265 6267 struct hclge_dev *hdev = vport->back; 6266 6268 struct hclge_fd_rule *rule; 6267 6269 u16 tmp_queue_id; ··· 6271 6273 if (!hnae3_dev_fd_supported(hdev)) 6272 6274 return -EOPNOTSUPP; 6273 6275 6274 - memset(&new_tuples, 0, sizeof(new_tuples)); 6275 - hclge_fd_get_flow_tuples(fkeys, &new_tuples); 6276 - 6277 - spin_lock_bh(&hdev->fd_rule_lock); 6278 - 6279 6276 /* when there is already fd rule existed add by user, 6280 6277 * arfs should not work 6281 6278 */ 6279 + spin_lock_bh(&hdev->fd_rule_lock); 6282 6280 if (hdev->fd_active_type == HCLGE_FD_EP_ACTIVE) { 6283 6281 spin_unlock_bh(&hdev->fd_rule_lock); 6284 6282 return -EOPNOTSUPP; 6285 6283 } 6284 + 6285 + hclge_fd_get_flow_tuples(fkeys, &new_tuples); 6286 6286 6287 6287 /* check is there flow director filter existed for this flow, 6288 6288 * if not, create a new filter for it; ··· 6364 6368 #endif 6365 6369 } 6366 6370 6371 + /* make sure being called after lock up with fd_rule_lock */ 6367 6372 static void hclge_clear_arfs_rules(struct hnae3_handle *handle) 6368 6373 { 6369 6374 #ifdef CONFIG_RFS_ACCEL ··· 6417 6420 6418 6421 hdev->fd_en = enable; 6419 6422 clear = hdev->fd_active_type == HCLGE_FD_ARFS_ACTIVE; 6420 - if (!enable) 6423 + 6424 + if (!enable) { 6425 + spin_lock_bh(&hdev->fd_rule_lock); 6421 6426 hclge_del_all_fd_entries(handle, clear); 6422 - else 6427 + spin_unlock_bh(&hdev->fd_rule_lock); 6428 + } else { 6423 6429 hclge_restore_fd_entries(handle); 6430 + } 6424 6431 } 6425 6432 6426 6433 static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable) ··· 6887 6886 int i; 6888 6887 6889 6888 set_bit(HCLGE_STATE_DOWN, &hdev->state); 6890 - 6889 + spin_lock_bh(&hdev->fd_rule_lock); 6891 6890 hclge_clear_arfs_rules(handle); 6891 + spin_unlock_bh(&hdev->fd_rule_lock); 6892 6892 6893 6893 /* If it is not PF reset, the firmware will disable the MAC, 6894 6894 * so it only need to stop phy here. ··· 9042 9040 bool writen_to_tbl = false; 9043 9041 int ret = 0; 9044 9042 9045 - /* When device is resetting, firmware is unable to handle 9046 - * mailbox. Just record the vlan id, and remove it after 9043 + /* When device is resetting or reset failed, firmware is unable to 9044 + * handle mailbox. Just record the vlan id, and remove it after 9047 9045 * reset finished. 9048 9046 */ 9049 - if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) && is_kill) { 9047 + if ((test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) || 9048 + test_bit(HCLGE_STATE_RST_FAIL, &hdev->state)) && is_kill) { 9050 9049 set_bit(vlan_id, vport->vlan_del_fail_bmap); 9051 9050 return -EBUSY; 9052 9051 }
+26 -12
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 1592 1592 if (proto != htons(ETH_P_8021Q)) 1593 1593 return -EPROTONOSUPPORT; 1594 1594 1595 - /* When device is resetting, firmware is unable to handle 1596 - * mailbox. Just record the vlan id, and remove it after 1595 + /* When device is resetting or reset failed, firmware is unable to 1596 + * handle mailbox. Just record the vlan id, and remove it after 1597 1597 * reset finished. 1598 1598 */ 1599 - if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) && is_kill) { 1599 + if ((test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) || 1600 + test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state)) && is_kill) { 1600 1601 set_bit(vlan_id, hdev->vlan_del_fail_bmap); 1601 1602 return -EBUSY; 1602 1603 } ··· 3440 3439 { 3441 3440 struct hnae3_handle *nic = &hdev->nic; 3442 3441 struct hclge_vf_to_pf_msg send_msg; 3442 + int ret; 3443 3443 3444 3444 rtnl_lock(); 3445 - hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT); 3446 - rtnl_unlock(); 3445 + 3446 + if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) || 3447 + test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state)) { 3448 + dev_warn(&hdev->pdev->dev, 3449 + "is resetting when updating port based vlan info\n"); 3450 + rtnl_unlock(); 3451 + return; 3452 + } 3453 + 3454 + ret = hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT); 3455 + if (ret) { 3456 + rtnl_unlock(); 3457 + return; 3458 + } 3447 3459 3448 3460 /* send msg to PF and wait update port based vlan info */ 3449 3461 hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN, 3450 3462 HCLGE_MBX_PORT_BASE_VLAN_CFG); 3451 3463 memcpy(send_msg.data, port_base_vlan_info, data_size); 3452 - hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0); 3464 + ret = hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0); 3465 + if (!ret) { 3466 + if (state == HNAE3_PORT_BASE_VLAN_DISABLE) 3467 + nic->port_base_vlan_state = state; 3468 + else 3469 + nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_ENABLE; 3470 + } 3453 3471 3454 - if (state == HNAE3_PORT_BASE_VLAN_DISABLE) 3455 - nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_DISABLE; 3456 - else 3457 - nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_ENABLE; 3458 - 3459 - rtnl_lock(); 3460 3472 hclgevf_notify_client(hdev, HNAE3_UP_CLIENT); 3461 3473 rtnl_unlock(); 3462 3474 }
+1 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 3206 3206 req_tx_irq_failed: 3207 3207 for (j = 0; j < i; j++) { 3208 3208 free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]); 3209 - irq_dispose_mapping(adapter->rx_scrq[j]->irq); 3209 + irq_dispose_mapping(adapter->tx_scrq[j]->irq); 3210 3210 } 3211 3211 release_sub_crqs(adapter, 1); 3212 3212 return rc;
+1 -3
drivers/net/ethernet/intel/e1000e/ich8lan.c
··· 301 301 */ 302 302 hw->dev_spec.ich8lan.ulp_state = e1000_ulp_state_unknown; 303 303 ret_val = e1000_disable_ulp_lpt_lp(hw, true); 304 - if (ret_val) { 304 + if (ret_val) 305 305 e_warn("Failed to disable ULP\n"); 306 - goto out; 307 - } 308 306 309 307 ret_val = hw->phy.ops.acquire(hw); 310 308 if (ret_val) {
+9
drivers/net/ethernet/intel/igb/igb_main.c
··· 6224 6224 struct igb_adapter *adapter; 6225 6225 adapter = container_of(work, struct igb_adapter, reset_task); 6226 6226 6227 + rtnl_lock(); 6228 + /* If we're already down or resetting, just bail */ 6229 + if (test_bit(__IGB_DOWN, &adapter->state) || 6230 + test_bit(__IGB_RESETTING, &adapter->state)) { 6231 + rtnl_unlock(); 6232 + return; 6233 + } 6234 + 6227 6235 igb_dump(adapter); 6228 6236 netdev_err(adapter->netdev, "Reset adapter\n"); 6229 6237 igb_reinit_locked(adapter); 6238 + rtnl_unlock(); 6230 6239 } 6231 6240 6232 6241 /**
+3
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
··· 1730 1730 if (!netif_running(pf->netdev)) 1731 1731 return; 1732 1732 1733 + rtnl_lock(); 1733 1734 otx2_stop(pf->netdev); 1734 1735 pf->reset_count++; 1735 1736 otx2_open(pf->netdev); 1736 1737 netif_trans_update(pf->netdev); 1738 + rtnl_unlock(); 1737 1739 } 1738 1740 1739 1741 static const struct net_device_ops otx2_netdev_ops = { ··· 2113 2111 2114 2112 pf = netdev_priv(netdev); 2115 2113 2114 + cancel_work_sync(&pf->reset_task); 2116 2115 /* Disable link notifications */ 2117 2116 otx2_cgx_config_linkevents(pf, false); 2118 2117
+2
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
··· 617 617 618 618 vf = netdev_priv(netdev); 619 619 620 + cancel_work_sync(&vf->reset_task); 621 + unregister_netdev(netdev); 620 622 otx2vf_disable_mbox_intr(vf); 621 623 622 624 otx2_detach_resources(&vf->mbox);
+16 -5
drivers/net/ethernet/mediatek/mtk_eth_soc.c
··· 171 171 return 0; 172 172 } 173 173 174 - static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, int speed) 174 + static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, 175 + phy_interface_t interface, int speed) 175 176 { 176 177 u32 val; 177 178 int ret; 179 + 180 + if (interface == PHY_INTERFACE_MODE_TRGMII) { 181 + mtk_w32(eth, TRGMII_MODE, INTF_MODE); 182 + val = 500000000; 183 + ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val); 184 + if (ret) 185 + dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret); 186 + return; 187 + } 178 188 179 189 val = (speed == SPEED_1000) ? 180 190 INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100; ··· 272 262 state->interface)) 273 263 goto err_phy; 274 264 } else { 275 - if (state->interface != 276 - PHY_INTERFACE_MODE_TRGMII) 277 - mtk_gmac0_rgmii_adjust(mac->hw, 278 - state->speed); 265 + mtk_gmac0_rgmii_adjust(mac->hw, 266 + state->interface, 267 + state->speed); 279 268 280 269 /* mt7623_pad_clk_setup */ 281 270 for (i = 0 ; i < NUM_TRGMII_CTRL; i++) ··· 2890 2881 2891 2882 eth->netdev[id]->irq = eth->irq[0]; 2892 2883 eth->netdev[id]->dev.of_node = np; 2884 + 2885 + eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH - MTK_RX_ETH_HLEN; 2893 2886 2894 2887 return 0; 2895 2888
+2
drivers/net/ethernet/mellanox/mlx4/main.c
··· 4356 4356 static void mlx4_shutdown(struct pci_dev *pdev) 4357 4357 { 4358 4358 struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev); 4359 + struct mlx4_dev *dev = persist->dev; 4359 4360 4360 4361 mlx4_info(persist->dev, "mlx4_shutdown was called\n"); 4361 4362 mutex_lock(&persist->interface_state_mutex); 4362 4363 if (persist->interface_state & MLX4_INTERFACE_STATE_UP) 4363 4364 mlx4_unload_one(pdev); 4364 4365 mutex_unlock(&persist->interface_state_mutex); 4366 + mlx4_pci_disable_device(dev); 4365 4367 } 4366 4368 4367 4369 static const struct pci_error_handlers mlx4_err_handler = {
+5 -2
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c
··· 183 183 184 184 static bool mlx5e_rep_is_lag_netdev(struct net_device *netdev) 185 185 { 186 - struct mlx5e_priv *priv = netdev_priv(netdev); 187 - struct mlx5e_rep_priv *rpriv = priv->ppriv; 186 + struct mlx5e_rep_priv *rpriv; 187 + struct mlx5e_priv *priv; 188 188 189 189 /* A given netdev is not a representor or not a slave of LAG configuration */ 190 190 if (!mlx5e_eswitch_rep(netdev) || !bond_slave_get_rtnl(netdev)) 191 191 return false; 192 + 193 + priv = netdev_priv(netdev); 194 + rpriv = priv->ppriv; 192 195 193 196 /* Egress acl forward to vport is supported only non-uplink representor */ 194 197 return rpriv->rep->vport != MLX5_VPORT_UPLINK;
+22 -10
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
··· 551 551 } 552 552 } 553 553 554 - tun_dst = tun_rx_dst(enc_opts.key.len); 555 - if (!tun_dst) { 556 - WARN_ON_ONCE(true); 554 + if (key.enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS) { 555 + tun_dst = __ip_tun_set_dst(key.enc_ipv4.src, key.enc_ipv4.dst, 556 + key.enc_ip.tos, key.enc_ip.ttl, 557 + key.enc_tp.dst, TUNNEL_KEY, 558 + key32_to_tunnel_id(key.enc_key_id.keyid), 559 + enc_opts.key.len); 560 + } else if (key.enc_control.addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) { 561 + tun_dst = __ipv6_tun_set_dst(&key.enc_ipv6.src, &key.enc_ipv6.dst, 562 + key.enc_ip.tos, key.enc_ip.ttl, 563 + key.enc_tp.dst, 0, TUNNEL_KEY, 564 + key32_to_tunnel_id(key.enc_key_id.keyid), 565 + enc_opts.key.len); 566 + } else { 567 + netdev_dbg(priv->netdev, 568 + "Couldn't restore tunnel, unsupported addr_type: %d\n", 569 + key.enc_control.addr_type); 557 570 return false; 558 571 } 559 572 560 - ip_tunnel_key_init(&tun_dst->u.tun_info.key, 561 - key.enc_ipv4.src, key.enc_ipv4.dst, 562 - key.enc_ip.tos, key.enc_ip.ttl, 563 - 0, /* label */ 564 - key.enc_tp.src, key.enc_tp.dst, 565 - key32_to_tunnel_id(key.enc_key_id.keyid), 566 - TUNNEL_KEY); 573 + if (!tun_dst) { 574 + netdev_dbg(priv->netdev, "Couldn't restore tunnel, no tun_dst\n"); 575 + return false; 576 + } 577 + 578 + tun_dst->u.tun_info.key.tp_src = key.enc_tp.src; 567 579 568 580 if (enc_opts.key.len) 569 581 ip_tunnel_info_opts_set(&tun_dst->u.tun_info,
+2
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c
··· 301 301 MLX5_SET(fte_match_set_misc, misc_v, geneve_protocol_type, ETH_P_TEB); 302 302 } 303 303 304 + spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 305 + 304 306 return 0; 305 307 } 306 308
+2
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_gre.c
··· 80 80 gre_key.key, be32_to_cpu(enc_keyid.key->keyid)); 81 81 } 82 82 83 + spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 84 + 83 85 return 0; 84 86 } 85 87
+2
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
··· 136 136 MLX5_SET(fte_match_set_misc, misc_v, vxlan_vni, 137 137 be32_to_cpu(enc_keyid.key->keyid)); 138 138 139 + spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 140 + 139 141 return 0; 140 142 } 141 143
+26 -5
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 419 419 err = mlx5_wq_ll_create(mdev, &rqp->wq, rqc_wq, &rq->mpwqe.wq, 420 420 &rq->wq_ctrl); 421 421 if (err) 422 - return err; 422 + goto err_rq_wq_destroy; 423 423 424 424 rq->mpwqe.wq.db = &rq->mpwqe.wq.db[MLX5_RCV_DBR]; 425 425 ··· 470 470 err = mlx5_wq_cyc_create(mdev, &rqp->wq, rqc_wq, &rq->wqe.wq, 471 471 &rq->wq_ctrl); 472 472 if (err) 473 - return err; 473 + goto err_rq_wq_destroy; 474 474 475 475 rq->wqe.wq.db = &rq->wqe.wq.db[MLX5_RCV_DBR]; 476 476 ··· 3069 3069 priv->tstamp.rx_filter = HWTSTAMP_FILTER_NONE; 3070 3070 } 3071 3071 3072 + static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev, 3073 + enum mlx5_port_status state) 3074 + { 3075 + struct mlx5_eswitch *esw = mdev->priv.eswitch; 3076 + int vport_admin_state; 3077 + 3078 + mlx5_set_port_admin_status(mdev, state); 3079 + 3080 + if (!MLX5_ESWITCH_MANAGER(mdev) || mlx5_eswitch_mode(esw) == MLX5_ESWITCH_OFFLOADS) 3081 + return; 3082 + 3083 + if (state == MLX5_PORT_UP) 3084 + vport_admin_state = MLX5_VPORT_ADMIN_STATE_AUTO; 3085 + else 3086 + vport_admin_state = MLX5_VPORT_ADMIN_STATE_DOWN; 3087 + 3088 + mlx5_eswitch_set_vport_state(esw, MLX5_VPORT_UPLINK, vport_admin_state); 3089 + } 3090 + 3072 3091 int mlx5e_open_locked(struct net_device *netdev) 3073 3092 { 3074 3093 struct mlx5e_priv *priv = netdev_priv(netdev); ··· 3120 3101 mutex_lock(&priv->state_lock); 3121 3102 err = mlx5e_open_locked(netdev); 3122 3103 if (!err) 3123 - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); 3104 + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_UP); 3124 3105 mutex_unlock(&priv->state_lock); 3125 3106 3126 3107 return err; ··· 3154 3135 return -ENODEV; 3155 3136 3156 3137 mutex_lock(&priv->state_lock); 3157 - mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_DOWN); 3138 + mlx5e_modify_admin_state(priv->mdev, MLX5_PORT_DOWN); 3158 3139 err = mlx5e_close_locked(netdev); 3159 3140 mutex_unlock(&priv->state_lock); 3160 3141 ··· 5201 5182 5202 5183 /* Marking the link as currently not needed by the Driver */ 5203 5184 if (!netif_running(netdev)) 5204 - mlx5_set_port_admin_status(mdev, MLX5_PORT_DOWN); 5185 + mlx5e_modify_admin_state(mdev, MLX5_PORT_DOWN); 5205 5186 5206 5187 mlx5e_set_netdev_mtu_boundaries(priv); 5207 5188 mlx5e_set_dev_port_mtu(priv); ··· 5409 5390 profile->cleanup_tx(priv); 5410 5391 5411 5392 out: 5393 + set_bit(MLX5E_STATE_DESTROYING, &priv->state); 5394 + cancel_work_sync(&priv->update_stats_work); 5412 5395 return err; 5413 5396 } 5414 5397
+3
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 936 936 937 937 static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv) 938 938 { 939 + mlx5e_ethtool_cleanup_steering(priv); 939 940 rep_vport_rx_rule_destroy(priv); 940 941 mlx5e_destroy_rep_root_ft(priv); 941 942 mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); ··· 1081 1080 1082 1081 mlx5e_rep_tc_enable(priv); 1083 1082 1083 + mlx5_modify_vport_admin_state(mdev, MLX5_VPORT_STATE_OP_MOD_UPLINK, 1084 + 0, 0, MLX5_VPORT_ADMIN_STATE_AUTO); 1084 1085 mlx5_lag_add(mdev, netdev); 1085 1086 priv->events_nb.notifier_call = uplink_rep_async_event; 1086 1087 mlx5_notifier_register(mdev, &priv->events_nb);
+1
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 2356 2356 match.key->vlan_priority); 2357 2357 2358 2358 *match_level = MLX5_MATCH_L2; 2359 + spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 2359 2360 } 2360 2361 } 2361 2362
+16 -11
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 1608 1608 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 1609 1609 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); 1610 1610 } 1611 - 1611 + esw_destroy_tsar(esw); 1612 1612 return err; 1613 1613 } 1614 1614 ··· 1653 1653 else if (esw->mode == MLX5_ESWITCH_OFFLOADS) 1654 1654 esw_offloads_disable(esw); 1655 1655 1656 - esw_destroy_tsar(esw); 1657 - 1658 1656 old_mode = esw->mode; 1659 1657 esw->mode = MLX5_ESWITCH_NONE; 1660 1658 ··· 1662 1664 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); 1663 1665 mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_ETH); 1664 1666 } 1667 + esw_destroy_tsar(esw); 1668 + 1665 1669 if (clear_vf) 1666 1670 mlx5_eswitch_clear_vf_vports_info(esw); 1667 1671 } ··· 1826 1826 u16 vport, int link_state) 1827 1827 { 1828 1828 struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); 1829 + int opmod = MLX5_VPORT_STATE_OP_MOD_ESW_VPORT; 1830 + int other_vport = 1; 1829 1831 int err = 0; 1830 1832 1831 1833 if (!ESW_ALLOWED(esw)) ··· 1835 1833 if (IS_ERR(evport)) 1836 1834 return PTR_ERR(evport); 1837 1835 1836 + if (vport == MLX5_VPORT_UPLINK) { 1837 + opmod = MLX5_VPORT_STATE_OP_MOD_UPLINK; 1838 + other_vport = 0; 1839 + vport = 0; 1840 + } 1838 1841 mutex_lock(&esw->state_lock); 1839 1842 1840 - err = mlx5_modify_vport_admin_state(esw->dev, 1841 - MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, 1842 - vport, 1, link_state); 1843 + err = mlx5_modify_vport_admin_state(esw->dev, opmod, vport, other_vport, link_state); 1843 1844 if (err) { 1844 - mlx5_core_warn(esw->dev, 1845 - "Failed to set vport %d link state, err = %d", 1846 - vport, err); 1845 + mlx5_core_warn(esw->dev, "Failed to set vport %d link state, opmod = %d, err = %d", 1846 + vport, opmod, err); 1847 1847 goto unlock; 1848 1848 } 1849 1849 ··· 1887 1883 struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport); 1888 1884 int err = 0; 1889 1885 1890 - if (!ESW_ALLOWED(esw)) 1891 - return -EPERM; 1892 1886 if (IS_ERR(evport)) 1893 1887 return PTR_ERR(evport); 1894 1888 if (vlan > 4095 || qos > 7) ··· 1913 1911 { 1914 1912 u8 set_flags = 0; 1915 1913 int err; 1914 + 1915 + if (!ESW_ALLOWED(esw)) 1916 + return -EPERM; 1916 1917 1917 1918 if (vlan || qos) 1918 1919 set_flags = SET_VLAN_STRIP | SET_VLAN_INSERT;
+2
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 680 680 static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw, bool clear_vf) {} 681 681 static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; } 682 682 static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; } 683 + static inline 684 + int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, u16 vport, int link_state) { return 0; } 683 685 static inline const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev) 684 686 { 685 687 return ERR_PTR(-EOPNOTSUPP);
+12 -7
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 236 236 return &esw->offloads.vport_reps[idx]; 237 237 } 238 238 239 + static void 240 + mlx5_eswitch_set_rule_flow_source(struct mlx5_eswitch *esw, 241 + struct mlx5_flow_spec *spec, 242 + struct mlx5_esw_flow_attr *attr) 243 + { 244 + if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) && 245 + attr && attr->in_rep && attr->in_rep->vport == MLX5_VPORT_UPLINK) 246 + spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK; 247 + } 239 248 240 249 static void 241 250 mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw, ··· 268 259 mlx5_eswitch_get_vport_metadata_mask()); 269 260 270 261 spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS_2; 271 - misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters); 272 - if (memchr_inv(misc, 0, MLX5_ST_SZ_BYTES(fte_match_set_misc))) 273 - spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 274 262 } else { 275 263 misc = MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters); 276 264 MLX5_SET(fte_match_set_misc, misc, source_port, attr->in_rep->vport); ··· 285 279 286 280 spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS; 287 281 } 288 - 289 - if (MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source) && 290 - attr->in_rep->vport == MLX5_VPORT_UPLINK) 291 - spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_UPLINK; 292 282 } 293 283 294 284 struct mlx5_flow_handle * ··· 398 396 goto err_esw_get; 399 397 } 400 398 399 + mlx5_eswitch_set_rule_flow_source(esw, spec, attr); 400 + 401 401 if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) 402 402 rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr, 403 403 &flow_act, dest, i); ··· 466 462 i++; 467 463 468 464 mlx5_eswitch_set_rule_source_port(esw, spec, attr); 465 + mlx5_eswitch_set_rule_flow_source(esw, spec, attr); 469 466 470 467 if (attr->outer_match_level != MLX5_MATCH_NONE) 471 468 spec->match_criteria_enable |= MLX5_MATCH_OUTER_HEADERS;
+5 -23
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 797 797 return ft; 798 798 } 799 799 800 - /* If reverse if false then return the first flow table in next priority of 800 + /* If reverse is false then return the first flow table in next priority of 801 801 * prio in the tree, else return the last flow table in the previous priority 802 802 * of prio in the tree. 803 803 */ ··· 829 829 return find_closest_ft(prio, true); 830 830 } 831 831 832 - static struct fs_prio *find_fwd_ns_prio(struct mlx5_flow_root_namespace *root, 833 - struct mlx5_flow_namespace *ns) 834 - { 835 - struct mlx5_flow_namespace *root_ns = &root->ns; 836 - struct fs_prio *iter_prio; 837 - struct fs_prio *prio; 838 - 839 - fs_get_obj(prio, ns->node.parent); 840 - list_for_each_entry(iter_prio, &root_ns->node.children, node.list) { 841 - if (iter_prio == prio && 842 - !list_is_last(&prio->node.children, &iter_prio->node.list)) 843 - return list_next_entry(iter_prio, node.list); 844 - } 845 - return NULL; 846 - } 847 - 848 832 static struct mlx5_flow_table *find_next_fwd_ft(struct mlx5_flow_table *ft, 849 833 struct mlx5_flow_act *flow_act) 850 834 { 851 - struct mlx5_flow_root_namespace *root = find_root(&ft->node); 852 835 struct fs_prio *prio; 836 + bool next_ns; 853 837 854 - if (flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS) 855 - prio = find_fwd_ns_prio(root, ft->ns); 856 - else 857 - fs_get_obj(prio, ft->node.parent); 838 + next_ns = flow_act->action & MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS; 839 + fs_get_obj(prio, next_ns ? ft->ns->node.parent : ft->node.parent); 858 840 859 - return (prio) ? find_next_chained_ft(prio) : NULL; 841 + return find_next_chained_ft(prio); 860 842 } 861 843 862 844 static int connect_fts_in_prio(struct mlx5_core_dev *dev,
+65 -13
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
··· 273 273 if (rq->extts.index >= clock->ptp_info.n_pins) 274 274 return -EINVAL; 275 275 276 + pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); 277 + if (pin < 0) 278 + return -EBUSY; 279 + 276 280 if (on) { 277 - pin = ptp_find_pin(clock->ptp, PTP_PF_EXTTS, rq->extts.index); 278 - if (pin < 0) 279 - return -EBUSY; 280 281 pin_mode = MLX5_PIN_MODE_IN; 281 282 pattern = !!(rq->extts.flags & PTP_FALLING_EDGE); 282 283 field_select = MLX5_MTPPS_FS_PIN_MODE | 283 284 MLX5_MTPPS_FS_PATTERN | 284 285 MLX5_MTPPS_FS_ENABLE; 285 286 } else { 286 - pin = rq->extts.index; 287 287 field_select = MLX5_MTPPS_FS_ENABLE; 288 288 } 289 289 ··· 331 331 if (rq->perout.index >= clock->ptp_info.n_pins) 332 332 return -EINVAL; 333 333 334 - if (on) { 335 - pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, 336 - rq->perout.index); 337 - if (pin < 0) 338 - return -EBUSY; 334 + pin = ptp_find_pin(clock->ptp, PTP_PF_PEROUT, 335 + rq->perout.index); 336 + if (pin < 0) 337 + return -EBUSY; 339 338 339 + if (on) { 340 340 pin_mode = MLX5_PIN_MODE_OUT; 341 341 pattern = MLX5_OUT_PATTERN_PERIODIC; 342 342 ts.tv_sec = rq->perout.period.sec; ··· 362 362 MLX5_MTPPS_FS_ENABLE | 363 363 MLX5_MTPPS_FS_TIME_STAMP; 364 364 } else { 365 - pin = rq->perout.index; 366 365 field_select = MLX5_MTPPS_FS_ENABLE; 367 366 } 368 367 ··· 408 409 return 0; 409 410 } 410 411 412 + enum { 413 + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN = BIT(0), 414 + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT = BIT(1), 415 + }; 416 + 411 417 static int mlx5_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, 412 418 enum ptp_pin_function func, unsigned int chan) 413 419 { 414 - return (func == PTP_PF_PHYSYNC) ? -EOPNOTSUPP : 0; 420 + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, 421 + ptp_info); 422 + 423 + switch (func) { 424 + case PTP_PF_NONE: 425 + return 0; 426 + case PTP_PF_EXTTS: 427 + return !(clock->pps_info.pin_caps[pin] & 428 + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_IN); 429 + case PTP_PF_PEROUT: 430 + return !(clock->pps_info.pin_caps[pin] & 431 + MLX5_MTPPS_REG_CAP_PIN_X_MODE_SUPPORT_PPS_OUT); 432 + default: 433 + return -EOPNOTSUPP; 434 + } 435 + 436 + return -EOPNOTSUPP; 415 437 } 416 438 417 439 static const struct ptp_clock_info mlx5_ptp_clock_info = { ··· 451 431 .enable = NULL, 452 432 .verify = NULL, 453 433 }; 434 + 435 + static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin, 436 + u32 *mtpps, u32 mtpps_size) 437 + { 438 + u32 in[MLX5_ST_SZ_DW(mtpps_reg)] = {}; 439 + 440 + MLX5_SET(mtpps_reg, in, pin, pin); 441 + 442 + return mlx5_core_access_reg(mdev, in, sizeof(in), mtpps, 443 + mtpps_size, MLX5_REG_MTPPS, 0, 0); 444 + } 445 + 446 + static int mlx5_get_pps_pin_mode(struct mlx5_clock *clock, u8 pin) 447 + { 448 + struct mlx5_core_dev *mdev = clock->mdev; 449 + u32 out[MLX5_ST_SZ_DW(mtpps_reg)] = {}; 450 + u8 mode; 451 + int err; 452 + 453 + err = mlx5_query_mtpps_pin_mode(mdev, pin, out, sizeof(out)); 454 + if (err || !MLX5_GET(mtpps_reg, out, enable)) 455 + return PTP_PF_NONE; 456 + 457 + mode = MLX5_GET(mtpps_reg, out, pin_mode); 458 + 459 + if (mode == MLX5_PIN_MODE_IN) 460 + return PTP_PF_EXTTS; 461 + else if (mode == MLX5_PIN_MODE_OUT) 462 + return PTP_PF_PEROUT; 463 + 464 + return PTP_PF_NONE; 465 + } 454 466 455 467 static int mlx5_init_pin_config(struct mlx5_clock *clock) 456 468 { ··· 503 451 sizeof(clock->ptp_info.pin_config[i].name), 504 452 "mlx5_pps%d", i); 505 453 clock->ptp_info.pin_config[i].index = i; 506 - clock->ptp_info.pin_config[i].func = PTP_PF_NONE; 507 - clock->ptp_info.pin_config[i].chan = i; 454 + clock->ptp_info.pin_config[i].func = mlx5_get_pps_pin_mode(clock, i); 455 + clock->ptp_info.pin_config[i].chan = 0; 508 456 } 509 457 510 458 return 0;
+5 -3
drivers/net/ethernet/mellanox/mlxsw/core.c
··· 1814 1814 err = mlxsw_emad_reg_access(mlxsw_core, reg, payload, type, trans, 1815 1815 bulk_list, cb, cb_priv, tid); 1816 1816 if (err) { 1817 - kfree(trans); 1817 + kfree_rcu(trans, rcu); 1818 1818 return err; 1819 1819 } 1820 1820 return 0; ··· 2051 2051 break; 2052 2052 } 2053 2053 } 2054 - rcu_read_unlock(); 2055 - if (!found) 2054 + if (!found) { 2055 + rcu_read_unlock(); 2056 2056 goto drop; 2057 + } 2057 2058 2058 2059 rxl->func(skb, local_port, rxl_item->priv); 2060 + rcu_read_unlock(); 2059 2061 return; 2060 2062 2061 2063 drop:
+1
drivers/net/ethernet/mellanox/mlxsw/reg.h
··· 5536 5536 MLXSW_REG_HTGT_TRAP_GROUP_SP_MULTICAST, 5537 5537 MLXSW_REG_HTGT_TRAP_GROUP_SP_NEIGH_DISCOVERY, 5538 5538 MLXSW_REG_HTGT_TRAP_GROUP_SP_ROUTER_EXP, 5539 + MLXSW_REG_HTGT_TRAP_GROUP_SP_EXTERNAL_ROUTE, 5539 5540 MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME, 5540 5541 MLXSW_REG_HTGT_TRAP_GROUP_SP_DHCP, 5541 5542 MLXSW_REG_HTGT_TRAP_GROUP_SP_EVENT,
+26 -33
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 5001 5001 5002 5002 static bool mlxsw_sp_fib6_rt_should_ignore(const struct fib6_info *rt) 5003 5003 { 5004 - /* Packets with link-local destination IP arriving to the router 5005 - * are trapped to the CPU, so no need to program specific routes 5006 - * for them. Only allow prefix routes (usually one fe80::/64) so 5007 - * that packets are trapped for the right reason. 5008 - */ 5009 - if ((ipv6_addr_type(&rt->fib6_dst.addr) & IPV6_ADDR_LINKLOCAL) && 5010 - (rt->fib6_flags & (RTF_LOCAL | RTF_ANYCAST))) 5011 - return true; 5012 - 5013 5004 /* Multicast routes aren't supported, so ignore them. Neighbour 5014 5005 * Discovery packets are specifically trapped. 5015 5006 */ ··· 8069 8078 mlxsw_sp->router = router; 8070 8079 router->mlxsw_sp = mlxsw_sp; 8071 8080 8072 - router->inetaddr_nb.notifier_call = mlxsw_sp_inetaddr_event; 8073 - err = register_inetaddr_notifier(&router->inetaddr_nb); 8074 - if (err) 8075 - goto err_register_inetaddr_notifier; 8076 - 8077 - router->inet6addr_nb.notifier_call = mlxsw_sp_inet6addr_event; 8078 - err = register_inet6addr_notifier(&router->inet6addr_nb); 8079 - if (err) 8080 - goto err_register_inet6addr_notifier; 8081 - 8082 8081 INIT_LIST_HEAD(&mlxsw_sp->router->nexthop_neighs_list); 8083 8082 err = __mlxsw_sp_router_init(mlxsw_sp); 8084 8083 if (err) ··· 8109 8128 if (err) 8110 8129 goto err_neigh_init; 8111 8130 8112 - mlxsw_sp->router->netevent_nb.notifier_call = 8113 - mlxsw_sp_router_netevent_event; 8114 - err = register_netevent_notifier(&mlxsw_sp->router->netevent_nb); 8115 - if (err) 8116 - goto err_register_netevent_notifier; 8117 - 8118 8131 err = mlxsw_sp_mp_hash_init(mlxsw_sp); 8119 8132 if (err) 8120 8133 goto err_mp_hash_init; ··· 8116 8141 err = mlxsw_sp_dscp_init(mlxsw_sp); 8117 8142 if (err) 8118 8143 goto err_dscp_init; 8144 + 8145 + router->inetaddr_nb.notifier_call = mlxsw_sp_inetaddr_event; 8146 + err = register_inetaddr_notifier(&router->inetaddr_nb); 8147 + if (err) 8148 + goto err_register_inetaddr_notifier; 8149 + 8150 + router->inet6addr_nb.notifier_call = mlxsw_sp_inet6addr_event; 8151 + err = register_inet6addr_notifier(&router->inet6addr_nb); 8152 + if (err) 8153 + goto err_register_inet6addr_notifier; 8154 + 8155 + mlxsw_sp->router->netevent_nb.notifier_call = 8156 + mlxsw_sp_router_netevent_event; 8157 + err = register_netevent_notifier(&mlxsw_sp->router->netevent_nb); 8158 + if (err) 8159 + goto err_register_netevent_notifier; 8119 8160 8120 8161 mlxsw_sp->router->fib_nb.notifier_call = mlxsw_sp_router_fib_event; 8121 8162 err = register_fib_notifier(mlxsw_sp_net(mlxsw_sp), ··· 8143 8152 return 0; 8144 8153 8145 8154 err_register_fib_notifier: 8146 - err_dscp_init: 8147 - err_mp_hash_init: 8148 8155 unregister_netevent_notifier(&mlxsw_sp->router->netevent_nb); 8149 8156 err_register_netevent_notifier: 8157 + unregister_inet6addr_notifier(&router->inet6addr_nb); 8158 + err_register_inet6addr_notifier: 8159 + unregister_inetaddr_notifier(&router->inetaddr_nb); 8160 + err_register_inetaddr_notifier: 8161 + mlxsw_core_flush_owq(); 8162 + err_dscp_init: 8163 + err_mp_hash_init: 8150 8164 mlxsw_sp_neigh_fini(mlxsw_sp); 8151 8165 err_neigh_init: 8152 8166 mlxsw_sp_vrs_fini(mlxsw_sp); ··· 8170 8174 err_rifs_init: 8171 8175 __mlxsw_sp_router_fini(mlxsw_sp); 8172 8176 err_router_init: 8173 - unregister_inet6addr_notifier(&router->inet6addr_nb); 8174 - err_register_inet6addr_notifier: 8175 - unregister_inetaddr_notifier(&router->inetaddr_nb); 8176 - err_register_inetaddr_notifier: 8177 8177 mutex_destroy(&mlxsw_sp->router->lock); 8178 8178 kfree(mlxsw_sp->router); 8179 8179 return err; ··· 8180 8188 unregister_fib_notifier(mlxsw_sp_net(mlxsw_sp), 8181 8189 &mlxsw_sp->router->fib_nb); 8182 8190 unregister_netevent_notifier(&mlxsw_sp->router->netevent_nb); 8191 + unregister_inet6addr_notifier(&mlxsw_sp->router->inet6addr_nb); 8192 + unregister_inetaddr_notifier(&mlxsw_sp->router->inetaddr_nb); 8193 + mlxsw_core_flush_owq(); 8183 8194 mlxsw_sp_neigh_fini(mlxsw_sp); 8184 8195 mlxsw_sp_vrs_fini(mlxsw_sp); 8185 8196 mlxsw_sp_mr_fini(mlxsw_sp); ··· 8192 8197 mlxsw_sp_ipips_fini(mlxsw_sp); 8193 8198 mlxsw_sp_rifs_fini(mlxsw_sp); 8194 8199 __mlxsw_sp_router_fini(mlxsw_sp); 8195 - unregister_inet6addr_notifier(&mlxsw_sp->router->inet6addr_nb); 8196 - unregister_inetaddr_notifier(&mlxsw_sp->router->inetaddr_nb); 8197 8200 mutex_destroy(&mlxsw_sp->router->lock); 8198 8201 kfree(mlxsw_sp->router); 8199 8202 }
+11 -3
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c
··· 328 328 { 329 329 .policer = MLXSW_SP_TRAP_POLICER(18, 1024, 128), 330 330 }, 331 + { 332 + .policer = MLXSW_SP_TRAP_POLICER(19, 1024, 512), 333 + }, 331 334 }; 332 335 333 336 static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] = { ··· 423 420 .group = DEVLINK_TRAP_GROUP_GENERIC(LOCAL_DELIVERY, 14), 424 421 .hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_IP2ME, 425 422 .priority = 2, 423 + }, 424 + { 425 + .group = DEVLINK_TRAP_GROUP_GENERIC(EXTERNAL_DELIVERY, 19), 426 + .hw_group_id = MLXSW_REG_HTGT_TRAP_GROUP_SP_EXTERNAL_ROUTE, 427 + .priority = 1, 426 428 }, 427 429 { 428 430 .group = DEVLINK_TRAP_GROUP_GENERIC(IPV6, 15), ··· 890 882 }, 891 883 }, 892 884 { 893 - .trap = MLXSW_SP_TRAP_CONTROL(EXTERNAL_ROUTE, LOCAL_DELIVERY, 885 + .trap = MLXSW_SP_TRAP_CONTROL(EXTERNAL_ROUTE, EXTERNAL_DELIVERY, 894 886 TRAP), 895 887 .listeners_arr = { 896 - MLXSW_SP_RXL_MARK(RTR_INGRESS0, IP2ME, TRAP_TO_CPU, 897 - false), 888 + MLXSW_SP_RXL_MARK(RTR_INGRESS0, EXTERNAL_ROUTE, 889 + TRAP_TO_CPU, false), 898 890 }, 899 891 }, 900 892 {
+5 -5
drivers/net/ethernet/mscc/ocelot.c
··· 748 748 749 749 spin_unlock_irqrestore(&port->tx_skbs.lock, flags); 750 750 751 - /* Next ts */ 752 - ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT); 751 + /* Get the h/w timestamp */ 752 + ocelot_get_hwtimestamp(ocelot, &ts); 753 753 754 754 if (unlikely(!skb_match)) 755 755 continue; 756 - 757 - /* Get the h/w timestamp */ 758 - ocelot_get_hwtimestamp(ocelot, &ts); 759 756 760 757 /* Set the timestamp into the skb */ 761 758 memset(&shhwtstamps, 0, sizeof(shhwtstamps)); ··· 760 763 skb_tstamp_tx(skb_match, &shhwtstamps); 761 764 762 765 dev_kfree_skb_any(skb_match); 766 + 767 + /* Next ts */ 768 + ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT); 763 769 } 764 770 } 765 771 EXPORT_SYMBOL(ocelot_get_txtstamp);
+5 -3
drivers/net/ethernet/ni/nixge.c
··· 1299 1299 netif_napi_add(ndev, &priv->napi, nixge_poll, NAPI_POLL_WEIGHT); 1300 1300 err = nixge_of_get_resources(pdev); 1301 1301 if (err) 1302 - return err; 1302 + goto free_netdev; 1303 1303 __nixge_hw_set_mac_address(ndev); 1304 1304 1305 1305 priv->tx_irq = platform_get_irq_byname(pdev, "tx"); 1306 1306 if (priv->tx_irq < 0) { 1307 1307 netdev_err(ndev, "could not find 'tx' irq"); 1308 - return priv->tx_irq; 1308 + err = priv->tx_irq; 1309 + goto free_netdev; 1309 1310 } 1310 1311 1311 1312 priv->rx_irq = platform_get_irq_byname(pdev, "rx"); 1312 1313 if (priv->rx_irq < 0) { 1313 1314 netdev_err(ndev, "could not find 'rx' irq"); 1314 - return priv->rx_irq; 1315 + err = priv->rx_irq; 1316 + goto free_netdev; 1315 1317 } 1316 1318 1317 1319 priv->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD;
+3 -1
drivers/net/ethernet/pensando/ionic/ionic_lif.c
··· 2001 2001 netif_device_detach(lif->netdev); 2002 2002 err = ionic_stop(lif->netdev); 2003 2003 if (err) 2004 - return err; 2004 + goto reset_out; 2005 2005 } 2006 2006 2007 2007 if (cb) ··· 2011 2011 err = ionic_open(lif->netdev); 2012 2012 netif_device_attach(lif->netdev); 2013 2013 } 2014 + 2015 + reset_out: 2014 2016 mutex_unlock(&lif->queue_lock); 2015 2017 2016 2018 return err;
+4 -1
drivers/net/usb/hso.c
··· 2261 2261 2262 2262 minor = get_free_serial_index(); 2263 2263 if (minor < 0) 2264 - goto exit; 2264 + goto exit2; 2265 2265 2266 2266 /* register our minor number */ 2267 2267 serial->parent->dev = tty_port_register_device_attr(&serial->port, 2268 2268 tty_drv, minor, &serial->parent->interface->dev, 2269 2269 serial->parent, hso_serial_dev_groups); 2270 + if (IS_ERR(serial->parent->dev)) 2271 + goto exit2; 2270 2272 2271 2273 /* fill in specific data for later use */ 2272 2274 serial->minor = minor; ··· 2313 2311 return 0; 2314 2312 exit: 2315 2313 hso_serial_tty_unregister(serial); 2314 + exit2: 2316 2315 hso_serial_common_free(serial); 2317 2316 return -1; 2318 2317 }
+31 -82
drivers/net/usb/lan78xx.c
··· 377 377 struct tasklet_struct bh; 378 378 struct delayed_work wq; 379 379 380 - struct usb_host_endpoint *ep_blkin; 381 - struct usb_host_endpoint *ep_blkout; 382 - struct usb_host_endpoint *ep_intr; 383 - 384 380 int msg_enable; 385 381 386 382 struct urb *urb_intr; ··· 2856 2860 return NETDEV_TX_OK; 2857 2861 } 2858 2862 2859 - static int 2860 - lan78xx_get_endpoints(struct lan78xx_net *dev, struct usb_interface *intf) 2861 - { 2862 - int tmp; 2863 - struct usb_host_interface *alt = NULL; 2864 - struct usb_host_endpoint *in = NULL, *out = NULL; 2865 - struct usb_host_endpoint *status = NULL; 2866 - 2867 - for (tmp = 0; tmp < intf->num_altsetting; tmp++) { 2868 - unsigned ep; 2869 - 2870 - in = NULL; 2871 - out = NULL; 2872 - status = NULL; 2873 - alt = intf->altsetting + tmp; 2874 - 2875 - for (ep = 0; ep < alt->desc.bNumEndpoints; ep++) { 2876 - struct usb_host_endpoint *e; 2877 - int intr = 0; 2878 - 2879 - e = alt->endpoint + ep; 2880 - switch (e->desc.bmAttributes) { 2881 - case USB_ENDPOINT_XFER_INT: 2882 - if (!usb_endpoint_dir_in(&e->desc)) 2883 - continue; 2884 - intr = 1; 2885 - /* FALLTHROUGH */ 2886 - case USB_ENDPOINT_XFER_BULK: 2887 - break; 2888 - default: 2889 - continue; 2890 - } 2891 - if (usb_endpoint_dir_in(&e->desc)) { 2892 - if (!intr && !in) 2893 - in = e; 2894 - else if (intr && !status) 2895 - status = e; 2896 - } else { 2897 - if (!out) 2898 - out = e; 2899 - } 2900 - } 2901 - if (in && out) 2902 - break; 2903 - } 2904 - if (!alt || !in || !out) 2905 - return -EINVAL; 2906 - 2907 - dev->pipe_in = usb_rcvbulkpipe(dev->udev, 2908 - in->desc.bEndpointAddress & 2909 - USB_ENDPOINT_NUMBER_MASK); 2910 - dev->pipe_out = usb_sndbulkpipe(dev->udev, 2911 - out->desc.bEndpointAddress & 2912 - USB_ENDPOINT_NUMBER_MASK); 2913 - dev->ep_intr = status; 2914 - 2915 - return 0; 2916 - } 2917 - 2918 2863 static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) 2919 2864 { 2920 2865 struct lan78xx_priv *pdata = NULL; 2921 2866 int ret; 2922 2867 int i; 2923 - 2924 - ret = lan78xx_get_endpoints(dev, intf); 2925 - if (ret) { 2926 - netdev_warn(dev->net, "lan78xx_get_endpoints failed: %d\n", 2927 - ret); 2928 - return ret; 2929 - } 2930 2868 2931 2869 dev->data[0] = (unsigned long)kzalloc(sizeof(*pdata), GFP_KERNEL); 2932 2870 ··· 3630 3700 static int lan78xx_probe(struct usb_interface *intf, 3631 3701 const struct usb_device_id *id) 3632 3702 { 3703 + struct usb_host_endpoint *ep_blkin, *ep_blkout, *ep_intr; 3633 3704 struct lan78xx_net *dev; 3634 3705 struct net_device *netdev; 3635 3706 struct usb_device *udev; ··· 3679 3748 3680 3749 mutex_init(&dev->stats.access_lock); 3681 3750 3751 + if (intf->cur_altsetting->desc.bNumEndpoints < 3) { 3752 + ret = -ENODEV; 3753 + goto out2; 3754 + } 3755 + 3756 + dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE); 3757 + ep_blkin = usb_pipe_endpoint(udev, dev->pipe_in); 3758 + if (!ep_blkin || !usb_endpoint_is_bulk_in(&ep_blkin->desc)) { 3759 + ret = -ENODEV; 3760 + goto out2; 3761 + } 3762 + 3763 + dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE); 3764 + ep_blkout = usb_pipe_endpoint(udev, dev->pipe_out); 3765 + if (!ep_blkout || !usb_endpoint_is_bulk_out(&ep_blkout->desc)) { 3766 + ret = -ENODEV; 3767 + goto out2; 3768 + } 3769 + 3770 + ep_intr = &intf->cur_altsetting->endpoint[2]; 3771 + if (!usb_endpoint_is_int_in(&ep_intr->desc)) { 3772 + ret = -ENODEV; 3773 + goto out2; 3774 + } 3775 + 3776 + dev->pipe_intr = usb_rcvintpipe(dev->udev, 3777 + usb_endpoint_num(&ep_intr->desc)); 3778 + 3682 3779 ret = lan78xx_bind(dev, intf); 3683 3780 if (ret < 0) 3684 3781 goto out2; ··· 3718 3759 netdev->max_mtu = MAX_SINGLE_PACKET_SIZE; 3719 3760 netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); 3720 3761 3721 - dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; 3722 - dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; 3723 - dev->ep_intr = (intf->cur_altsetting)->endpoint + 2; 3724 - 3725 - dev->pipe_in = usb_rcvbulkpipe(udev, BULK_IN_PIPE); 3726 - dev->pipe_out = usb_sndbulkpipe(udev, BULK_OUT_PIPE); 3727 - 3728 - dev->pipe_intr = usb_rcvintpipe(dev->udev, 3729 - dev->ep_intr->desc.bEndpointAddress & 3730 - USB_ENDPOINT_NUMBER_MASK); 3731 - period = dev->ep_intr->desc.bInterval; 3732 - 3762 + period = ep_intr->desc.bInterval; 3733 3763 maxp = usb_maxpacket(dev->udev, dev->pipe_intr, 0); 3734 3764 buf = kmalloc(maxp, GFP_KERNEL); 3735 3765 if (buf) { ··· 3731 3783 usb_fill_int_urb(dev->urb_intr, dev->udev, 3732 3784 dev->pipe_intr, buf, maxp, 3733 3785 intr_complete, dev, period); 3786 + dev->urb_intr->transfer_flags |= URB_FREE_BUFFER; 3734 3787 } 3735 3788 } 3736 3789
+12 -4
drivers/net/vxlan.c
··· 1376 1376 for (h = 0; h < FDB_HASH_SIZE; ++h) { 1377 1377 struct vxlan_fdb *f; 1378 1378 1379 + rcu_read_lock(); 1379 1380 hlist_for_each_entry_rcu(f, &vxlan->fdb_head[h], hlist) { 1380 1381 struct vxlan_rdst *rd; 1381 1382 ··· 1388 1387 cb->nlh->nlmsg_seq, 1389 1388 RTM_NEWNEIGH, 1390 1389 NLM_F_MULTI, NULL); 1391 - if (err < 0) 1390 + if (err < 0) { 1391 + rcu_read_unlock(); 1392 1392 goto out; 1393 + } 1393 1394 skip_nh: 1394 1395 *idx += 1; 1395 1396 continue; ··· 1406 1403 cb->nlh->nlmsg_seq, 1407 1404 RTM_NEWNEIGH, 1408 1405 NLM_F_MULTI, rd); 1409 - if (err < 0) 1406 + if (err < 0) { 1407 + rcu_read_unlock(); 1410 1408 goto out; 1409 + } 1411 1410 skip: 1412 1411 *idx += 1; 1413 1412 } 1414 1413 } 1414 + rcu_read_unlock(); 1415 1415 } 1416 1416 out: 1417 1417 return err; ··· 3076 3070 if (!do_all && (f->state & (NUD_PERMANENT | NUD_NOARP))) 3077 3071 continue; 3078 3072 /* the all_zeros_mac entry is deleted at vxlan_uninit */ 3079 - if (!is_zero_ether_addr(f->eth_addr)) 3080 - vxlan_fdb_destroy(vxlan, f, true, true); 3073 + if (is_zero_ether_addr(f->eth_addr) && 3074 + f->vni == vxlan->cfg.vni) 3075 + continue; 3076 + vxlan_fdb_destroy(vxlan, f, true, true); 3081 3077 } 3082 3078 spin_unlock_bh(&vxlan->hash_lock[h]); 3083 3079 }
+1
include/linux/mlx5/mlx5_ifc.h
··· 4381 4381 enum { 4382 4382 MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0, 4383 4383 MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1, 4384 + MLX5_VPORT_STATE_OP_MOD_UPLINK = 0x2, 4384 4385 }; 4385 4386 4386 4387 struct mlx5_ifc_arm_monitor_counter_in_bits {
+31 -38
include/linux/rhashtable.h
··· 84 84 85 85 struct lockdep_map dep_map; 86 86 87 - struct rhash_lock_head *buckets[] ____cacheline_aligned_in_smp; 87 + struct rhash_lock_head __rcu *buckets[] ____cacheline_aligned_in_smp; 88 88 }; 89 89 90 90 /* ··· 261 261 void *arg); 262 262 void rhashtable_destroy(struct rhashtable *ht); 263 263 264 - struct rhash_lock_head **rht_bucket_nested(const struct bucket_table *tbl, 265 - unsigned int hash); 266 - struct rhash_lock_head **__rht_bucket_nested(const struct bucket_table *tbl, 267 - unsigned int hash); 268 - struct rhash_lock_head **rht_bucket_nested_insert(struct rhashtable *ht, 269 - struct bucket_table *tbl, 270 - unsigned int hash); 264 + struct rhash_lock_head __rcu **rht_bucket_nested( 265 + const struct bucket_table *tbl, unsigned int hash); 266 + struct rhash_lock_head __rcu **__rht_bucket_nested( 267 + const struct bucket_table *tbl, unsigned int hash); 268 + struct rhash_lock_head __rcu **rht_bucket_nested_insert( 269 + struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash); 271 270 272 271 #define rht_dereference(p, ht) \ 273 272 rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht)) ··· 283 284 #define rht_entry(tpos, pos, member) \ 284 285 ({ tpos = container_of(pos, typeof(*tpos), member); 1; }) 285 286 286 - static inline struct rhash_lock_head *const *rht_bucket( 287 + static inline struct rhash_lock_head __rcu *const *rht_bucket( 287 288 const struct bucket_table *tbl, unsigned int hash) 288 289 { 289 290 return unlikely(tbl->nest) ? rht_bucket_nested(tbl, hash) : 290 291 &tbl->buckets[hash]; 291 292 } 292 293 293 - static inline struct rhash_lock_head **rht_bucket_var( 294 + static inline struct rhash_lock_head __rcu **rht_bucket_var( 294 295 struct bucket_table *tbl, unsigned int hash) 295 296 { 296 297 return unlikely(tbl->nest) ? __rht_bucket_nested(tbl, hash) : 297 298 &tbl->buckets[hash]; 298 299 } 299 300 300 - static inline struct rhash_lock_head **rht_bucket_insert( 301 + static inline struct rhash_lock_head __rcu **rht_bucket_insert( 301 302 struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) 302 303 { 303 304 return unlikely(tbl->nest) ? rht_bucket_nested_insert(ht, tbl, hash) : ··· 324 325 */ 325 326 326 327 static inline void rht_lock(struct bucket_table *tbl, 327 - struct rhash_lock_head **bkt) 328 + struct rhash_lock_head __rcu **bkt) 328 329 { 329 330 local_bh_disable(); 330 331 bit_spin_lock(0, (unsigned long *)bkt); ··· 332 333 } 333 334 334 335 static inline void rht_lock_nested(struct bucket_table *tbl, 335 - struct rhash_lock_head **bucket, 336 + struct rhash_lock_head __rcu **bucket, 336 337 unsigned int subclass) 337 338 { 338 339 local_bh_disable(); ··· 341 342 } 342 343 343 344 static inline void rht_unlock(struct bucket_table *tbl, 344 - struct rhash_lock_head **bkt) 345 + struct rhash_lock_head __rcu **bkt) 345 346 { 346 347 lock_map_release(&tbl->dep_map); 347 348 bit_spin_unlock(0, (unsigned long *)bkt); 348 349 local_bh_enable(); 349 350 } 350 351 351 - static inline struct rhash_head __rcu *__rht_ptr( 352 - struct rhash_lock_head *const *bkt) 352 + static inline struct rhash_head *__rht_ptr( 353 + struct rhash_lock_head *p, struct rhash_lock_head __rcu *const *bkt) 353 354 { 354 - return (struct rhash_head __rcu *) 355 - ((unsigned long)*bkt & ~BIT(0) ?: 355 + return (struct rhash_head *) 356 + ((unsigned long)p & ~BIT(0) ?: 356 357 (unsigned long)RHT_NULLS_MARKER(bkt)); 357 358 } 358 359 ··· 364 365 * access is guaranteed, such as when destroying the table. 365 366 */ 366 367 static inline struct rhash_head *rht_ptr_rcu( 367 - struct rhash_lock_head *const *bkt) 368 + struct rhash_lock_head __rcu *const *bkt) 368 369 { 369 - struct rhash_head __rcu *p = __rht_ptr(bkt); 370 - 371 - return rcu_dereference(p); 370 + return __rht_ptr(rcu_dereference(*bkt), bkt); 372 371 } 373 372 374 373 static inline struct rhash_head *rht_ptr( 375 - struct rhash_lock_head *const *bkt, 374 + struct rhash_lock_head __rcu *const *bkt, 376 375 struct bucket_table *tbl, 377 376 unsigned int hash) 378 377 { 379 - return rht_dereference_bucket(__rht_ptr(bkt), tbl, hash); 378 + return __rht_ptr(rht_dereference_bucket(*bkt, tbl, hash), bkt); 380 379 } 381 380 382 381 static inline struct rhash_head *rht_ptr_exclusive( 383 - struct rhash_lock_head *const *bkt) 382 + struct rhash_lock_head __rcu *const *bkt) 384 383 { 385 - return rcu_dereference_protected(__rht_ptr(bkt), 1); 384 + return __rht_ptr(rcu_dereference_protected(*bkt, 1), bkt); 386 385 } 387 386 388 - static inline void rht_assign_locked(struct rhash_lock_head **bkt, 387 + static inline void rht_assign_locked(struct rhash_lock_head __rcu **bkt, 389 388 struct rhash_head *obj) 390 389 { 391 - struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; 392 - 393 390 if (rht_is_a_nulls(obj)) 394 391 obj = NULL; 395 - rcu_assign_pointer(*p, (void *)((unsigned long)obj | BIT(0))); 392 + rcu_assign_pointer(*bkt, (void *)((unsigned long)obj | BIT(0))); 396 393 } 397 394 398 395 static inline void rht_assign_unlock(struct bucket_table *tbl, 399 - struct rhash_lock_head **bkt, 396 + struct rhash_lock_head __rcu **bkt, 400 397 struct rhash_head *obj) 401 398 { 402 - struct rhash_head __rcu **p = (struct rhash_head __rcu **)bkt; 403 - 404 399 if (rht_is_a_nulls(obj)) 405 400 obj = NULL; 406 401 lock_map_release(&tbl->dep_map); 407 - rcu_assign_pointer(*p, obj); 402 + rcu_assign_pointer(*bkt, (void *)obj); 408 403 preempt_enable(); 409 404 __release(bitlock); 410 405 local_bh_enable(); ··· 586 593 .ht = ht, 587 594 .key = key, 588 595 }; 589 - struct rhash_lock_head *const *bkt; 596 + struct rhash_lock_head __rcu *const *bkt; 590 597 struct bucket_table *tbl; 591 598 struct rhash_head *he; 592 599 unsigned int hash; ··· 702 709 .ht = ht, 703 710 .key = key, 704 711 }; 705 - struct rhash_lock_head **bkt; 712 + struct rhash_lock_head __rcu **bkt; 706 713 struct rhash_head __rcu **pprev; 707 714 struct bucket_table *tbl; 708 715 struct rhash_head *head; ··· 988 995 struct rhash_head *obj, const struct rhashtable_params params, 989 996 bool rhlist) 990 997 { 991 - struct rhash_lock_head **bkt; 998 + struct rhash_lock_head __rcu **bkt; 992 999 struct rhash_head __rcu **pprev; 993 1000 struct rhash_head *he; 994 1001 unsigned int hash; ··· 1140 1147 struct rhash_head *obj_old, struct rhash_head *obj_new, 1141 1148 const struct rhashtable_params params) 1142 1149 { 1143 - struct rhash_lock_head **bkt; 1150 + struct rhash_lock_head __rcu **bkt; 1144 1151 struct rhash_head __rcu **pprev; 1145 1152 struct rhash_head *he; 1146 1153 unsigned int hash;
+1
include/net/addrconf.h
··· 274 274 const struct in6_addr *addr); 275 275 int ipv6_sock_ac_drop(struct sock *sk, int ifindex, 276 276 const struct in6_addr *addr); 277 + void __ipv6_sock_ac_close(struct sock *sk); 277 278 void ipv6_sock_ac_close(struct sock *sk); 278 279 279 280 int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr);
+3
include/net/devlink.h
··· 718 718 DEVLINK_TRAP_GROUP_GENERIC_ID_PIM, 719 719 DEVLINK_TRAP_GROUP_GENERIC_ID_UC_LB, 720 720 DEVLINK_TRAP_GROUP_GENERIC_ID_LOCAL_DELIVERY, 721 + DEVLINK_TRAP_GROUP_GENERIC_ID_EXTERNAL_DELIVERY, 721 722 DEVLINK_TRAP_GROUP_GENERIC_ID_IPV6, 722 723 DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_EVENT, 723 724 DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL, ··· 916 915 "uc_loopback" 917 916 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_LOCAL_DELIVERY \ 918 917 "local_delivery" 918 + #define DEVLINK_TRAP_GROUP_GENERIC_NAME_EXTERNAL_DELIVERY \ 919 + "external_delivery" 919 920 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_IPV6 \ 920 921 "ipv6" 921 922 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_EVENT \
+9 -6
include/net/xfrm.h
··· 941 941 static inline struct dst_entry *xfrm_dst_path(const struct dst_entry *dst) 942 942 { 943 943 #ifdef CONFIG_XFRM 944 - if (dst->xfrm) { 944 + if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) { 945 945 const struct xfrm_dst *xdst = (const struct xfrm_dst *) dst; 946 946 947 947 return xdst->path; ··· 953 953 static inline struct dst_entry *xfrm_dst_child(const struct dst_entry *dst) 954 954 { 955 955 #ifdef CONFIG_XFRM 956 - if (dst->xfrm) { 956 + if (dst->xfrm || (dst->flags & DST_XFRM_QUEUE)) { 957 957 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; 958 958 return xdst->child; 959 959 } ··· 1630 1630 void *); 1631 1631 void xfrm_policy_walk_done(struct xfrm_policy_walk *walk, struct net *net); 1632 1632 int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1633 - struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, u32 if_id, 1634 - u8 type, int dir, 1633 + struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, 1634 + const struct xfrm_mark *mark, 1635 + u32 if_id, u8 type, int dir, 1635 1636 struct xfrm_selector *sel, 1636 1637 struct xfrm_sec_ctx *ctx, int delete, 1637 1638 int *err); 1638 - struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u32 if_id, u8, 1639 - int dir, u32 id, int delete, int *err); 1639 + struct xfrm_policy *xfrm_policy_byid(struct net *net, 1640 + const struct xfrm_mark *mark, u32 if_id, 1641 + u8 type, int dir, u32 id, int delete, 1642 + int *err); 1640 1643 int xfrm_policy_flush(struct net *net, u8 type, bool task_valid); 1641 1644 void xfrm_policy_hash_rebuild(struct net *net); 1642 1645 u32 xfrm_get_acqseq(void);
+5
kernel/bpf/btf.c
··· 4058 4058 const char *tname, *sym; 4059 4059 u32 btf_id, i; 4060 4060 4061 + if (!btf_vmlinux) { 4062 + bpf_log(log, "btf_vmlinux doesn't exist\n"); 4063 + return -EINVAL; 4064 + } 4065 + 4061 4066 if (IS_ERR(btf_vmlinux)) { 4062 4067 bpf_log(log, "btf_vmlinux is malformed\n"); 4063 4068 return -EINVAL;
+9 -3
kernel/bpf/hashtab.c
··· 779 779 htab_elem_free(htab, l); 780 780 } 781 781 782 - static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l) 782 + static void htab_put_fd_value(struct bpf_htab *htab, struct htab_elem *l) 783 783 { 784 784 struct bpf_map *map = &htab->map; 785 + void *ptr; 785 786 786 787 if (map->ops->map_fd_put_ptr) { 787 - void *ptr = fd_htab_map_get_ptr(map, l); 788 - 788 + ptr = fd_htab_map_get_ptr(map, l); 789 789 map->ops->map_fd_put_ptr(ptr); 790 790 } 791 + } 792 + 793 + static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l) 794 + { 795 + htab_put_fd_value(htab, l); 791 796 792 797 if (htab_is_prealloc(htab)) { 793 798 __pcpu_freelist_push(&htab->freelist, &l->fnode); ··· 844 839 */ 845 840 pl_new = this_cpu_ptr(htab->extra_elems); 846 841 l_new = *pl_new; 842 + htab_put_fd_value(htab, old_elem); 847 843 *pl_new = old_elem; 848 844 } else { 849 845 struct pcpu_freelist_node *l;
+16 -19
lib/rhashtable.c
··· 31 31 32 32 union nested_table { 33 33 union nested_table __rcu *table; 34 - struct rhash_lock_head *bucket; 34 + struct rhash_lock_head __rcu *bucket; 35 35 }; 36 36 37 37 static u32 head_hashfn(struct rhashtable *ht, ··· 222 222 } 223 223 224 224 static int rhashtable_rehash_one(struct rhashtable *ht, 225 - struct rhash_lock_head **bkt, 225 + struct rhash_lock_head __rcu **bkt, 226 226 unsigned int old_hash) 227 227 { 228 228 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); ··· 275 275 unsigned int old_hash) 276 276 { 277 277 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); 278 - struct rhash_lock_head **bkt = rht_bucket_var(old_tbl, old_hash); 278 + struct rhash_lock_head __rcu **bkt = rht_bucket_var(old_tbl, old_hash); 279 279 int err; 280 280 281 281 if (!bkt) ··· 485 485 } 486 486 487 487 static void *rhashtable_lookup_one(struct rhashtable *ht, 488 - struct rhash_lock_head **bkt, 488 + struct rhash_lock_head __rcu **bkt, 489 489 struct bucket_table *tbl, unsigned int hash, 490 490 const void *key, struct rhash_head *obj) 491 491 { ··· 535 535 return ERR_PTR(-ENOENT); 536 536 } 537 537 538 - static struct bucket_table *rhashtable_insert_one(struct rhashtable *ht, 539 - struct rhash_lock_head **bkt, 540 - struct bucket_table *tbl, 541 - unsigned int hash, 542 - struct rhash_head *obj, 543 - void *data) 538 + static struct bucket_table *rhashtable_insert_one( 539 + struct rhashtable *ht, struct rhash_lock_head __rcu **bkt, 540 + struct bucket_table *tbl, unsigned int hash, struct rhash_head *obj, 541 + void *data) 544 542 { 545 543 struct bucket_table *new_tbl; 546 544 struct rhash_head *head; ··· 589 591 { 590 592 struct bucket_table *new_tbl; 591 593 struct bucket_table *tbl; 592 - struct rhash_lock_head **bkt; 594 + struct rhash_lock_head __rcu **bkt; 593 595 unsigned int hash; 594 596 void *data; 595 597 ··· 1171 1173 } 1172 1174 EXPORT_SYMBOL_GPL(rhashtable_destroy); 1173 1175 1174 - struct rhash_lock_head **__rht_bucket_nested(const struct bucket_table *tbl, 1175 - unsigned int hash) 1176 + struct rhash_lock_head __rcu **__rht_bucket_nested( 1177 + const struct bucket_table *tbl, unsigned int hash) 1176 1178 { 1177 1179 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *)); 1178 1180 unsigned int index = hash & ((1 << tbl->nest) - 1); ··· 1200 1202 } 1201 1203 EXPORT_SYMBOL_GPL(__rht_bucket_nested); 1202 1204 1203 - struct rhash_lock_head **rht_bucket_nested(const struct bucket_table *tbl, 1204 - unsigned int hash) 1205 + struct rhash_lock_head __rcu **rht_bucket_nested( 1206 + const struct bucket_table *tbl, unsigned int hash) 1205 1207 { 1206 - static struct rhash_lock_head *rhnull; 1208 + static struct rhash_lock_head __rcu *rhnull; 1207 1209 1208 1210 if (!rhnull) 1209 1211 INIT_RHT_NULLS_HEAD(rhnull); ··· 1211 1213 } 1212 1214 EXPORT_SYMBOL_GPL(rht_bucket_nested); 1213 1215 1214 - struct rhash_lock_head **rht_bucket_nested_insert(struct rhashtable *ht, 1215 - struct bucket_table *tbl, 1216 - unsigned int hash) 1216 + struct rhash_lock_head __rcu **rht_bucket_nested_insert( 1217 + struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash) 1217 1218 { 1218 1219 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *)); 1219 1220 unsigned int index = hash & ((1 << tbl->nest) - 1);
+1 -1
net/bpfilter/bpfilter_kern.c
··· 39 39 { 40 40 struct mbox_request req; 41 41 struct mbox_reply reply; 42 - loff_t pos; 42 + loff_t pos = 0; 43 43 ssize_t n; 44 44 int ret = -EFAULT; 45 45
+1 -1
net/compat.c
··· 202 202 203 203 /* Advance. */ 204 204 kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp); 205 - ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen); 205 + ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, cmsg.cmsg_len); 206 206 } 207 207 208 208 /*
+19 -6
net/core/devlink.c
··· 1065 1065 devlink_sb, 1066 1066 NETLINK_CB(cb->skb).portid, 1067 1067 cb->nlh->nlmsg_seq); 1068 - if (err && err != -EOPNOTSUPP) { 1068 + if (err == -EOPNOTSUPP) { 1069 + err = 0; 1070 + } else if (err) { 1069 1071 mutex_unlock(&devlink->lock); 1070 1072 goto out; 1071 1073 } ··· 1268 1266 devlink, devlink_sb, 1269 1267 NETLINK_CB(cb->skb).portid, 1270 1268 cb->nlh->nlmsg_seq); 1271 - if (err && err != -EOPNOTSUPP) { 1269 + if (err == -EOPNOTSUPP) { 1270 + err = 0; 1271 + } else if (err) { 1272 1272 mutex_unlock(&devlink->lock); 1273 1273 goto out; 1274 1274 } ··· 1502 1498 devlink_sb, 1503 1499 NETLINK_CB(cb->skb).portid, 1504 1500 cb->nlh->nlmsg_seq); 1505 - if (err && err != -EOPNOTSUPP) { 1501 + if (err == -EOPNOTSUPP) { 1502 + err = 0; 1503 + } else if (err) { 1506 1504 mutex_unlock(&devlink->lock); 1507 1505 goto out; 1508 1506 } ··· 3305 3299 NETLINK_CB(cb->skb).portid, 3306 3300 cb->nlh->nlmsg_seq, 3307 3301 NLM_F_MULTI); 3308 - if (err && err != -EOPNOTSUPP) { 3302 + if (err == -EOPNOTSUPP) { 3303 + err = 0; 3304 + } else if (err) { 3309 3305 mutex_unlock(&devlink->lock); 3310 3306 goto out; 3311 3307 } ··· 3577 3569 NETLINK_CB(cb->skb).portid, 3578 3570 cb->nlh->nlmsg_seq, 3579 3571 NLM_F_MULTI); 3580 - if (err && err != -EOPNOTSUPP) { 3572 + if (err == -EOPNOTSUPP) { 3573 + err = 0; 3574 + } else if (err) { 3581 3575 mutex_unlock(&devlink->lock); 3582 3576 goto out; 3583 3577 } ··· 4528 4518 cb->nlh->nlmsg_seq, NLM_F_MULTI, 4529 4519 cb->extack); 4530 4520 mutex_unlock(&devlink->lock); 4531 - if (err && err != -EOPNOTSUPP) 4521 + if (err == -EOPNOTSUPP) 4522 + err = 0; 4523 + else if (err) 4532 4524 break; 4533 4525 idx++; 4534 4526 } ··· 8579 8567 DEVLINK_TRAP_GROUP(PIM), 8580 8568 DEVLINK_TRAP_GROUP(UC_LB), 8581 8569 DEVLINK_TRAP_GROUP(LOCAL_DELIVERY), 8570 + DEVLINK_TRAP_GROUP(EXTERNAL_DELIVERY), 8582 8571 DEVLINK_TRAP_GROUP(IPV6), 8583 8572 DEVLINK_TRAP_GROUP(PTP_EVENT), 8584 8573 DEVLINK_TRAP_GROUP(PTP_GENERAL),
+1 -1
net/ipv4/fib_trie.c
··· 1864 1864 while ((l = leaf_walk_rcu(&tp, key)) != NULL) { 1865 1865 struct key_vector *local_l = NULL, *local_tp; 1866 1866 1867 - hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) { 1867 + hlist_for_each_entry(fa, &l->leaf, fa_list) { 1868 1868 struct fib_alias *new_fa; 1869 1869 1870 1870 if (local_tb->tb_id != fa->tb_id)
+12 -5
net/ipv6/anycast.c
··· 183 183 return 0; 184 184 } 185 185 186 - void ipv6_sock_ac_close(struct sock *sk) 186 + void __ipv6_sock_ac_close(struct sock *sk) 187 187 { 188 188 struct ipv6_pinfo *np = inet6_sk(sk); 189 189 struct net_device *dev = NULL; ··· 191 191 struct net *net = sock_net(sk); 192 192 int prev_index; 193 193 194 - if (!np->ipv6_ac_list) 195 - return; 196 - 197 - rtnl_lock(); 194 + ASSERT_RTNL(); 198 195 pac = np->ipv6_ac_list; 199 196 np->ipv6_ac_list = NULL; 200 197 ··· 208 211 sock_kfree_s(sk, pac, sizeof(*pac)); 209 212 pac = next; 210 213 } 214 + } 215 + 216 + void ipv6_sock_ac_close(struct sock *sk) 217 + { 218 + struct ipv6_pinfo *np = inet6_sk(sk); 219 + 220 + if (!np->ipv6_ac_list) 221 + return; 222 + rtnl_lock(); 223 + __ipv6_sock_ac_close(sk); 211 224 rtnl_unlock(); 212 225 } 213 226
+10 -3
net/ipv6/esp6.c
··· 805 805 806 806 if (x->encap) { 807 807 const struct ipv6hdr *ip6h = ipv6_hdr(skb); 808 + int offset = skb_network_offset(skb) + sizeof(*ip6h); 808 809 struct xfrm_encap_tmpl *encap = x->encap; 809 - struct udphdr *uh = (void *)(skb_network_header(skb) + hdr_len); 810 - struct tcphdr *th = (void *)(skb_network_header(skb) + hdr_len); 811 - __be16 source; 810 + u8 nexthdr = ip6h->nexthdr; 811 + __be16 frag_off, source; 812 + struct udphdr *uh; 813 + struct tcphdr *th; 814 + 815 + offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off); 816 + uh = (void *)(skb->data + offset); 817 + th = (void *)(skb->data + offset); 818 + hdr_len += offset; 812 819 813 820 switch (x->encap->encap_type) { 814 821 case TCP_ENCAP_ESPINTCP:
+1
net/ipv6/ipv6_sockglue.c
··· 240 240 241 241 fl6_free_socklist(sk); 242 242 __ipv6_sock_mc_close(sk); 243 + __ipv6_sock_ac_close(sk); 243 244 244 245 /* 245 246 * Sock is moving from IPv6 to IPv4 (sk_prot), so
+4 -4
net/ipv6/route.c
··· 3685 3685 rt->fib6_src.plen = cfg->fc_src_len; 3686 3686 #endif 3687 3687 if (nh) { 3688 - if (!nexthop_get(nh)) { 3689 - NL_SET_ERR_MSG(extack, "Nexthop has been deleted"); 3690 - goto out; 3691 - } 3692 3688 if (rt->fib6_src.plen) { 3693 3689 NL_SET_ERR_MSG(extack, "Nexthops can not be used with source routing"); 3690 + goto out; 3691 + } 3692 + if (!nexthop_get(nh)) { 3693 + NL_SET_ERR_MSG(extack, "Nexthop has been deleted"); 3694 3694 goto out; 3695 3695 } 3696 3696 rt->nh = nh;
+9 -2
net/key/af_key.c
··· 1849 1849 if (ext_hdrs[SADB_X_EXT_FILTER - 1]) { 1850 1850 struct sadb_x_filter *xfilter = ext_hdrs[SADB_X_EXT_FILTER - 1]; 1851 1851 1852 + if ((xfilter->sadb_x_filter_splen >= 1853 + (sizeof(xfrm_address_t) << 3)) || 1854 + (xfilter->sadb_x_filter_dplen >= 1855 + (sizeof(xfrm_address_t) << 3))) { 1856 + mutex_unlock(&pfk->dump_lock); 1857 + return -EINVAL; 1858 + } 1852 1859 filter = kmalloc(sizeof(*filter), GFP_KERNEL); 1853 1860 if (filter == NULL) { 1854 1861 mutex_unlock(&pfk->dump_lock); ··· 2407 2400 return err; 2408 2401 } 2409 2402 2410 - xp = xfrm_policy_bysel_ctx(net, DUMMY_MARK, 0, XFRM_POLICY_TYPE_MAIN, 2403 + xp = xfrm_policy_bysel_ctx(net, &dummy_mark, 0, XFRM_POLICY_TYPE_MAIN, 2411 2404 pol->sadb_x_policy_dir - 1, &sel, pol_ctx, 2412 2405 1, &err); 2413 2406 security_xfrm_policy_free(pol_ctx); ··· 2658 2651 return -EINVAL; 2659 2652 2660 2653 delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2661 - xp = xfrm_policy_byid(net, DUMMY_MARK, 0, XFRM_POLICY_TYPE_MAIN, 2654 + xp = xfrm_policy_byid(net, &dummy_mark, 0, XFRM_POLICY_TYPE_MAIN, 2662 2655 dir, pol->sadb_x_policy_id, delete, &err); 2663 2656 if (xp == NULL) 2664 2657 return -ENOENT;
+1
net/mac80211/cfg.c
··· 2166 2166 ieee80211_stop_mesh(sdata); 2167 2167 mutex_lock(&sdata->local->mtx); 2168 2168 ieee80211_vif_release_channel(sdata); 2169 + kfree(sdata->u.mesh.ie); 2169 2170 mutex_unlock(&sdata->local->mtx); 2170 2171 2171 2172 return 0;
+13
net/mac80211/mesh.c
··· 617 617 int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata, 618 618 struct sk_buff *skb) 619 619 { 620 + struct ieee80211_supported_band *sband; 621 + const struct ieee80211_sband_iftype_data *iftd; 622 + 623 + sband = ieee80211_get_sband(sdata); 624 + if (!sband) 625 + return -EINVAL; 626 + 627 + iftd = ieee80211_get_sband_iftype_data(sband, 628 + NL80211_IFTYPE_MESH_POINT); 629 + /* The device doesn't support HE in mesh mode or at all */ 630 + if (!iftd) 631 + return 0; 632 + 620 633 ieee80211_ie_build_he_6ghz_cap(sdata, skb); 621 634 return 0; 622 635 }
+1
net/mac80211/mesh_pathtbl.c
··· 521 521 del_timer_sync(&mpath->timer); 522 522 atomic_dec(&sdata->u.mesh.mpaths); 523 523 atomic_dec(&tbl->entries); 524 + mesh_path_flush_pending(mpath); 524 525 kfree_rcu(mpath, rcu); 525 526 } 526 527
+1 -3
net/mac80211/sta_info.c
··· 1923 1923 if (sta) { 1924 1924 tx_pending = atomic_sub_return(tx_airtime, 1925 1925 &sta->airtime[ac].aql_tx_pending); 1926 - if (WARN_ONCE(tx_pending < 0, 1927 - "STA %pM AC %d txq pending airtime underflow: %u, %u", 1928 - sta->addr, ac, tx_pending, tx_airtime)) 1926 + if (tx_pending < 0) 1929 1927 atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, 1930 1928 tx_pending, 0); 1931 1929 }
+4 -3
net/mac80211/tx.c
··· 4230 4230 test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) 4231 4231 goto out_free; 4232 4232 4233 + memset(info, 0, sizeof(*info)); 4234 + 4233 4235 if (unlikely(!multicast && skb->sk && 4234 4236 skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) 4235 - ieee80211_store_ack_skb(local, skb, &info->flags, NULL); 4236 - 4237 - memset(info, 0, sizeof(*info)); 4237 + info->ack_frame_id = ieee80211_store_ack_skb(local, skb, 4238 + &info->flags, NULL); 4238 4239 4239 4240 if (unlikely(sdata->control_port_protocol == ehdr->h_proto)) { 4240 4241 if (sdata->control_port_no_encrypt)
+4
net/mac80211/util.c
··· 2878 2878 if (WARN_ON(!iftd)) 2879 2879 return; 2880 2880 2881 + /* Check for device HE 6 GHz capability before adding element */ 2882 + if (!iftd->he_6ghz_capa.capa) 2883 + return; 2884 + 2881 2885 cap = le16_to_cpu(iftd->he_6ghz_capa.capa); 2882 2886 cap &= ~IEEE80211_HE_6GHZ_CAP_SM_PS; 2883 2887
+1 -1
net/mptcp/protocol.c
··· 1833 1833 /* on successful connect, the msk state will be moved to established by 1834 1834 * subflow_finish_connect() 1835 1835 */ 1836 - if (!err || err == EINPROGRESS) 1836 + if (!err || err == -EINPROGRESS) 1837 1837 mptcp_copy_inaddrs(sock->sk, ssock->sk); 1838 1838 else 1839 1839 inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
+2 -1
net/rds/recv.c
··· 450 450 int rds_notify_queue_get(struct rds_sock *rs, struct msghdr *msghdr) 451 451 { 452 452 struct rds_notifier *notifier; 453 - struct rds_rdma_notify cmsg = { 0 }; /* fill holes with zero */ 453 + struct rds_rdma_notify cmsg; 454 454 unsigned int count = 0, max_messages = ~0U; 455 455 unsigned long flags; 456 456 LIST_HEAD(copy); 457 457 int err = 0; 458 458 459 + memset(&cmsg, 0, sizeof(cmsg)); /* fill holes with zero */ 459 460 460 461 /* put_cmsg copies to user space and thus may sleep. We can't do this 461 462 * with rs_lock held, so first grab as many notifications as we can stuff
+19 -8
net/rxrpc/call_object.c
··· 288 288 */ 289 289 ret = rxrpc_connect_call(rx, call, cp, srx, gfp); 290 290 if (ret < 0) 291 - goto error; 291 + goto error_attached_to_socket; 292 292 293 293 trace_rxrpc_call(call->debug_id, rxrpc_call_connected, 294 294 atomic_read(&call->usage), here, NULL); ··· 308 308 error_dup_user_ID: 309 309 write_unlock(&rx->call_lock); 310 310 release_sock(&rx->sk); 311 - ret = -EEXIST; 312 - 313 - error: 314 311 __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 315 - RX_CALL_DEAD, ret); 312 + RX_CALL_DEAD, -EEXIST); 316 313 trace_rxrpc_call(call->debug_id, rxrpc_call_error, 317 - atomic_read(&call->usage), here, ERR_PTR(ret)); 314 + atomic_read(&call->usage), here, ERR_PTR(-EEXIST)); 318 315 rxrpc_release_call(rx, call); 319 316 mutex_unlock(&call->user_mutex); 320 317 rxrpc_put_call(call, rxrpc_call_put); 321 - _leave(" = %d", ret); 322 - return ERR_PTR(ret); 318 + _leave(" = -EEXIST"); 319 + return ERR_PTR(-EEXIST); 320 + 321 + /* We got an error, but the call is attached to the socket and is in 322 + * need of release. However, we might now race with recvmsg() when 323 + * completing the call queues it. Return 0 from sys_sendmsg() and 324 + * leave the error to recvmsg() to deal with. 325 + */ 326 + error_attached_to_socket: 327 + trace_rxrpc_call(call->debug_id, rxrpc_call_error, 328 + atomic_read(&call->usage), here, ERR_PTR(ret)); 329 + set_bit(RXRPC_CALL_DISCONNECTED, &call->flags); 330 + __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 331 + RX_CALL_DEAD, ret); 332 + _leave(" = c=%08x [err]", call->debug_id); 333 + return call; 323 334 } 324 335 325 336 /*
+5 -3
net/rxrpc/conn_object.c
··· 212 212 213 213 call->peer->cong_cwnd = call->cong_cwnd; 214 214 215 - spin_lock_bh(&conn->params.peer->lock); 216 - hlist_del_rcu(&call->error_link); 217 - spin_unlock_bh(&conn->params.peer->lock); 215 + if (!hlist_unhashed(&call->error_link)) { 216 + spin_lock_bh(&call->peer->lock); 217 + hlist_del_rcu(&call->error_link); 218 + spin_unlock_bh(&call->peer->lock); 219 + } 218 220 219 221 if (rxrpc_is_client_call(call)) 220 222 return rxrpc_disconnect_client_call(call);
+1 -1
net/rxrpc/recvmsg.c
··· 620 620 goto error_unlock_call; 621 621 } 622 622 623 - if (msg->msg_name) { 623 + if (msg->msg_name && call->peer) { 624 624 struct sockaddr_rxrpc *srx = msg->msg_name; 625 625 size_t len = sizeof(call->peer->srx); 626 626
+3
net/rxrpc/sendmsg.c
··· 681 681 if (IS_ERR(call)) 682 682 return PTR_ERR(call); 683 683 /* ... and we have the call lock. */ 684 + ret = 0; 685 + if (READ_ONCE(call->state) == RXRPC_CALL_COMPLETE) 686 + goto out_put_unlock; 684 687 } else { 685 688 switch (READ_ONCE(call->state)) { 686 689 case RXRPC_CALL_UNINITIALISED:
+2 -2
net/sched/act_ct.c
··· 1543 1543 1544 1544 return 0; 1545 1545 1546 - err_tbl_init: 1547 - destroy_workqueue(act_ct_wq); 1548 1546 err_register: 1549 1547 tcf_ct_flow_tables_uninit(); 1548 + err_tbl_init: 1549 + destroy_workqueue(act_ct_wq); 1550 1550 return err; 1551 1551 } 1552 1552
+3 -3
net/wireless/nl80211.c
··· 13266 13266 if (!wdev_running(wdev)) 13267 13267 return -ENETDOWN; 13268 13268 } 13269 - 13270 - if (!vcmd->doit) 13271 - return -EOPNOTSUPP; 13272 13269 } else { 13273 13270 wdev = NULL; 13274 13271 } 13272 + 13273 + if (!vcmd->doit) 13274 + return -EOPNOTSUPP; 13275 13275 13276 13276 if (info->attrs[NL80211_ATTR_VENDOR_DATA]) { 13277 13277 data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]);
+47 -15
net/xfrm/espintcp.c
··· 15 15 { 16 16 if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf || 17 17 !sk_rmem_schedule(sk, skb, skb->truesize)) { 18 + XFRM_INC_STATS(sock_net(sk), LINUX_MIB_XFRMINERROR); 18 19 kfree_skb(skb); 19 20 return; 20 21 } ··· 50 49 struct espintcp_ctx *ctx = container_of(strp, struct espintcp_ctx, 51 50 strp); 52 51 struct strp_msg *rxm = strp_msg(skb); 52 + int len = rxm->full_len - 2; 53 53 u32 nonesp_marker; 54 54 int err; 55 + 56 + /* keepalive packet? */ 57 + if (unlikely(len == 1)) { 58 + u8 data; 59 + 60 + err = skb_copy_bits(skb, rxm->offset + 2, &data, 1); 61 + if (err < 0) { 62 + XFRM_INC_STATS(sock_net(strp->sk), LINUX_MIB_XFRMINHDRERROR); 63 + kfree_skb(skb); 64 + return; 65 + } 66 + 67 + if (data == 0xff) { 68 + kfree_skb(skb); 69 + return; 70 + } 71 + } 72 + 73 + /* drop other short messages */ 74 + if (unlikely(len <= sizeof(nonesp_marker))) { 75 + XFRM_INC_STATS(sock_net(strp->sk), LINUX_MIB_XFRMINHDRERROR); 76 + kfree_skb(skb); 77 + return; 78 + } 55 79 56 80 err = skb_copy_bits(skb, rxm->offset + 2, &nonesp_marker, 57 81 sizeof(nonesp_marker)); 58 82 if (err < 0) { 83 + XFRM_INC_STATS(sock_net(strp->sk), LINUX_MIB_XFRMINHDRERROR); 59 84 kfree_skb(skb); 60 85 return; 61 86 } 62 87 63 88 /* remove header, leave non-ESP marker/SPI */ 64 89 if (!__pskb_pull(skb, rxm->offset + 2)) { 90 + XFRM_INC_STATS(sock_net(strp->sk), LINUX_MIB_XFRMINERROR); 65 91 kfree_skb(skb); 66 92 return; 67 93 } 68 94 69 95 if (pskb_trim(skb, rxm->full_len - 2) != 0) { 96 + XFRM_INC_STATS(sock_net(strp->sk), LINUX_MIB_XFRMINERROR); 70 97 kfree_skb(skb); 71 98 return; 72 99 } ··· 120 91 return err; 121 92 122 93 len = be16_to_cpu(blen); 123 - if (len < 6) 94 + if (len < 2) 124 95 return -EINVAL; 125 96 126 97 return len; ··· 138 109 flags |= nonblock ? MSG_DONTWAIT : 0; 139 110 140 111 skb = __skb_recv_datagram(sk, &ctx->ike_queue, flags, &off, &err); 141 - if (!skb) 112 + if (!skb) { 113 + if (err == -EAGAIN && sk->sk_shutdown & RCV_SHUTDOWN) 114 + return 0; 142 115 return err; 116 + } 143 117 144 118 copied = len; 145 119 if (copied > skb->len) ··· 245 213 return 0; 246 214 } 247 215 248 - static int espintcp_push_msgs(struct sock *sk) 216 + static int espintcp_push_msgs(struct sock *sk, int flags) 249 217 { 250 218 struct espintcp_ctx *ctx = espintcp_getctx(sk); 251 219 struct espintcp_msg *emsg = &ctx->partial; ··· 259 227 ctx->tx_running = 1; 260 228 261 229 if (emsg->skb) 262 - err = espintcp_sendskb_locked(sk, emsg, 0); 230 + err = espintcp_sendskb_locked(sk, emsg, flags); 263 231 else 264 - err = espintcp_sendskmsg_locked(sk, emsg, 0); 232 + err = espintcp_sendskmsg_locked(sk, emsg, flags); 265 233 if (err == -EAGAIN) { 266 234 ctx->tx_running = 0; 267 - return 0; 235 + return flags & MSG_DONTWAIT ? -EAGAIN : 0; 268 236 } 269 237 if (!err) 270 238 memset(emsg, 0, sizeof(*emsg)); ··· 289 257 offset = skb_transport_offset(skb); 290 258 len = skb->len - offset; 291 259 292 - espintcp_push_msgs(sk); 260 + espintcp_push_msgs(sk, 0); 293 261 294 262 if (emsg->len) { 295 263 kfree_skb(skb); ··· 302 270 emsg->len = len; 303 271 emsg->skb = skb; 304 272 305 - espintcp_push_msgs(sk); 273 + espintcp_push_msgs(sk, 0); 306 274 307 275 return 0; 308 276 } ··· 319 287 char buf[2] = {0}; 320 288 int err, end; 321 289 322 - if (msg->msg_flags) 290 + if (msg->msg_flags & ~MSG_DONTWAIT) 323 291 return -EOPNOTSUPP; 324 292 325 293 if (size > MAX_ESPINTCP_MSG) ··· 330 298 331 299 lock_sock(sk); 332 300 333 - err = espintcp_push_msgs(sk); 301 + err = espintcp_push_msgs(sk, msg->msg_flags & MSG_DONTWAIT); 334 302 if (err < 0) { 335 - err = -ENOBUFS; 303 + if (err != -EAGAIN || !(msg->msg_flags & MSG_DONTWAIT)) 304 + err = -ENOBUFS; 336 305 goto unlock; 337 306 } 338 307 ··· 370 337 371 338 tcp_rate_check_app_limited(sk); 372 339 373 - err = espintcp_push_msgs(sk); 340 + err = espintcp_push_msgs(sk, msg->msg_flags & MSG_DONTWAIT); 374 341 /* this message could be partially sent, keep it */ 375 - if (err < 0) 376 - goto unlock; 342 + 377 343 release_sock(sk); 378 344 379 345 return size; ··· 406 374 407 375 lock_sock(sk); 408 376 if (!ctx->tx_running) 409 - espintcp_push_msgs(sk); 377 + espintcp_push_msgs(sk, 0); 410 378 release_sock(sk); 411 379 } 412 380
+18 -25
net/xfrm/xfrm_policy.c
··· 39 39 #ifdef CONFIG_XFRM_STATISTICS 40 40 #include <net/snmp.h> 41 41 #endif 42 - #ifdef CONFIG_INET_ESPINTCP 42 + #ifdef CONFIG_XFRM_ESPINTCP 43 43 #include <net/espintcp.h> 44 44 #endif 45 45 ··· 1433 1433 spin_unlock_bh(&pq->hold_queue.lock); 1434 1434 } 1435 1435 1436 - static bool xfrm_policy_mark_match(struct xfrm_policy *policy, 1437 - struct xfrm_policy *pol) 1436 + static inline bool xfrm_policy_mark_match(const struct xfrm_mark *mark, 1437 + struct xfrm_policy *pol) 1438 1438 { 1439 - if (policy->mark.v == pol->mark.v && 1440 - policy->priority == pol->priority) 1441 - return true; 1442 - 1443 - return false; 1439 + return mark->v == pol->mark.v && mark->m == pol->mark.m; 1444 1440 } 1445 1441 1446 1442 static u32 xfrm_pol_bin_key(const void *data, u32 len, u32 seed) ··· 1499 1503 if (pol->type == policy->type && 1500 1504 pol->if_id == policy->if_id && 1501 1505 !selector_cmp(&pol->selector, &policy->selector) && 1502 - xfrm_policy_mark_match(policy, pol) && 1506 + xfrm_policy_mark_match(&policy->mark, pol) && 1503 1507 xfrm_sec_ctx_match(pol->security, policy->security) && 1504 1508 !WARN_ON(delpol)) { 1505 1509 delpol = pol; ··· 1534 1538 if (pol->type == policy->type && 1535 1539 pol->if_id == policy->if_id && 1536 1540 !selector_cmp(&pol->selector, &policy->selector) && 1537 - xfrm_policy_mark_match(policy, pol) && 1541 + xfrm_policy_mark_match(&policy->mark, pol) && 1538 1542 xfrm_sec_ctx_match(pol->security, policy->security) && 1539 1543 !WARN_ON(delpol)) { 1540 1544 if (excl) ··· 1606 1610 EXPORT_SYMBOL(xfrm_policy_insert); 1607 1611 1608 1612 static struct xfrm_policy * 1609 - __xfrm_policy_bysel_ctx(struct hlist_head *chain, u32 mark, u32 if_id, 1610 - u8 type, int dir, 1611 - struct xfrm_selector *sel, 1613 + __xfrm_policy_bysel_ctx(struct hlist_head *chain, const struct xfrm_mark *mark, 1614 + u32 if_id, u8 type, int dir, struct xfrm_selector *sel, 1612 1615 struct xfrm_sec_ctx *ctx) 1613 1616 { 1614 1617 struct xfrm_policy *pol; ··· 1618 1623 hlist_for_each_entry(pol, chain, bydst) { 1619 1624 if (pol->type == type && 1620 1625 pol->if_id == if_id && 1621 - (mark & pol->mark.m) == pol->mark.v && 1626 + xfrm_policy_mark_match(mark, pol) && 1622 1627 !selector_cmp(sel, &pol->selector) && 1623 1628 xfrm_sec_ctx_match(ctx, pol->security)) 1624 1629 return pol; ··· 1627 1632 return NULL; 1628 1633 } 1629 1634 1630 - struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, u32 if_id, 1631 - u8 type, int dir, 1632 - struct xfrm_selector *sel, 1633 - struct xfrm_sec_ctx *ctx, int delete, 1634 - int *err) 1635 + struct xfrm_policy * 1636 + xfrm_policy_bysel_ctx(struct net *net, const struct xfrm_mark *mark, u32 if_id, 1637 + u8 type, int dir, struct xfrm_selector *sel, 1638 + struct xfrm_sec_ctx *ctx, int delete, int *err) 1635 1639 { 1636 1640 struct xfrm_pol_inexact_bin *bin = NULL; 1637 1641 struct xfrm_policy *pol, *ret = NULL; ··· 1697 1703 } 1698 1704 EXPORT_SYMBOL(xfrm_policy_bysel_ctx); 1699 1705 1700 - struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u32 if_id, 1701 - u8 type, int dir, u32 id, int delete, 1702 - int *err) 1706 + struct xfrm_policy * 1707 + xfrm_policy_byid(struct net *net, const struct xfrm_mark *mark, u32 if_id, 1708 + u8 type, int dir, u32 id, int delete, int *err) 1703 1709 { 1704 1710 struct xfrm_policy *pol, *ret; 1705 1711 struct hlist_head *chain; ··· 1714 1720 ret = NULL; 1715 1721 hlist_for_each_entry(pol, chain, byidx) { 1716 1722 if (pol->type == type && pol->index == id && 1717 - pol->if_id == if_id && 1718 - (mark & pol->mark.m) == pol->mark.v) { 1723 + pol->if_id == if_id && xfrm_policy_mark_match(mark, pol)) { 1719 1724 xfrm_pol_hold(pol); 1720 1725 if (delete) { 1721 1726 *err = security_xfrm_policy_delete( ··· 4149 4156 seqcount_init(&xfrm_policy_hash_generation); 4150 4157 xfrm_input_init(); 4151 4158 4152 - #ifdef CONFIG_INET_ESPINTCP 4159 + #ifdef CONFIG_XFRM_ESPINTCP 4153 4160 espintcp_init(); 4154 4161 #endif 4155 4162
+11 -7
net/xfrm/xfrm_user.c
··· 1863 1863 struct km_event c; 1864 1864 int delete; 1865 1865 struct xfrm_mark m; 1866 - u32 mark = xfrm_mark_get(attrs, &m); 1867 1866 u32 if_id = 0; 1868 1867 1869 1868 p = nlmsg_data(nlh); ··· 1879 1880 if (attrs[XFRMA_IF_ID]) 1880 1881 if_id = nla_get_u32(attrs[XFRMA_IF_ID]); 1881 1882 1883 + xfrm_mark_get(attrs, &m); 1884 + 1882 1885 if (p->index) 1883 - xp = xfrm_policy_byid(net, mark, if_id, type, p->dir, p->index, delete, &err); 1886 + xp = xfrm_policy_byid(net, &m, if_id, type, p->dir, 1887 + p->index, delete, &err); 1884 1888 else { 1885 1889 struct nlattr *rt = attrs[XFRMA_SEC_CTX]; 1886 1890 struct xfrm_sec_ctx *ctx; ··· 1900 1898 if (err) 1901 1899 return err; 1902 1900 } 1903 - xp = xfrm_policy_bysel_ctx(net, mark, if_id, type, p->dir, &p->sel, 1904 - ctx, delete, &err); 1901 + xp = xfrm_policy_bysel_ctx(net, &m, if_id, type, p->dir, 1902 + &p->sel, ctx, delete, &err); 1905 1903 security_xfrm_policy_free(ctx); 1906 1904 } 1907 1905 if (xp == NULL) ··· 2168 2166 u8 type = XFRM_POLICY_TYPE_MAIN; 2169 2167 int err = -ENOENT; 2170 2168 struct xfrm_mark m; 2171 - u32 mark = xfrm_mark_get(attrs, &m); 2172 2169 u32 if_id = 0; 2173 2170 2174 2171 err = copy_from_user_policy_type(&type, attrs); ··· 2181 2180 if (attrs[XFRMA_IF_ID]) 2182 2181 if_id = nla_get_u32(attrs[XFRMA_IF_ID]); 2183 2182 2183 + xfrm_mark_get(attrs, &m); 2184 + 2184 2185 if (p->index) 2185 - xp = xfrm_policy_byid(net, mark, if_id, type, p->dir, p->index, 0, &err); 2186 + xp = xfrm_policy_byid(net, &m, if_id, type, p->dir, p->index, 2187 + 0, &err); 2186 2188 else { 2187 2189 struct nlattr *rt = attrs[XFRMA_SEC_CTX]; 2188 2190 struct xfrm_sec_ctx *ctx; ··· 2202 2198 if (err) 2203 2199 return err; 2204 2200 } 2205 - xp = xfrm_policy_bysel_ctx(net, mark, if_id, type, p->dir, 2201 + xp = xfrm_policy_bysel_ctx(net, &m, if_id, type, p->dir, 2206 2202 &p->sel, ctx, 0, &err); 2207 2203 security_xfrm_policy_free(ctx); 2208 2204 }
+110 -14
tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c
··· 5 5 6 6 #include "test_btf_map_in_map.skel.h" 7 7 8 + static int duration; 9 + 10 + static __u32 bpf_map_id(struct bpf_map *map) 11 + { 12 + struct bpf_map_info info; 13 + __u32 info_len = sizeof(info); 14 + int err; 15 + 16 + memset(&info, 0, info_len); 17 + err = bpf_obj_get_info_by_fd(bpf_map__fd(map), &info, &info_len); 18 + if (err) 19 + return 0; 20 + return info.id; 21 + } 22 + 23 + /* 24 + * Trigger synchronize_rcu() in kernel. 25 + * 26 + * ARRAY_OF_MAPS/HASH_OF_MAPS lookup/update operations trigger synchronize_rcu() 27 + * if looking up an existing non-NULL element or updating the map with a valid 28 + * inner map FD. Use this fact to trigger synchronize_rcu(): create map-in-map, 29 + * create a trivial ARRAY map, update map-in-map with ARRAY inner map. Then 30 + * cleanup. At the end, at least one synchronize_rcu() would be called. 31 + */ 32 + static int kern_sync_rcu(void) 33 + { 34 + int inner_map_fd, outer_map_fd, err, zero = 0; 35 + 36 + inner_map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, 4, 4, 1, 0); 37 + if (CHECK(inner_map_fd < 0, "inner_map_create", "failed %d\n", -errno)) 38 + return -1; 39 + 40 + outer_map_fd = bpf_create_map_in_map(BPF_MAP_TYPE_ARRAY_OF_MAPS, NULL, 41 + sizeof(int), inner_map_fd, 1, 0); 42 + if (CHECK(outer_map_fd < 0, "outer_map_create", "failed %d\n", -errno)) { 43 + close(inner_map_fd); 44 + return -1; 45 + } 46 + 47 + err = bpf_map_update_elem(outer_map_fd, &zero, &inner_map_fd, 0); 48 + if (err) 49 + err = -errno; 50 + CHECK(err, "outer_map_update", "failed %d\n", err); 51 + close(inner_map_fd); 52 + close(outer_map_fd); 53 + return err; 54 + } 55 + 8 56 void test_btf_map_in_map(void) 9 57 { 10 - int duration = 0, err, key = 0, val; 11 - struct test_btf_map_in_map* skel; 58 + int err, key = 0, val, i; 59 + struct test_btf_map_in_map *skel; 60 + int outer_arr_fd, outer_hash_fd; 61 + int fd, map1_fd, map2_fd, map1_id, map2_id; 12 62 13 63 skel = test_btf_map_in_map__open_and_load(); 14 64 if (CHECK(!skel, "skel_open", "failed to open&load skeleton\n")) ··· 68 18 if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err)) 69 19 goto cleanup; 70 20 21 + map1_fd = bpf_map__fd(skel->maps.inner_map1); 22 + map2_fd = bpf_map__fd(skel->maps.inner_map2); 23 + outer_arr_fd = bpf_map__fd(skel->maps.outer_arr); 24 + outer_hash_fd = bpf_map__fd(skel->maps.outer_hash); 25 + 71 26 /* inner1 = input, inner2 = input + 1 */ 72 - val = bpf_map__fd(skel->maps.inner_map1); 73 - bpf_map_update_elem(bpf_map__fd(skel->maps.outer_arr), &key, &val, 0); 74 - val = bpf_map__fd(skel->maps.inner_map2); 75 - bpf_map_update_elem(bpf_map__fd(skel->maps.outer_hash), &key, &val, 0); 27 + map1_fd = bpf_map__fd(skel->maps.inner_map1); 28 + bpf_map_update_elem(outer_arr_fd, &key, &map1_fd, 0); 29 + map2_fd = bpf_map__fd(skel->maps.inner_map2); 30 + bpf_map_update_elem(outer_hash_fd, &key, &map2_fd, 0); 76 31 skel->bss->input = 1; 77 32 usleep(1); 78 33 79 - bpf_map_lookup_elem(bpf_map__fd(skel->maps.inner_map1), &key, &val); 34 + bpf_map_lookup_elem(map1_fd, &key, &val); 80 35 CHECK(val != 1, "inner1", "got %d != exp %d\n", val, 1); 81 - bpf_map_lookup_elem(bpf_map__fd(skel->maps.inner_map2), &key, &val); 36 + bpf_map_lookup_elem(map2_fd, &key, &val); 82 37 CHECK(val != 2, "inner2", "got %d != exp %d\n", val, 2); 83 38 84 39 /* inner1 = input + 1, inner2 = input */ 85 - val = bpf_map__fd(skel->maps.inner_map2); 86 - bpf_map_update_elem(bpf_map__fd(skel->maps.outer_arr), &key, &val, 0); 87 - val = bpf_map__fd(skel->maps.inner_map1); 88 - bpf_map_update_elem(bpf_map__fd(skel->maps.outer_hash), &key, &val, 0); 40 + bpf_map_update_elem(outer_arr_fd, &key, &map2_fd, 0); 41 + bpf_map_update_elem(outer_hash_fd, &key, &map1_fd, 0); 89 42 skel->bss->input = 3; 90 43 usleep(1); 91 44 92 - bpf_map_lookup_elem(bpf_map__fd(skel->maps.inner_map1), &key, &val); 45 + bpf_map_lookup_elem(map1_fd, &key, &val); 93 46 CHECK(val != 4, "inner1", "got %d != exp %d\n", val, 4); 94 - bpf_map_lookup_elem(bpf_map__fd(skel->maps.inner_map2), &key, &val); 47 + bpf_map_lookup_elem(map2_fd, &key, &val); 95 48 CHECK(val != 3, "inner2", "got %d != exp %d\n", val, 3); 49 + 50 + for (i = 0; i < 5; i++) { 51 + val = i % 2 ? map1_fd : map2_fd; 52 + err = bpf_map_update_elem(outer_hash_fd, &key, &val, 0); 53 + if (CHECK_FAIL(err)) { 54 + printf("failed to update hash_of_maps on iter #%d\n", i); 55 + goto cleanup; 56 + } 57 + err = bpf_map_update_elem(outer_arr_fd, &key, &val, 0); 58 + if (CHECK_FAIL(err)) { 59 + printf("failed to update hash_of_maps on iter #%d\n", i); 60 + goto cleanup; 61 + } 62 + } 63 + 64 + map1_id = bpf_map_id(skel->maps.inner_map1); 65 + map2_id = bpf_map_id(skel->maps.inner_map2); 66 + CHECK(map1_id == 0, "map1_id", "failed to get ID 1\n"); 67 + CHECK(map2_id == 0, "map2_id", "failed to get ID 2\n"); 68 + 69 + test_btf_map_in_map__destroy(skel); 70 + skel = NULL; 71 + 72 + /* we need to either wait for or force synchronize_rcu(), before 73 + * checking for "still exists" condition, otherwise map could still be 74 + * resolvable by ID, causing false positives. 75 + * 76 + * Older kernels (5.8 and earlier) freed map only after two 77 + * synchronize_rcu()s, so trigger two, to be entirely sure. 78 + */ 79 + CHECK(kern_sync_rcu(), "sync_rcu", "failed\n"); 80 + CHECK(kern_sync_rcu(), "sync_rcu", "failed\n"); 81 + 82 + fd = bpf_map_get_fd_by_id(map1_id); 83 + if (CHECK(fd >= 0, "map1_leak", "inner_map1 leaked!\n")) { 84 + close(fd); 85 + goto cleanup; 86 + } 87 + fd = bpf_map_get_fd_by_id(map2_id); 88 + if (CHECK(fd >= 0, "map2_leak", "inner_map2 leaked!\n")) { 89 + close(fd); 90 + goto cleanup; 91 + } 96 92 97 93 cleanup: 98 94 test_btf_map_in_map__destroy(skel);
+3
tools/testing/selftests/bpf/test_offload.py
··· 318 318 continue 319 319 320 320 if os.path.isfile(p): 321 + # We need to init trap_flow_action_cookie before read it 322 + if f == "trap_flow_action_cookie": 323 + cmd('echo deadbeef > %s/%s' % (path, f)) 321 324 _, out = cmd('cat %s/%s' % (path, f)) 322 325 dfs[f] = out.strip() 323 326 elif os.path.isdir(p):
+1
tools/testing/selftests/bpf/verifier/event_output.c
··· 112 112 "perfevent for cgroup sockopt", 113 113 .insns = { __PERF_EVENT_INSNS__ }, 114 114 .prog_type = BPF_PROG_TYPE_CGROUP_SOCKOPT, 115 + .expected_attach_type = BPF_CGROUP_SETSOCKOPT, 115 116 .fixup_map_event_output = { 4 }, 116 117 .result = ACCEPT, 117 118 .retval = 1,
-2
tools/testing/selftests/net/forwarding/ethtool.sh
··· 252 252 fi 253 253 254 254 local -a speeds_arr=($(common_speeds_get $h1 $h2 0 1)) 255 - # Remove the first speed, h1 does not advertise this speed. 256 - unset speeds_arr[0] 257 255 258 256 max_speed=${speeds_arr[0]} 259 257 for current in ${speeds_arr[@]}; do
+2 -1
tools/testing/selftests/net/psock_fanout.c
··· 350 350 int fds[2], fds_udp[2][2], ret; 351 351 352 352 fprintf(stderr, "\ntest: datapath 0x%hx ports %hu,%hu\n", 353 - typeflags, PORT_BASE, PORT_BASE + port_off); 353 + typeflags, (uint16_t)PORT_BASE, 354 + (uint16_t)(PORT_BASE + port_off)); 354 355 355 356 fds[0] = sock_fanout_open(typeflags, 0); 356 357 fds[1] = sock_fanout_open(typeflags, 0);
+1 -2
tools/testing/selftests/net/rxtimestamp.c
··· 329 329 bool all_tests = true; 330 330 int arg_index = 0; 331 331 int failures = 0; 332 - int s, t; 333 - char opt; 332 + int s, t, opt; 334 333 335 334 while ((opt = getopt_long(argc, argv, "", long_options, 336 335 &arg_index)) != -1) {
+1 -1
tools/testing/selftests/net/so_txtime.c
··· 121 121 if (rbuf[0] != ts->data) 122 122 error(1, 0, "payload mismatch. expected %c", ts->data); 123 123 124 - if (labs(tstop - texpect) > cfg_variance_us) 124 + if (llabs(tstop - texpect) > cfg_variance_us) 125 125 error(1, 0, "exceeds variance (%d us)", cfg_variance_us); 126 126 127 127 return false;
+3 -3
tools/testing/selftests/net/tcp_mmap.c
··· 344 344 { 345 345 struct sockaddr_storage listenaddr, addr; 346 346 unsigned int max_pacing_rate = 0; 347 - size_t total = 0; 347 + uint64_t total = 0; 348 348 char *host = NULL; 349 349 int fd, c, on = 1; 350 350 char *buffer; ··· 473 473 zflg = 0; 474 474 } 475 475 while (total < FILE_SZ) { 476 - ssize_t wr = FILE_SZ - total; 476 + int64_t wr = FILE_SZ - total; 477 477 478 478 if (wr > chunk_size) 479 479 wr = chunk_size; 480 480 /* Note : we just want to fill the pipe with 0 bytes */ 481 - wr = send(fd, buffer, wr, zflg ? MSG_ZEROCOPY : 0); 481 + wr = send(fd, buffer, (size_t)wr, zflg ? MSG_ZEROCOPY : 0); 482 482 if (wr <= 0) 483 483 break; 484 484 total += wr;