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

Configure Feed

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

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

Pull networking fixes from Jakub Kicinski:
"Including fixes from wireless and netfilter.

We haven't accumulated much over the break. If it wasn't for the
uninterrupted stream of fixes for Intel drivers this PR would be very
slim. There was a handful of user reports, however, either they stood
out because of the lower traffic or users have had more time to test
over the break. The ones which are v6.7-relevant should be wrapped up.

Current release - regressions:

- Revert "net: ipv6/addrconf: clamp preferred_lft to the minimum
required", it caused issues on networks where routers send prefixes
with preferred_lft=0

- wifi:
- iwlwifi: pcie: don't synchronize IRQs from IRQ, prevent deadlock
- mac80211: fix re-adding debugfs entries during reconfiguration

Current release - new code bugs:

- tcp: print AO/MD5 messages only if there are any keys

Previous releases - regressions:

- virtio_net: fix missing dma unmap for resize, prevent OOM

Previous releases - always broken:

- mptcp: prevent tcp diag from closing listener subflows

- nf_tables:
- set transport header offset for egress hook, fix IPv4 mangling
- skip set commit for deleted/destroyed sets, avoid double deactivation

- nat: make sure action is set for all ct states, fix openvswitch
matching on ICMP packets in related state

- eth: mlxbf_gige: fix receive hang under heavy traffic

- eth: r8169: fix PCI error on system resume for RTL8168FP

- net: add missing getsockopt(SO_TIMESTAMPING_NEW) and cmsg handling"

* tag 'net-6.7-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (52 commits)
net/tcp: Only produce AO/MD5 logs if there are any keys
net: Implement missing SO_TIMESTAMPING_NEW cmsg support
bnxt_en: Remove mis-applied code from bnxt_cfg_ntp_filters()
net: ravb: Wait for operating mode to be applied
asix: Add check for usbnet_get_endpoints
octeontx2-af: Re-enable MAC TX in otx2_stop processing
octeontx2-af: Always configure NIX TX link credits based on max frame size
net/smc: fix invalid link access in dumping SMC-R connections
net/qla3xxx: fix potential memleak in ql_alloc_buffer_queues
virtio_net: fix missing dma unmap for resize
igc: Fix hicredit calculation
ice: fix Get link status data length
i40e: Restore VF MSI-X state during PCI reset
i40e: fix use-after-free in i40e_aqc_add_filters()
net: Save and restore msg_namelen in sock_sendmsg
netfilter: nft_immediate: drop chain reference counter on error
netfilter: nf_nat: fix action not being set for all ct states
net: bcmgenet: Fix FCS generation for fragmented skbuffs
mptcp: prevent tcp diag from closing listener subflows
MAINTAINERS: add Geliang as reviewer for MPTCP
...

