forked from mirrors/linux
		
	ice: Stop processing VF messages during teardown
When VFs are setup and torn down in quick succession, it is possible
that a VF is torn down by the PF while the VF's virtchnl requests are
still in the PF's mailbox ring. Processing the VF's virtchnl request
when the VF itself doesn't exist results in undefined behavior. Fix
this by adding a check to stop processing virtchnl requests when VF
teardown is in progress.
Fixes: ddf30f7ff8 ("ice: Add handler to configure SR-IOV")
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									50ac747984
								
							
						
					
					
						commit
						c503e63200
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -234,6 +234,7 @@ enum ice_pf_state {
 | 
			
		|||
	ICE_VFLR_EVENT_PENDING,
 | 
			
		||||
	ICE_FLTR_OVERFLOW_PROMISC,
 | 
			
		||||
	ICE_VF_DIS,
 | 
			
		||||
	ICE_VF_DEINIT_IN_PROGRESS,
 | 
			
		||||
	ICE_CFG_BUSY,
 | 
			
		||||
	ICE_SERVICE_SCHED,
 | 
			
		||||
	ICE_SERVICE_DIS,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -615,6 +615,8 @@ void ice_free_vfs(struct ice_pf *pf)
 | 
			
		|||
	struct ice_hw *hw = &pf->hw;
 | 
			
		||||
	unsigned int tmp, i;
 | 
			
		||||
 | 
			
		||||
	set_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state);
 | 
			
		||||
 | 
			
		||||
	if (!pf->vf)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -680,6 +682,7 @@ void ice_free_vfs(struct ice_pf *pf)
 | 
			
		|||
				i);
 | 
			
		||||
 | 
			
		||||
	clear_bit(ICE_VF_DIS, pf->state);
 | 
			
		||||
	clear_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state);
 | 
			
		||||
	clear_bit(ICE_FLAG_SRIOV_ENA, pf->flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4415,6 +4418,10 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event)
 | 
			
		|||
	struct device *dev;
 | 
			
		||||
	int err = 0;
 | 
			
		||||
 | 
			
		||||
	/* if de-init is underway, don't process messages from VF */
 | 
			
		||||
	if (test_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	dev = ice_pf_to_dev(pf);
 | 
			
		||||
	if (ice_validate_vf_id(pf, vf_id)) {
 | 
			
		||||
		err = -EINVAL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue