Skip to content

Commit a1bde8c

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net
-queue Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2022-04-26 This series contains updates to ice driver only. Ivan Vecera removes races related to VF message processing by changing mutex_trylock() call to mutex_lock() and moving additional operations to occur under mutex. Petr Oros increases wait time after firmware flash as current time is not sufficient. Jake resolves a use-after-free issue for mailbox snapshot. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 71cffeb + b668f4c commit a1bde8c

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6929,12 +6929,15 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
69296929

69306930
dev_dbg(dev, "rebuilding PF after reset_type=%d\n", reset_type);
69316931

6932+
#define ICE_EMP_RESET_SLEEP_MS 5000
69326933
if (reset_type == ICE_RESET_EMPR) {
69336934
/* If an EMP reset has occurred, any previously pending flash
69346935
* update will have completed. We no longer know whether or
69356936
* not the NVM update EMP reset is restricted.
69366937
*/
69376938
pf->fw_emp_reset_disabled = false;
6939+
6940+
msleep(ICE_EMP_RESET_SLEEP_MS);
69386941
}
69396942

69406943
err = ice_init_all_ctrlq(hw);

drivers/net/ethernet/intel/ice/ice_sriov.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,8 +1046,8 @@ int ice_sriov_configure(struct pci_dev *pdev, int num_vfs)
10461046

10471047
if (!num_vfs) {
10481048
if (!pci_vfs_assigned(pdev)) {
1049-
ice_mbx_deinit_snapshot(&pf->hw);
10501049
ice_free_vfs(pf);
1050+
ice_mbx_deinit_snapshot(&pf->hw);
10511051
if (pf->lag)
10521052
ice_enable_lag(pf->lag);
10531053
return 0;

drivers/net/ethernet/intel/ice/ice_virtchnl.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3625,6 +3625,8 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
36253625
return;
36263626
}
36273627

3628+
mutex_lock(&vf->cfg_lock);
3629+
36283630
/* Check if VF is disabled. */
36293631
if (test_bit(ICE_VF_STATE_DIS, vf->vf_states)) {
36303632
err = -EPERM;
@@ -3642,32 +3644,20 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
36423644
err = -EINVAL;
36433645
}
36443646

3645-
if (!ice_vc_is_opcode_allowed(vf, v_opcode)) {
3646-
ice_vc_send_msg_to_vf(vf, v_opcode,
3647-
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED, NULL,
3648-
0);
3649-
ice_put_vf(vf);
3650-
return;
3651-
}
3652-
36533647
error_handler:
36543648
if (err) {
36553649
ice_vc_send_msg_to_vf(vf, v_opcode, VIRTCHNL_STATUS_ERR_PARAM,
36563650
NULL, 0);
36573651
dev_err(dev, "Invalid message from VF %d, opcode %d, len %d, error %d\n",
36583652
vf_id, v_opcode, msglen, err);
3659-
ice_put_vf(vf);
3660-
return;
3653+
goto finish;
36613654
}
36623655

3663-
/* VF is being configured in another context that triggers a VFR, so no
3664-
* need to process this message
3665-
*/
3666-
if (!mutex_trylock(&vf->cfg_lock)) {
3667-
dev_info(dev, "VF %u is being configured in another context that will trigger a VFR, so there is no need to handle this message\n",
3668-
vf->vf_id);
3669-
ice_put_vf(vf);
3670-
return;
3656+
if (!ice_vc_is_opcode_allowed(vf, v_opcode)) {
3657+
ice_vc_send_msg_to_vf(vf, v_opcode,
3658+
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED, NULL,
3659+
0);
3660+
goto finish;
36713661
}
36723662

36733663
switch (v_opcode) {
@@ -3780,6 +3770,7 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
37803770
vf_id, v_opcode, err);
37813771
}
37823772

3773+
finish:
37833774
mutex_unlock(&vf->cfg_lock);
37843775
ice_put_vf(vf);
37853776
}

0 commit comments

Comments
 (0)