+373 -260
+1 -1
Documentation/networking/ip-sysctl.rst
··· 2511 2511 temp_prefered_lft - INTEGER 2512 2512 Preferred lifetime (in seconds) for temporary addresses. If 2513 2513 temp_prefered_lft is less than the minimum required lifetime (typically 2514 - 5 seconds), the preferred lifetime is the minimum required. If 2514 + 5 seconds), temporary addresses will not be created. If 2515 2515 temp_prefered_lft is greater than temp_valid_lft, the preferred lifetime 2516 2516 is temp_valid_lft. 2517 2517
+3 -3
MAINTAINERS
··· 4127 4127 M: Hante Meuleman <hante.meuleman@broadcom.com> 4128 4128 L: linux-wireless@vger.kernel.org 4129 4129 L: brcm80211-dev-list.pdl@broadcom.com 4130 - L: SHA-cyfmac-dev-list@infineon.com 4131 4130 S: Supported 4132 4131 F: drivers/net/wireless/broadcom/brcm80211/ 4133 4132 ··· 12823 12824 F: drivers/net/ethernet/marvell/mvneta.* 12824 12825 12825 12826 MARVELL MVPP2 ETHERNET DRIVER 12826 - M: Marcin Wojtas <mw@semihalf.com> 12827 + M: Marcin Wojtas <marcin.s.wojtas@gmail.com> 12827 12828 M: Russell King <linux@armlinux.org.uk> 12828 12829 L: netdev@vger.kernel.org 12829 12830 S: Maintained ··· 15086 15087 NETWORKING [MPTCP] 15087 15088 M: Matthieu Baerts <matttbe@kernel.org> 15088 15089 M: Mat Martineau <martineau@kernel.org> 15090 + R: Geliang Tang <geliang.tang@linux.dev> 15089 15091 L: netdev@vger.kernel.org 15090 15092 L: mptcp@lists.linux.dev 15091 15093 S: Maintained ··· 15434 15434 F: drivers/bluetooth/btnxpuart.c 15435 15435 15436 15436 NXP C45 TJA11XX PHY DRIVER 15437 - M: Radu Pirea <radu-nicolae.pirea@oss.nxp.com> 15437 + M: Andrei Botila <andrei.botila@oss.nxp.com> 15438 15438 L: netdev@vger.kernel.org 15439 15439 S: Maintained 15440 15440 F: drivers/net/phy/nxp-c45-tja11xx.c
+3 -2
drivers/connector/cn_proc.c
··· 108 108 filter_data[1] = 0; 109 109 } 110 110 111 - cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, 112 - cn_filter, (void *)filter_data); 111 + if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, 112 + cn_filter, (void *)filter_data) == -ESRCH) 113 + atomic_set(&proc_event_num_listeners, 0); 113 114 114 115 local_unlock(&local_event.lock); 115 116 }
+2 -2
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 12093 12093 bnxt_cfg_ntp_filters(bp); 12094 12094 if (test_and_clear_bit(BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT, &bp->sp_event)) 12095 12095 bnxt_hwrm_exec_fwd_req(bp); 12096 + if (test_and_clear_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event)) 12097 + netdev_info(bp->dev, "Receive PF driver unload event!\n"); 12096 12098 if (test_and_clear_bit(BNXT_PERIODIC_STATS_SP_EVENT, &bp->sp_event)) { 12097 12099 bnxt_hwrm_port_qstats(bp, 0); 12098 12100 bnxt_hwrm_port_qstats_ext(bp, 0); ··· 13095 13093 } 13096 13094 } 13097 13095 } 13098 - if (test_and_clear_bit(BNXT_HWRM_PF_UNLOAD_SP_EVENT, &bp->sp_event)) 13099 - netdev_info(bp->dev, "Receive PF driver unload event!\n"); 13100 13096 } 13101 13097 13102 13098 #else
+3 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 2132 2132 /* Note: if we ever change from DMA_TX_APPEND_CRC below we 2133 2133 * will need to restore software padding of "runt" packets 2134 2134 */ 2135 + len_stat |= DMA_TX_APPEND_CRC; 2136 + 2135 2137 if (!i) { 2136 - len_stat |= DMA_TX_APPEND_CRC | DMA_SOP; 2138 + len_stat |= DMA_SOP; 2137 2139 if (skb->ip_summed == CHECKSUM_PARTIAL) 2138 2140 len_stat |= DMA_TX_DO_CSUM; 2139 2141 }
+10 -1
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 107 107 static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f, 108 108 struct net_device *netdev, int delta) 109 109 { 110 + struct netdev_hw_addr_list *ha_list; 110 111 struct netdev_hw_addr *ha; 111 112 112 113 if (!f || !netdev) 113 114 return; 114 115 115 - netdev_for_each_mc_addr(ha, netdev) { 116 + if (is_unicast_ether_addr(f->macaddr) || is_link_local_ether_addr(f->macaddr)) 117 + ha_list = &netdev->uc; 118 + else 119 + ha_list = &netdev->mc; 120 + 121 + netdev_hw_addr_list_for_each(ha, ha_list) { 116 122 if (ether_addr_equal(ha->addr, f->macaddr)) { 117 123 ha->refcount += delta; 118 124 if (ha->refcount <= 0) ··· 16518 16512 return; 16519 16513 16520 16514 i40e_reset_and_rebuild(pf, false, false); 16515 + #ifdef CONFIG_PCI_IOV 16516 + i40e_restore_all_vfs_msi_state(pdev); 16517 + #endif /* CONFIG_PCI_IOV */ 16521 16518 } 16522 16519 16523 16520 /**
+30 -4
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 154 154 (u8 *)&pfe, sizeof(struct virtchnl_pf_event)); 155 155 } 156 156 157 + #ifdef CONFIG_PCI_IOV 158 + void i40e_restore_all_vfs_msi_state(struct pci_dev *pdev) 159 + { 160 + u16 vf_id; 161 + u16 pos; 162 + 163 + /* Continue only if this is a PF */ 164 + if (!pdev->is_physfn) 165 + return; 166 + 167 + if (!pci_num_vf(pdev)) 168 + return; 169 + 170 + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_SRIOV); 171 + if (pos) { 172 + struct pci_dev *vf_dev = NULL; 173 + 174 + pci_read_config_word(pdev, pos + PCI_SRIOV_VF_DID, &vf_id); 175 + while ((vf_dev = pci_get_device(pdev->vendor, vf_id, vf_dev))) { 176 + if (vf_dev->is_virtfn && vf_dev->physfn == pdev) 177 + pci_restore_msi_state(vf_dev); 178 + } 179 + } 180 + } 181 + #endif /* CONFIG_PCI_IOV */ 182 + 157 183 /** 158 184 * i40e_vc_notify_vf_reset 159 185 * @vf: pointer to the VF structure ··· 3547 3521 bool found = false; 3548 3522 int bkt; 3549 3523 3550 - if (!tc_filter->action) { 3524 + if (tc_filter->action != VIRTCHNL_ACTION_TC_REDIRECT) { 3551 3525 dev_info(&pf->pdev->dev, 3552 - "VF %d: Currently ADq doesn't support Drop Action\n", 3553 - vf->vf_id); 3526 + "VF %d: ADQ doesn't support this action (%d)\n", 3527 + vf->vf_id, tc_filter->action); 3554 3528 goto err; 3555 3529 } 3556 3530 3557 3531 /* action_meta is TC number here to which the filter is applied */ 3558 3532 if (!tc_filter->action_meta || 3559 - tc_filter->action_meta > I40E_MAX_VF_VSI) { 3533 + tc_filter->action_meta > vf->num_tc) { 3560 3534 dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n", 3561 3535 vf->vf_id, tc_filter->action_meta); 3562 3536 goto err;
+3
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
··· 137 137 138 138 void i40e_vc_notify_link_state(struct i40e_pf *pf); 139 139 void i40e_vc_notify_reset(struct i40e_pf *pf); 140 + #ifdef CONFIG_PCI_IOV 141 + void i40e_restore_all_vfs_msi_state(struct pci_dev *pdev); 142 + #endif /* CONFIG_PCI_IOV */ 140 143 int i40e_get_vf_stats(struct net_device *netdev, int vf_id, 141 144 struct ifla_vf_stats *vf_stats); 142 145
+2 -1
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
··· 1359 1359 u8 lp_flowcontrol; 1360 1360 #define ICE_AQ_LINK_LP_PAUSE_ADV BIT(0) 1361 1361 #define ICE_AQ_LINK_LP_ASM_DIR_ADV BIT(1) 1362 + u8 reserved5[5]; 1362 1363 #define ICE_AQC_LS_DATA_SIZE_V2 \ 1363 - offsetofend(struct ice_aqc_get_link_status_data, lp_flowcontrol) 1364 + offsetofend(struct ice_aqc_get_link_status_data, reserved5) 1364 1365 } __packed; 1365 1366 1366 1367 /* Set event mask command (direct 0x0613) */
+1 -3
drivers/net/ethernet/intel/ice/ice_common.c
··· 5332 5332 u8 *eec_mode) 5333 5333 { 5334 5334 struct ice_aqc_get_cgu_dpll_status *cmd; 5335 - const s64 nsec_per_psec = 1000LL; 5336 5335 struct ice_aq_desc desc; 5337 5336 int status; 5338 5337 ··· 5347 5348 *phase_offset = le32_to_cpu(cmd->phase_offset_h); 5348 5349 *phase_offset <<= 32; 5349 5350 *phase_offset += le32_to_cpu(cmd->phase_offset_l); 5350 - *phase_offset = div64_s64(sign_extend64(*phase_offset, 47), 5351 - nsec_per_psec); 5351 + *phase_offset = sign_extend64(*phase_offset, 47); 5352 5352 *eec_mode = cmd->eec_mode; 5353 5353 } 5354 5354
+9 -3
drivers/net/ethernet/intel/ice/ice_main.c
··· 2146 2146 2147 2147 /* Ensure we have media as we cannot configure a medialess port */ 2148 2148 if (!(phy->link_info.link_info & ICE_AQ_MEDIA_AVAILABLE)) 2149 - return -EPERM; 2149 + return -ENOMEDIUM; 2150 2150 2151 2151 ice_print_topo_conflict(vsi); 2152 2152 ··· 9187 9187 int link_err = ice_force_phys_link_state(vsi, false); 9188 9188 9189 9189 if (link_err) { 9190 - netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", 9191 - vsi->vsi_num, link_err); 9190 + if (link_err == -ENOMEDIUM) 9191 + netdev_info(vsi->netdev, "Skipping link reconfig - no media attached, VSI %d\n", 9192 + vsi->vsi_num); 9193 + else 9194 + netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n", 9195 + vsi->vsi_num, link_err); 9196 + 9197 + ice_vsi_close(vsi); 9192 9198 return -EIO; 9193 9199 } 9194 9200 }
-1
drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
··· 1044 1044 } 1045 1045 1046 1046 idpf_rx_sync_for_cpu(rx_buf, fields.size); 1047 - skb = rx_q->skb; 1048 1047 if (skb) 1049 1048 idpf_rx_add_frag(rx_buf, skb, fields.size); 1050 1049 else
+1 -1
drivers/net/ethernet/intel/idpf/idpf_txrx.c
··· 396 396 if (!rxq) 397 397 return; 398 398 399 - if (!bufq && idpf_is_queue_model_split(q_model) && rxq->skb) { 399 + if (rxq->skb) { 400 400 dev_kfree_skb_any(rxq->skb); 401 401 rxq->skb = NULL; 402 402 }
+3 -3
drivers/net/ethernet/intel/idpf/virtchnl2.h
··· 1104 1104 __le32 vport_id; 1105 1105 __le16 key_len; 1106 1106 u8 pad; 1107 - __DECLARE_FLEX_ARRAY(u8, key_flex); 1108 - }; 1109 - VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_rss_key); 1107 + u8 key_flex[]; 1108 + } __packed; 1109 + VIRTCHNL2_CHECK_STRUCT_LEN(7, virtchnl2_rss_key); 1110 1110 1111 1111 /** 1112 1112 * struct virtchnl2_queue_chunk - chunk of contiguous queues
+1
drivers/net/ethernet/intel/igc/igc.h
··· 568 568 u16 etype; 569 569 __be16 vlan_etype; 570 570 u16 vlan_tci; 571 + u16 vlan_tci_mask; 571 572 u8 src_addr[ETH_ALEN]; 572 573 u8 dst_addr[ETH_ALEN]; 573 574 u8 user_data[8];
+39 -3
drivers/net/ethernet/intel/igc/igc_ethtool.c
··· 958 958 } 959 959 960 960 #define ETHER_TYPE_FULL_MASK ((__force __be16)~0) 961 + #define VLAN_TCI_FULL_MASK ((__force __be16)~0) 961 962 static int igc_ethtool_get_nfc_rule(struct igc_adapter *adapter, 962 963 struct ethtool_rxnfc *cmd) 963 964 { ··· 981 980 fsp->m_u.ether_spec.h_proto = ETHER_TYPE_FULL_MASK; 982 981 } 983 982 983 + if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) { 984 + fsp->flow_type |= FLOW_EXT; 985 + fsp->h_ext.vlan_etype = rule->filter.vlan_etype; 986 + fsp->m_ext.vlan_etype = ETHER_TYPE_FULL_MASK; 987 + } 988 + 984 989 if (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) { 985 990 fsp->flow_type |= FLOW_EXT; 986 991 fsp->h_ext.vlan_tci = htons(rule->filter.vlan_tci); 987 - fsp->m_ext.vlan_tci = htons(VLAN_PRIO_MASK); 992 + fsp->m_ext.vlan_tci = htons(rule->filter.vlan_tci_mask); 988 993 } 989 994 990 995 if (rule->filter.match_flags & IGC_FILTER_FLAG_DST_MAC_ADDR) { ··· 1225 1218 1226 1219 if ((fsp->flow_type & FLOW_EXT) && fsp->m_ext.vlan_tci) { 1227 1220 rule->filter.vlan_tci = ntohs(fsp->h_ext.vlan_tci); 1221 + rule->filter.vlan_tci_mask = ntohs(fsp->m_ext.vlan_tci); 1228 1222 rule->filter.match_flags |= IGC_FILTER_FLAG_VLAN_TCI; 1229 1223 } 1230 1224 ··· 1263 1255 memcpy(rule->filter.user_mask, fsp->m_ext.data, sizeof(fsp->m_ext.data)); 1264 1256 } 1265 1257 1266 - /* When multiple filter options or user data or vlan etype is set, use a 1267 - * flex filter. 1258 + /* The i225/i226 has various different filters. Flex filters provide a 1259 + * way to match up to the first 128 bytes of a packet. Use them for: 1260 + * a) For specific user data 1261 + * b) For VLAN EtherType 1262 + * c) For full TCI match 1263 + * d) Or in case multiple filter criteria are set 1264 + * 1265 + * Otherwise, use the simple MAC, VLAN PRIO or EtherType filters. 1268 1266 */ 1269 1267 if ((rule->filter.match_flags & IGC_FILTER_FLAG_USER_DATA) || 1270 1268 (rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_ETYPE) || 1269 + ((rule->filter.match_flags & IGC_FILTER_FLAG_VLAN_TCI) && 1270 + rule->filter.vlan_tci_mask == ntohs(VLAN_TCI_FULL_MASK)) || 1271 1271 (rule->filter.match_flags & (rule->filter.match_flags - 1))) 1272 1272 rule->flex = true; 1273 1273 else ··· 1343 1327 if (fsp->ring_cookie >= adapter->num_rx_queues) { 1344 1328 netdev_dbg(netdev, "Invalid action\n"); 1345 1329 return -EINVAL; 1330 + } 1331 + 1332 + /* There are two ways to match the VLAN TCI: 1333 + * 1. Match on PCP field and use vlan prio filter for it 1334 + * 2. Match on complete TCI field and use flex filter for it 1335 + */ 1336 + if ((fsp->flow_type & FLOW_EXT) && 1337 + fsp->m_ext.vlan_tci && 1338 + fsp->m_ext.vlan_tci != htons(VLAN_PRIO_MASK) && 1339 + fsp->m_ext.vlan_tci != VLAN_TCI_FULL_MASK) { 1340 + netdev_dbg(netdev, "VLAN mask not supported\n"); 1341 + return -EOPNOTSUPP; 1342 + } 1343 + 1344 + /* VLAN EtherType can only be matched by full mask. */ 1345 + if ((fsp->flow_type & FLOW_EXT) && 1346 + fsp->m_ext.vlan_etype && 1347 + fsp->m_ext.vlan_etype != ETHER_TYPE_FULL_MASK) { 1348 + netdev_dbg(netdev, "VLAN EtherType mask not supported\n"); 1349 + return -EOPNOTSUPP; 1346 1350 } 1347 1351 1348 1352 if (fsp->location >= IGC_MAX_RXNFC_RULES) {
+1 -1
drivers/net/ethernet/intel/igc/igc_tsn.c
··· 227 227 wr32(IGC_TQAVCC(i), tqavcc); 228 228 229 229 wr32(IGC_TQAVHC(i), 230 - 0x80000000 + ring->hicredit * 0x7735); 230 + 0x80000000 + ring->hicredit * 0x7736); 231 231 } else { 232 232 /* Disable any CBS for the queue */ 233 233 txqctl &= ~(IGC_TXQCTL_QAV_SEL_MASK);
+2 -2
drivers/net/ethernet/marvell/octeontx2/af/npc.h
··· 528 528 u8 ltype_mask; 529 529 u8 ltype_match; 530 530 u8 lid; 531 - }; 531 + } __packed; 532 532 533 533 struct npc_lt_def_ipsec { 534 534 u8 ltype_mask; ··· 536 536 u8 lid; 537 537 u8 spi_offset; 538 538 u8 spi_nz; 539 - }; 539 + } __packed; 540 540 541 541 struct npc_lt_def_apad { 542 542 u8 ltype_mask;
+1
drivers/net/ethernet/marvell/octeontx2/af/rvu.h
··· 905 905 void *rvu_first_cgx_pdata(struct rvu *rvu); 906 906 int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id); 907 907 int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable); 908 + int rvu_cgx_tx_enable(struct rvu *rvu, u16 pcifunc, bool enable); 908 909 int rvu_cgx_prio_flow_ctrl_cfg(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause, 909 910 u16 pfc_en); 910 911 int rvu_cgx_cfg_pause_frm(struct rvu *rvu, u16 pcifunc, u8 tx_pause, u8 rx_pause);
+17
drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c
··· 465 465 return mac_ops->mac_rx_tx_enable(cgxd, lmac_id, start); 466 466 } 467 467 468 + int rvu_cgx_tx_enable(struct rvu *rvu, u16 pcifunc, bool enable) 469 + { 470 + int pf = rvu_get_pf(pcifunc); 471 + struct mac_ops *mac_ops; 472 + u8 cgx_id, lmac_id; 473 + void *cgxd; 474 + 475 + if (!is_cgx_config_permitted(rvu, pcifunc)) 476 + return LMAC_AF_ERR_PERM_DENIED; 477 + 478 + rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); 479 + cgxd = rvu_cgx_pdata(cgx_id, rvu); 480 + mac_ops = get_mac_ops(cgxd); 481 + 482 + return mac_ops->mac_tx_enable(cgxd, lmac_id, enable); 483 + } 484 + 468 485 int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable) 469 486 { 470 487 struct mac_ops *mac_ops;
+10 -108
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
··· 4143 4143 req->minlen = minlen; 4144 4144 } 4145 4145 4146 - static int 4147 - nix_config_link_credits(struct rvu *rvu, int blkaddr, int link, 4148 - u16 pcifunc, u64 tx_credits) 4149 - { 4150 - struct rvu_hwinfo *hw = rvu->hw; 4151 - int pf = rvu_get_pf(pcifunc); 4152 - u8 cgx_id = 0, lmac_id = 0; 4153 - unsigned long poll_tmo; 4154 - bool restore_tx_en = 0; 4155 - struct nix_hw *nix_hw; 4156 - u64 cfg, sw_xoff = 0; 4157 - u32 schq = 0; 4158 - u32 credits; 4159 - int rc; 4160 - 4161 - nix_hw = get_nix_hw(rvu->hw, blkaddr); 4162 - if (!nix_hw) 4163 - return NIX_AF_ERR_INVALID_NIXBLK; 4164 - 4165 - if (tx_credits == nix_hw->tx_credits[link]) 4166 - return 0; 4167 - 4168 - /* Enable cgx tx if disabled for credits to be back */ 4169 - if (is_pf_cgxmapped(rvu, pf)) { 4170 - rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); 4171 - restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), 4172 - lmac_id, true); 4173 - } 4174 - 4175 - mutex_lock(&rvu->rsrc_lock); 4176 - /* Disable new traffic to link */ 4177 - if (hw->cap.nix_shaping) { 4178 - schq = nix_get_tx_link(rvu, pcifunc); 4179 - sw_xoff = rvu_read64(rvu, blkaddr, NIX_AF_TL1X_SW_XOFF(schq)); 4180 - rvu_write64(rvu, blkaddr, 4181 - NIX_AF_TL1X_SW_XOFF(schq), BIT_ULL(0)); 4182 - } 4183 - 4184 - rc = NIX_AF_ERR_LINK_CREDITS; 4185 - poll_tmo = jiffies + usecs_to_jiffies(200000); 4186 - /* Wait for credits to return */ 4187 - do { 4188 - if (time_after(jiffies, poll_tmo)) 4189 - goto exit; 4190 - usleep_range(100, 200); 4191 - 4192 - cfg = rvu_read64(rvu, blkaddr, 4193 - NIX_AF_TX_LINKX_NORM_CREDIT(link)); 4194 - credits = (cfg >> 12) & 0xFFFFFULL; 4195 - } while (credits != nix_hw->tx_credits[link]); 4196 - 4197 - cfg &= ~(0xFFFFFULL << 12); 4198 - cfg |= (tx_credits << 12); 4199 - rvu_write64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link), cfg); 4200 - rc = 0; 4201 - 4202 - nix_hw->tx_credits[link] = tx_credits; 4203 - 4204 - exit: 4205 - /* Enable traffic back */ 4206 - if (hw->cap.nix_shaping && !sw_xoff) 4207 - rvu_write64(rvu, blkaddr, NIX_AF_TL1X_SW_XOFF(schq), 0); 4208 - 4209 - /* Restore state of cgx tx */ 4210 - if (restore_tx_en) 4211 - rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false); 4212 - 4213 - mutex_unlock(&rvu->rsrc_lock); 4214 - return rc; 4215 - } 4216 - 4217 4146 int rvu_mbox_handler_nix_set_hw_frs(struct rvu *rvu, struct nix_frs_cfg *req, 4218 4147 struct msg_rsp *rsp) 4219 4148 { 4220 4149 struct rvu_hwinfo *hw = rvu->hw; 4221 4150 u16 pcifunc = req->hdr.pcifunc; 4222 4151 int pf = rvu_get_pf(pcifunc); 4223 - int blkaddr, schq, link = -1; 4224 - struct nix_txsch *txsch; 4225 - u64 cfg, lmac_fifo_len; 4152 + int blkaddr, link = -1; 4226 4153 struct nix_hw *nix_hw; 4227 4154 struct rvu_pfvf *pfvf; 4228 4155 u8 cgx = 0, lmac = 0; 4229 4156 u16 max_mtu; 4157 + u64 cfg; 4230 4158 4231 4159 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); 4232 4160 if (blkaddr < 0) ··· 4175 4247 if (req->update_minlen && req->minlen < NIC_HW_MIN_FRS) 4176 4248 return NIX_AF_ERR_FRS_INVALID; 4177 4249 4178 - /* Check if requester wants to update SMQ's */ 4179 - if (!req->update_smq) 4180 - goto rx_frscfg; 4181 - 4182 - /* Update min/maxlen in each of the SMQ attached to this PF/VF */ 4183 - txsch = &nix_hw->txsch[NIX_TXSCH_LVL_SMQ]; 4184 - mutex_lock(&rvu->rsrc_lock); 4185 - for (schq = 0; schq < txsch->schq.max; schq++) { 4186 - if (TXSCH_MAP_FUNC(txsch->pfvf_map[schq]) != pcifunc) 4187 - continue; 4188 - cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq)); 4189 - cfg = (cfg & ~(0xFFFFULL << 8)) | ((u64)req->maxlen << 8); 4190 - if (req->update_minlen) 4191 - cfg = (cfg & ~0x7FULL) | ((u64)req->minlen & 0x7F); 4192 - rvu_write64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq), cfg); 4193 - } 4194 - mutex_unlock(&rvu->rsrc_lock); 4195 - 4196 - rx_frscfg: 4197 4250 /* Check if config is for SDP link */ 4198 4251 if (req->sdp_link) { 4199 4252 if (!hw->sdp_links) ··· 4197 4288 if (link < 0) 4198 4289 return NIX_AF_ERR_RX_LINK_INVALID; 4199 4290 4200 - 4201 4291 linkcfg: 4202 4292 nix_find_link_frs(rvu, req, pcifunc); 4203 4293 ··· 4206 4298 cfg = (cfg & ~0xFFFFULL) | req->minlen; 4207 4299 rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link), cfg); 4208 4300 4209 - if (req->sdp_link || pf == 0) 4210 - return 0; 4211 - 4212 - /* Update transmit credits for CGX links */ 4213 - lmac_fifo_len = rvu_cgx_get_lmac_fifolen(rvu, cgx, lmac); 4214 - if (!lmac_fifo_len) { 4215 - dev_err(rvu->dev, 4216 - "%s: Failed to get CGX/RPM%d:LMAC%d FIFO size\n", 4217 - __func__, cgx, lmac); 4218 - return 0; 4219 - } 4220 - return nix_config_link_credits(rvu, blkaddr, link, pcifunc, 4221 - (lmac_fifo_len - req->maxlen) / 16); 4301 + return 0; 4222 4302 } 4223 4303 4224 4304 int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req, ··· 4737 4841 pfvf = rvu_get_pfvf(rvu, pcifunc); 4738 4842 clear_bit(NIXLF_INITIALIZED, &pfvf->flags); 4739 4843 4740 - return rvu_cgx_start_stop_io(rvu, pcifunc, false); 4844 + err = rvu_cgx_start_stop_io(rvu, pcifunc, false); 4845 + if (err) 4846 + return err; 4847 + 4848 + rvu_cgx_tx_enable(rvu, pcifunc, true); 4849 + 4850 + return 0; 4741 4851 } 4742 4852 4743 4853 #define RX_SA_BASE GENMASK_ULL(52, 7)
+7 -2
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
··· 267 267 priv->stats.rx_truncate_errors++; 268 268 } 269 269 270 + /* Read receive consumer index before replenish so that this routine 271 + * returns accurate return value even if packet is received into 272 + * just-replenished buffer prior to exiting this routine. 273 + */ 274 + rx_ci = readq(priv->base + MLXBF_GIGE_RX_CQE_PACKET_CI); 275 + rx_ci_rem = rx_ci % priv->rx_q_entries; 276 + 270 277 /* Let hardware know we've replenished one buffer */ 271 278 rx_pi++; 272 279 ··· 286 279 rx_pi_rem = rx_pi % priv->rx_q_entries; 287 280 if (rx_pi_rem == 0) 288 281 priv->valid_polarity ^= 1; 289 - rx_ci = readq(priv->base + MLXBF_GIGE_RX_CQE_PACKET_CI); 290 - rx_ci_rem = rx_ci % priv->rx_q_entries; 291 282 292 283 if (skb) 293 284 netif_receive_skb(skb);
+2
drivers/net/ethernet/qlogic/qla3xxx.c
··· 2591 2591 2592 2592 if (qdev->lrg_buf_q_alloc_virt_addr == NULL) { 2593 2593 netdev_err(qdev->ndev, "lBufQ failed\n"); 2594 + kfree(qdev->lrg_buf); 2594 2595 return -ENOMEM; 2595 2596 } 2596 2597 qdev->lrg_buf_q_virt_addr = qdev->lrg_buf_q_alloc_virt_addr; ··· 2616 2615 qdev->lrg_buf_q_alloc_size, 2617 2616 qdev->lrg_buf_q_alloc_virt_addr, 2618 2617 qdev->lrg_buf_q_alloc_phy_addr); 2618 + kfree(qdev->lrg_buf); 2619 2619 return -ENOMEM; 2620 2620 } 2621 2621
+1 -1
drivers/net/ethernet/realtek/r8169_main.c
··· 1211 1211 { 1212 1212 r8168ep_ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_START); 1213 1213 r8168ep_ocp_write(tp, 0x01, 0x30, r8168ep_ocp_read(tp, 0x30) | 0x01); 1214 - rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 10); 1214 + rtl_loop_wait_high(tp, &rtl_ep_ocp_read_cond, 10000, 30); 1215 1215 } 1216 1216 1217 1217 static void rtl8168_driver_start(struct rtl8169_private *tp)
+42 -23
drivers/net/ethernet/renesas/ravb_main.c
··· 66 66 return -ETIMEDOUT; 67 67 } 68 68 69 - static int ravb_config(struct net_device *ndev) 69 + static int ravb_set_opmode(struct net_device *ndev, u32 opmode) 70 70 { 71 + u32 csr_ops = 1U << (opmode & CCC_OPC); 72 + u32 ccc_mask = CCC_OPC; 71 73 int error; 72 74 73 - /* Set config mode */ 74 - ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG); 75 - /* Check if the operating mode is changed to the config mode */ 76 - error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_CONFIG); 77 - if (error) 78 - netdev_err(ndev, "failed to switch device to config mode\n"); 75 + /* If gPTP active in config mode is supported it needs to be configured 76 + * along with CSEL and operating mode in the same access. This is a 77 + * hardware limitation. 78 + */ 79 + if (opmode & CCC_GAC) 80 + ccc_mask |= CCC_GAC | CCC_CSEL; 81 + 82 + /* Set operating mode */ 83 + ravb_modify(ndev, CCC, ccc_mask, opmode); 84 + /* Check if the operating mode is changed to the requested one */ 85 + error = ravb_wait(ndev, CSR, CSR_OPS, csr_ops); 86 + if (error) { 87 + netdev_err(ndev, "failed to switch device to requested mode (%u)\n", 88 + opmode & CCC_OPC); 89 + } 79 90 80 91 return error; 81 92 } ··· 684 673 int error; 685 674 686 675 /* Set CONFIG mode */ 687 - error = ravb_config(ndev); 676 + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); 688 677 if (error) 689 678 return error; 690 679 ··· 693 682 return error; 694 683 695 684 /* Setting the control will start the AVB-DMAC process. */ 696 - ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_OPERATION); 697 - 698 - return 0; 685 + return ravb_set_opmode(ndev, CCC_OPC_OPERATION); 699 686 } 700 687 701 688 static void ravb_get_tx_tstamp(struct net_device *ndev) ··· 1055 1046 return error; 1056 1047 1057 1048 /* Stop AVB-DMAC process */ 1058 - return ravb_config(ndev); 1049 + return ravb_set_opmode(ndev, CCC_OPC_CONFIG); 1059 1050 } 1060 1051 1061 1052 /* E-MAC interrupt handler */ ··· 2569 2560 return 0; 2570 2561 } 2571 2562 2572 - static void ravb_set_config_mode(struct net_device *ndev) 2563 + static int ravb_set_config_mode(struct net_device *ndev) 2573 2564 { 2574 2565 struct ravb_private *priv = netdev_priv(ndev); 2575 2566 const struct ravb_hw_info *info = priv->info; 2567 + int error; 2576 2568 2577 2569 if (info->gptp) { 2578 - ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG); 2570 + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); 2571 + if (error) 2572 + return error; 2579 2573 /* Set CSEL value */ 2580 2574 ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB); 2581 2575 } else if (info->ccc_gac) { 2582 - ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG | 2583 - CCC_GAC | CCC_CSEL_HPB); 2576 + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB); 2584 2577 } else { 2585 - ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG); 2578 + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); 2586 2579 } 2580 + 2581 + return error; 2587 2582 } 2588 2583 2589 2584 /* Set tx and rx clock internal delay modes */ ··· 2807 2794 ndev->ethtool_ops = &ravb_ethtool_ops; 2808 2795 2809 2796 /* Set AVB config mode */ 2810 - ravb_set_config_mode(ndev); 2797 + error = ravb_set_config_mode(ndev); 2798 + if (error) 2799 + goto out_disable_gptp_clk; 2811 2800 2812 2801 if (info->gptp || info->ccc_gac) { 2813 2802 /* Set GTI value */ ··· 2932 2917 dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, 2933 2918 priv->desc_bat_dma); 2934 2919 2935 - /* Set reset mode */ 2936 - ravb_write(ndev, CCC_OPC_RESET, CCC); 2920 + ravb_set_opmode(ndev, CCC_OPC_RESET); 2937 2921 2938 2922 clk_disable_unprepare(priv->gptp_clk); 2939 2923 clk_disable_unprepare(priv->refclk); ··· 3014 3000 int ret = 0; 3015 3001 3016 3002 /* If WoL is enabled set reset mode to rearm the WoL logic */ 3017 - if (priv->wol_enabled) 3018 - ravb_write(ndev, CCC_OPC_RESET, CCC); 3003 + if (priv->wol_enabled) { 3004 + ret = ravb_set_opmode(ndev, CCC_OPC_RESET); 3005 + if (ret) 3006 + return ret; 3007 + } 3019 3008 3020 3009 /* All register have been reset to default values. 3021 3010 * Restore all registers which where setup at probe time and ··· 3026 3009 */ 3027 3010 3028 3011 /* Set AVB config mode */ 3029 - ravb_set_config_mode(ndev); 3012 + ret = ravb_set_config_mode(ndev); 3013 + if (ret) 3014 + return ret; 3030 3015 3031 3016 if (info->gptp || info->ccc_gac) { 3032 3017 /* Set GTI value */
+3 -1
drivers/net/ethernet/sfc/rx_common.c
··· 823 823 } 824 824 825 825 if (!success) { 826 - efx_for_each_channel(channel, efx) 826 + efx_for_each_channel(channel, efx) { 827 827 kfree(channel->rps_flow_id); 828 + channel->rps_flow_id = NULL; 829 + } 828 830 efx->type->filter_table_remove(efx); 829 831 rc = -ENOMEM; 830 832 goto out_unlock;
+3 -1
drivers/net/usb/ax88172a.c
··· 161 161 u8 buf[ETH_ALEN]; 162 162 struct ax88172a_private *priv; 163 163 164 - usbnet_get_endpoints(dev, intf); 164 + ret = usbnet_get_endpoints(dev, intf); 165 + if (ret) 166 + return ret; 165 167 166 168 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 167 169 if (!priv)
+30 -30
drivers/net/virtio_net.c
··· 334 334 }; 335 335 }; 336 336 337 - static void virtnet_rq_free_unused_buf(struct virtqueue *vq, void *buf); 338 337 static void virtnet_sq_free_unused_buf(struct virtqueue *vq, void *buf); 339 338 340 339 static bool is_xdp_frame(void *ptr) ··· 405 406 } else 406 407 p = alloc_page(gfp_mask); 407 408 return p; 409 + } 410 + 411 + static void virtnet_rq_free_buf(struct virtnet_info *vi, 412 + struct receive_queue *rq, void *buf) 413 + { 414 + if (vi->mergeable_rx_bufs) 415 + put_page(virt_to_head_page(buf)); 416 + else if (vi->big_packets) 417 + give_pages(rq, buf); 418 + else 419 + put_page(virt_to_head_page(buf)); 408 420 } 409 421 410 422 static void enable_delayed_refill(struct virtnet_info *vi) ··· 644 634 return buf; 645 635 } 646 636 647 - static void *virtnet_rq_detach_unused_buf(struct receive_queue *rq) 648 - { 649 - void *buf; 650 - 651 - buf = virtqueue_detach_unused_buf(rq->vq); 652 - if (buf && rq->do_dma) 653 - virtnet_rq_unmap(rq, buf, 0); 654 - 655 - return buf; 656 - } 657 - 658 637 static void virtnet_rq_init_one_sg(struct receive_queue *rq, void *buf, u32 len) 659 638 { 660 639 struct virtnet_rq_dma *dma; ··· 741 742 742 743 vi->rq[i].do_dma = true; 743 744 } 745 + } 746 + 747 + static void virtnet_rq_unmap_free_buf(struct virtqueue *vq, void *buf) 748 + { 749 + struct virtnet_info *vi = vq->vdev->priv; 750 + struct receive_queue *rq; 751 + int i = vq2rxq(vq); 752 + 753 + rq = &vi->rq[i]; 754 + 755 + if (rq->do_dma) 756 + virtnet_rq_unmap(rq, buf, 0); 757 + 758 + virtnet_rq_free_buf(vi, rq, buf); 744 759 } 745 760 746 761 static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) ··· 1777 1764 if (unlikely(len < vi->hdr_len + ETH_HLEN)) { 1778 1765 pr_debug("%s: short packet %i\n", dev->name, len); 1779 1766 DEV_STATS_INC(dev, rx_length_errors); 1780 - virtnet_rq_free_unused_buf(rq->vq, buf); 1767 + virtnet_rq_free_buf(vi, rq, buf); 1781 1768 return; 1782 1769 } 1783 1770 ··· 2405 2392 if (running) 2406 2393 napi_disable(&rq->napi); 2407 2394 2408 - err = virtqueue_resize(rq->vq, ring_num, virtnet_rq_free_unused_buf); 2395 + err = virtqueue_resize(rq->vq, ring_num, virtnet_rq_unmap_free_buf); 2409 2396 if (err) 2410 2397 netdev_err(vi->dev, "resize rx fail: rx queue index: %d err: %d\n", qindex, err); 2411 2398 ··· 4044 4031 xdp_return_frame(ptr_to_xdp(buf)); 4045 4032 } 4046 4033 4047 - static void virtnet_rq_free_unused_buf(struct virtqueue *vq, void *buf) 4048 - { 4049 - struct virtnet_info *vi = vq->vdev->priv; 4050 - int i = vq2rxq(vq); 4051 - 4052 - if (vi->mergeable_rx_bufs) 4053 - put_page(virt_to_head_page(buf)); 4054 - else if (vi->big_packets) 4055 - give_pages(&vi->rq[i], buf); 4056 - else 4057 - put_page(virt_to_head_page(buf)); 4058 - } 4059 - 4060 4034 static void free_unused_bufs(struct virtnet_info *vi) 4061 4035 { 4062 4036 void *buf; ··· 4057 4057 } 4058 4058 4059 4059 for (i = 0; i < vi->max_queue_pairs; i++) { 4060 - struct receive_queue *rq = &vi->rq[i]; 4060 + struct virtqueue *vq = vi->rq[i].vq; 4061 4061 4062 - while ((buf = virtnet_rq_detach_unused_buf(rq)) != NULL) 4063 - virtnet_rq_free_unused_buf(rq->vq, buf); 4062 + while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) 4063 + virtnet_rq_unmap_free_buf(vq, buf); 4064 4064 cond_resched(); 4065 4065 } 4066 4066 }
+2 -2
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
··· 770 770 } 771 771 } 772 772 773 - void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans); 773 + void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans, bool from_irq); 774 774 775 775 static inline bool iwl_is_rfkill_set(struct iwl_trans *trans) 776 776 { ··· 817 817 return (trans->dbg.dest_tlv || iwl_trans_dbg_ini_valid(trans)); 818 818 } 819 819 820 - void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); 820 + void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state, bool from_irq); 821 821 void iwl_trans_pcie_dump_regs(struct iwl_trans *trans); 822 822 823 823 #ifdef CONFIG_IWLWIFI_DEBUGFS
+4 -4
drivers/net/wireless/intel/iwlwifi/pcie/rx.c
··· 1783 1783 return inta; 1784 1784 } 1785 1785 1786 - void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans) 1786 + void iwl_pcie_handle_rfkill_irq(struct iwl_trans *trans, bool from_irq) 1787 1787 { 1788 1788 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1789 1789 struct isr_statistics *isr_stats = &trans_pcie->isr_stats; ··· 1807 1807 isr_stats->rfkill++; 1808 1808 1809 1809 if (prev != report) 1810 - iwl_trans_pcie_rf_kill(trans, report); 1810 + iwl_trans_pcie_rf_kill(trans, report, from_irq); 1811 1811 mutex_unlock(&trans_pcie->mutex); 1812 1812 1813 1813 if (hw_rfkill) { ··· 1947 1947 1948 1948 /* HW RF KILL switch toggled */ 1949 1949 if (inta & CSR_INT_BIT_RF_KILL) { 1950 - iwl_pcie_handle_rfkill_irq(trans); 1950 + iwl_pcie_handle_rfkill_irq(trans, true); 1951 1951 handled |= CSR_INT_BIT_RF_KILL; 1952 1952 } 1953 1953 ··· 2370 2370 2371 2371 /* HW RF KILL switch toggled */ 2372 2372 if (inta_hw & MSIX_HW_INT_CAUSES_REG_RF_KILL) 2373 - iwl_pcie_handle_rfkill_irq(trans); 2373 + iwl_pcie_handle_rfkill_irq(trans, true); 2374 2374 2375 2375 if (inta_hw & MSIX_HW_INT_CAUSES_REG_HW_ERR) { 2376 2376 IWL_ERR(trans,
+9 -8
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 1082 1082 report = test_bit(STATUS_RFKILL_OPMODE, &trans->status); 1083 1083 1084 1084 if (prev != report) 1085 - iwl_trans_pcie_rf_kill(trans, report); 1085 + iwl_trans_pcie_rf_kill(trans, report, false); 1086 1086 1087 1087 return hw_rfkill; 1088 1088 } ··· 1237 1237 trans_pcie->hw_mask = trans_pcie->hw_init_mask; 1238 1238 } 1239 1239 1240 - static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans) 1240 + static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool from_irq) 1241 1241 { 1242 1242 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1243 1243 ··· 1264 1264 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 1265 1265 IWL_DEBUG_INFO(trans, 1266 1266 "DEVICE_ENABLED bit was set and is now cleared\n"); 1267 - iwl_pcie_synchronize_irqs(trans); 1267 + if (!from_irq) 1268 + iwl_pcie_synchronize_irqs(trans); 1268 1269 iwl_pcie_rx_napi_sync(trans); 1269 1270 iwl_pcie_tx_stop(trans); 1270 1271 iwl_pcie_rx_stop(trans); ··· 1455 1454 clear_bit(STATUS_RFKILL_OPMODE, &trans->status); 1456 1455 } 1457 1456 if (hw_rfkill != was_in_rfkill) 1458 - iwl_trans_pcie_rf_kill(trans, hw_rfkill); 1457 + iwl_trans_pcie_rf_kill(trans, hw_rfkill, false); 1459 1458 } 1460 1459 1461 1460 static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) ··· 1470 1469 mutex_lock(&trans_pcie->mutex); 1471 1470 trans_pcie->opmode_down = true; 1472 1471 was_in_rfkill = test_bit(STATUS_RFKILL_OPMODE, &trans->status); 1473 - _iwl_trans_pcie_stop_device(trans); 1472 + _iwl_trans_pcie_stop_device(trans, false); 1474 1473 iwl_trans_pcie_handle_stop_rfkill(trans, was_in_rfkill); 1475 1474 mutex_unlock(&trans_pcie->mutex); 1476 1475 } 1477 1476 1478 - void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state) 1477 + void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state, bool from_irq) 1479 1478 { 1480 1479 struct iwl_trans_pcie __maybe_unused *trans_pcie = 1481 1480 IWL_TRANS_GET_PCIE_TRANS(trans); ··· 1488 1487 if (trans->trans_cfg->gen2) 1489 1488 _iwl_trans_pcie_gen2_stop_device(trans); 1490 1489 else 1491 - _iwl_trans_pcie_stop_device(trans); 1490 + _iwl_trans_pcie_stop_device(trans, from_irq); 1492 1491 } 1493 1492 } 1494 1493 ··· 2888 2887 IWL_WARN(trans, "changing debug rfkill %d->%d\n", 2889 2888 trans_pcie->debug_rfkill, new_value); 2890 2889 trans_pcie->debug_rfkill = new_value; 2891 - iwl_pcie_handle_rfkill_irq(trans); 2890 + iwl_pcie_handle_rfkill_irq(trans, false); 2892 2891 2893 2892 return count; 2894 2893 }
+1 -1
drivers/ptp/ptp_ocp.c
··· 4492 4492 cancel_delayed_work_sync(&bp->sync_work); 4493 4493 for (i = 0; i < OCP_SMA_NUM; i++) { 4494 4494 if (bp->sma[i].dpll_pin) { 4495 - dpll_pin_unregister(bp->dpll, bp->sma[i].dpll_pin, &dpll_pins_ops, bp); 4495 + dpll_pin_unregister(bp->dpll, bp->sma[i].dpll_pin, &dpll_pins_ops, &bp->sma[i]); 4496 4496 dpll_pin_put(bp->sma[i].dpll_pin); 4497 4497 } 4498 4498 }
-1
include/linux/phy.h
··· 568 568 * - Bits [31:24] are reserved for defining generic 569 569 * PHY driver behavior. 570 570 * @irq: IRQ number of the PHY's interrupt (-1 if none) 571 - * @phy_timer: The timer for handling the state machine 572 571 * @phylink: Pointer to phylink instance for this PHY 573 572 * @sfp_bus_attached: Flag indicating whether the SFP bus has been attached 574 573 * @sfp_bus: SFP bus attached to this PHY's fiber port
+1 -1
include/net/netfilter/nf_tables_ipv4.h
··· 30 30 return -1; 31 31 32 32 len = iph_totlen(pkt->skb, iph); 33 - thoff = iph->ihl * 4; 33 + thoff = skb_network_offset(pkt->skb) + (iph->ihl * 4); 34 34 if (pkt->skb->len < len) 35 35 return -1; 36 36 else if (len < thoff)
-2
include/net/tcp.h
··· 1788 1788 const struct sock *addr_sk); 1789 1789 1790 1790 #ifdef CONFIG_TCP_MD5SIG 1791 - #include <linux/jump_label.h> 1792 - extern struct static_key_false_deferred tcp_md5_needed; 1793 1791 struct tcp_md5sig_key *__tcp_md5_do_lookup(const struct sock *sk, int l3index, 1794 1792 const union tcp_md5_addr *addr, 1795 1793 int family, bool any_l3index);
+23 -3
include/net/tcp_ao.h
··· 127 127 struct rcu_head rcu; 128 128 }; 129 129 130 + #ifdef CONFIG_TCP_MD5SIG 131 + #include <linux/jump_label.h> 132 + extern struct static_key_false_deferred tcp_md5_needed; 133 + #define static_branch_tcp_md5() static_branch_unlikely(&tcp_md5_needed.key) 134 + #else 135 + #define static_branch_tcp_md5() false 136 + #endif 137 + #ifdef CONFIG_TCP_AO 138 + /* TCP-AO structures and functions */ 139 + #include <linux/jump_label.h> 140 + extern struct static_key_false_deferred tcp_ao_needed; 141 + #define static_branch_tcp_ao() static_branch_unlikely(&tcp_ao_needed.key) 142 + #else 143 + #define static_branch_tcp_ao() false 144 + #endif 145 + 146 + static inline bool tcp_hash_should_produce_warnings(void) 147 + { 148 + return static_branch_tcp_md5() || static_branch_tcp_ao(); 149 + } 150 + 130 151 #define tcp_hash_fail(msg, family, skb, fmt, ...) \ 131 152 do { \ 132 153 const struct tcphdr *th = tcp_hdr(skb); \ 133 154 char hdr_flags[6]; \ 134 155 char *f = hdr_flags; \ 135 156 \ 157 + if (!tcp_hash_should_produce_warnings()) \ 158 + break; \ 136 159 if (th->fin) \ 137 160 *f++ = 'F'; \ 138 161 if (th->syn) \ ··· 182 159 183 160 #ifdef CONFIG_TCP_AO 184 161 /* TCP-AO structures and functions */ 185 - #include <linux/jump_label.h> 186 - extern struct static_key_false_deferred tcp_ao_needed; 187 - 188 162 struct tcp4_ao_context { 189 163 __be32 saddr; 190 164 __be32 daddr;
+10 -2
net/core/sock.c
··· 1711 1711 break; 1712 1712 1713 1713 case SO_TIMESTAMPING_OLD: 1714 + case SO_TIMESTAMPING_NEW: 1714 1715 lv = sizeof(v.timestamping); 1715 - v.timestamping.flags = READ_ONCE(sk->sk_tsflags); 1716 - v.timestamping.bind_phc = READ_ONCE(sk->sk_bind_phc); 1716 + /* For the later-added case SO_TIMESTAMPING_NEW: Be strict about only 1717 + * returning the flags when they were set through the same option. 1718 + * Don't change the beviour for the old case SO_TIMESTAMPING_OLD. 1719 + */ 1720 + if (optname == SO_TIMESTAMPING_OLD || sock_flag(sk, SOCK_TSTAMP_NEW)) { 1721 + v.timestamping.flags = READ_ONCE(sk->sk_tsflags); 1722 + v.timestamping.bind_phc = READ_ONCE(sk->sk_bind_phc); 1723 + } 1717 1724 break; 1718 1725 1719 1726 case SO_RCVTIMEO_OLD: ··· 2813 2806 sockc->mark = *(u32 *)CMSG_DATA(cmsg); 2814 2807 break; 2815 2808 case SO_TIMESTAMPING_OLD: 2809 + case SO_TIMESTAMPING_NEW: 2816 2810 if (cmsg->cmsg_len != CMSG_LEN(sizeof(u32))) 2817 2811 return -EINVAL; 2818 2812
+2 -3
net/ipv4/tcp_sigpool.c
··· 162 162 if (strcmp(cpool[i].alg, alg)) 163 163 continue; 164 164 165 - if (kref_read(&cpool[i].kref) > 0) 166 - kref_get(&cpool[i].kref); 167 - else 165 + /* pairs with tcp_sigpool_release() */ 166 + if (!kref_get_unless_zero(&cpool[i].kref)) 168 167 kref_init(&cpool[i].kref); 169 168 ret = i; 170 169 goto out;
+5 -13
net/ipv6/addrconf.c
··· 1407 1407 1408 1408 write_unlock_bh(&idev->lock); 1409 1409 1410 - /* From RFC 4941: 1411 - * 1412 - * A temporary address is created only if this calculated Preferred 1413 - * Lifetime is greater than REGEN_ADVANCE time units. In 1414 - * particular, an implementation must not create a temporary address 1415 - * with a zero Preferred Lifetime. 1416 - * 1417 - * Clamp the preferred lifetime to a minimum of regen_advance, unless 1418 - * that would exceed valid_lft. 1419 - * 1410 + /* A temporary address is created only if this calculated Preferred 1411 + * Lifetime is greater than REGEN_ADVANCE time units. In particular, 1412 + * an implementation must not create a temporary address with a zero 1413 + * Preferred Lifetime. 1420 1414 * Use age calculation as in addrconf_verify to avoid unnecessary 1421 1415 * temporary addresses being generated. 1422 1416 */ 1423 1417 age = (now - tmp_tstamp + ADDRCONF_TIMER_FUZZ_MINUS) / HZ; 1424 - if (cfg.preferred_lft <= regen_advance + age) 1425 - cfg.preferred_lft = regen_advance + age + 1; 1426 - if (cfg.preferred_lft > cfg.valid_lft) { 1418 + if (cfg.preferred_lft <= regen_advance + age) { 1427 1419 in6_ifa_put(ifp); 1428 1420 in6_dev_put(idev); 1429 1421 ret = -1;
+6 -3
net/mac80211/debugfs_netdev.c
··· 1043 1043 { 1044 1044 ieee80211_debugfs_remove_netdev(sdata); 1045 1045 ieee80211_debugfs_add_netdev(sdata, mld_vif); 1046 - drv_vif_add_debugfs(sdata->local, sdata); 1047 - if (!mld_vif) 1048 - ieee80211_link_debugfs_drv_add(&sdata->deflink); 1046 + 1047 + if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) { 1048 + drv_vif_add_debugfs(sdata->local, sdata); 1049 + if (!mld_vif) 1050 + ieee80211_link_debugfs_drv_add(&sdata->deflink); 1051 + } 1049 1052 } 1050 1053 1051 1054 void ieee80211_link_debugfs_add(struct ieee80211_link_data *link)
+9 -5
net/mac80211/driver-ops.c
··· 75 75 if (ret) 76 76 return ret; 77 77 78 - sdata->flags |= IEEE80211_SDATA_IN_DRIVER; 78 + if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) { 79 + sdata->flags |= IEEE80211_SDATA_IN_DRIVER; 79 80 80 - if (!local->in_reconfig) { 81 81 drv_vif_add_debugfs(local, sdata); 82 82 /* initially vif is not MLD */ 83 83 ieee80211_link_debugfs_drv_add(&sdata->deflink); ··· 113 113 if (!check_sdata_in_driver(sdata)) 114 114 return; 115 115 116 + sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; 117 + 118 + /* Remove driver debugfs entries */ 119 + ieee80211_debugfs_recreate_netdev(sdata, sdata->vif.valid_links); 120 + 116 121 trace_drv_remove_interface(local, sdata); 117 122 local->ops->remove_interface(&local->hw, &sdata->vif); 118 - sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; 119 123 trace_drv_return_void(local); 120 124 } 121 125 ··· 538 534 if (ret) 539 535 return ret; 540 536 541 - if (!local->in_reconfig) { 537 + if (!local->in_reconfig && !local->resuming) { 542 538 for_each_set_bit(link_id, &links_to_add, 543 539 IEEE80211_MLD_MAX_NUM_LINKS) { 544 540 link = rcu_access_pointer(sdata->link[link_id]); ··· 594 590 return ret; 595 591 596 592 /* during reconfig don't add it to debugfs again */ 597 - if (local->in_reconfig) 593 + if (local->in_reconfig || local->resuming) 598 594 return 0; 599 595 600 596 for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) {
+13
net/mptcp/subflow.c
··· 1982 1982 tcp_release_cb(ssk); 1983 1983 } 1984 1984 1985 + static int tcp_abort_override(struct sock *ssk, int err) 1986 + { 1987 + /* closing a listener subflow requires a great deal of care. 1988 + * keep it simple and just prevent such operation 1989 + */ 1990 + if (inet_sk_state_load(ssk) == TCP_LISTEN) 1991 + return -EINVAL; 1992 + 1993 + return tcp_abort(ssk, err); 1994 + } 1995 + 1985 1996 static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = { 1986 1997 .name = "mptcp", 1987 1998 .owner = THIS_MODULE, ··· 2037 2026 2038 2027 tcp_prot_override = tcp_prot; 2039 2028 tcp_prot_override.release_cb = tcp_release_cb_override; 2029 + tcp_prot_override.diag_destroy = tcp_abort_override; 2040 2030 2041 2031 #if IS_ENABLED(CONFIG_MPTCP_IPV6) 2042 2032 /* In struct mptcp_subflow_request_sock, we assume the TCP request sock ··· 2073 2061 2074 2062 tcpv6_prot_override = tcpv6_prot; 2075 2063 tcpv6_prot_override.release_cb = tcp_release_cb_override; 2064 + tcpv6_prot_override.diag_destroy = tcp_abort_override; 2076 2065 #endif 2077 2066 2078 2067 mptcp_diag_subflow_init(&subflow_ulp_ops);
+2 -1
net/netfilter/nf_nat_ovs.c
··· 75 75 } 76 76 77 77 err = nf_nat_packet(ct, ctinfo, hooknum, skb); 78 + out: 78 79 if (err == NF_ACCEPT) 79 80 *action |= BIT(maniptype); 80 - out: 81 + 81 82 return err; 82 83 } 83 84
+1 -1
net/netfilter/nf_tables_api.c
··· 9887 9887 list_for_each_entry_safe(set, next, set_update_list, pending_update) { 9888 9888 list_del_init(&set->pending_update); 9889 9889 9890 - if (!set->ops->commit) 9890 + if (!set->ops->commit || set->dead) 9891 9891 continue; 9892 9892 9893 9893 set->ops->commit(set);
+1 -1
net/netfilter/nf_tables_core.c
··· 158 158 else { 159 159 if (!(pkt->flags & NFT_PKTINFO_L4PROTO)) 160 160 return false; 161 - ptr = skb_network_header(skb) + nft_thoff(pkt); 161 + ptr = skb->data + nft_thoff(pkt); 162 162 } 163 163 164 164 ptr += priv->offset;
+1 -1
net/netfilter/nft_immediate.c
··· 78 78 case NFT_GOTO: 79 79 err = nf_tables_bind_chain(ctx, chain); 80 80 if (err < 0) 81 - return err; 81 + goto err1; 82 82 break; 83 83 default: 84 84 break;
+36 -3
net/nfc/llcp_core.c
··· 145 145 146 146 static struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) 147 147 { 148 + /* Since using nfc_llcp_local may result in usage of nfc_dev, whenever 149 + * we hold a reference to local, we also need to hold a reference to 150 + * the device to avoid UAF. 151 + */ 152 + if (!nfc_get_device(local->dev->idx)) 153 + return NULL; 154 + 148 155 kref_get(&local->ref); 149 156 150 157 return local; ··· 184 177 185 178 int nfc_llcp_local_put(struct nfc_llcp_local *local) 186 179 { 180 + struct nfc_dev *dev; 181 + int ret; 182 + 187 183 if (local == NULL) 188 184 return 0; 189 185 190 - return kref_put(&local->ref, local_release); 186 + dev = local->dev; 187 + 188 + ret = kref_put(&local->ref, local_release); 189 + nfc_put_device(dev); 190 + 191 + return ret; 191 192 } 192 193 193 194 static struct nfc_llcp_sock *nfc_llcp_sock_get(struct nfc_llcp_local *local, ··· 974 959 } 975 960 976 961 new_sock = nfc_llcp_sock(new_sk); 977 - new_sock->dev = local->dev; 962 + 978 963 new_sock->local = nfc_llcp_local_get(local); 964 + if (!new_sock->local) { 965 + reason = LLCP_DM_REJ; 966 + sock_put(&new_sock->sk); 967 + release_sock(&sock->sk); 968 + sock_put(&sock->sk); 969 + goto fail; 970 + } 971 + 972 + new_sock->dev = local->dev; 979 973 new_sock->rw = sock->rw; 980 974 new_sock->miux = sock->miux; 981 975 new_sock->nfc_protocol = sock->nfc_protocol; ··· 1621 1597 if (local == NULL) 1622 1598 return -ENOMEM; 1623 1599 1624 - local->dev = ndev; 1600 + /* As we are going to initialize local's refcount, we need to get the 1601 + * nfc_dev to avoid UAF, otherwise there is no point in continuing. 1602 + * See nfc_llcp_local_get(). 1603 + */ 1604 + local->dev = nfc_get_device(ndev->idx); 1605 + if (!local->dev) { 1606 + kfree(local); 1607 + return -ENODEV; 1608 + } 1609 + 1625 1610 INIT_LIST_HEAD(&local->list); 1626 1611 kref_init(&local->ref); 1627 1612 mutex_init(&local->sdp_lock);
+5
net/nfc/llcp_sock.c
··· 796 796 } 797 797 798 798 if (sk->sk_type == SOCK_DGRAM) { 799 + if (sk->sk_state != LLCP_BOUND) { 800 + release_sock(sk); 801 + return -ENOTCONN; 802 + } 803 + 799 804 DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr, 800 805 msg->msg_name); 801 806
+3 -1
net/qrtr/ns.c
··· 512 512 if (!node) 513 513 return -ENOENT; 514 514 515 - return server_del(node, port, true); 515 + server_del(node, port, true); 516 + 517 + return 0; 516 518 } 517 519 518 520 static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from,
+3 -1
net/sched/em_text.c
··· 97 97 98 98 static void em_text_destroy(struct tcf_ematch *m) 99 99 { 100 - if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) 100 + if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) { 101 101 textsearch_destroy(EM_TEXT_PRIV(m)->config); 102 + kfree(EM_TEXT_PRIV(m)); 103 + } 102 104 } 103 105 104 106 static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
+1 -2
net/smc/smc_diag.c
··· 153 153 .lnk[0].link_id = link->link_id, 154 154 }; 155 155 156 - memcpy(linfo.lnk[0].ibname, 157 - smc->conn.lgr->lnk[0].smcibdev->ibdev->name, 156 + memcpy(linfo.lnk[0].ibname, link->smcibdev->ibdev->name, 158 157 sizeof(link->smcibdev->ibdev->name)); 159 158 smc_gid_be16_convert(linfo.lnk[0].gid, link->gid); 160 159 smc_gid_be16_convert(linfo.lnk[0].peer_gid, link->peer_gid);
+2
net/socket.c
··· 757 757 { 758 758 struct sockaddr_storage *save_addr = (struct sockaddr_storage *)msg->msg_name; 759 759 struct sockaddr_storage address; 760 + int save_len = msg->msg_namelen; 760 761 int ret; 761 762 762 763 if (msg->msg_name) { ··· 767 766 768 767 ret = __sock_sendmsg(sock, msg); 769 768 msg->msg_name = save_addr; 769 + msg->msg_namelen = save_len; 770 770 771 771 return ret; 772 772 }
+3 -3
tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
··· 30 30 31 31 ip netns exec client ip link add dev bond0 down type bond mode 1 \ 32 32 miimon 100 all_slaves_active 1 33 - ip netns exec client ip link set dev eth0 down master bond0 33 + ip netns exec client ip link set dev eth0 master bond0 34 34 ip netns exec client ip link set dev bond0 up 35 35 ip netns exec client ip addr add ${client_ip4}/24 dev bond0 36 36 ip netns exec client ping -c 5 $server_ip4 >/dev/null 37 37 38 - ip netns exec client ip link set dev eth0 down nomaster 38 + ip netns exec client ip link set dev eth0 nomaster 39 39 ip netns exec client ip link set dev bond0 down 40 40 ip netns exec client ip link set dev bond0 type bond mode 0 \ 41 41 arp_interval 1000 arp_ip_target "+${server_ip4}" 42 - ip netns exec client ip link set dev eth0 down master bond0 42 + ip netns exec client ip link set dev eth0 master bond0 43 43 ip netns exec client ip link set dev bond0 up 44 44 ip netns exec client ping -c 5 $server_ip4 >/dev/null 45 45