mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ice: add lock around Tx timestamp tracker flush
The driver didn't take the lock while flushing the Tx tracker, which
could cause a race where one thread is trying to read timestamps out
while another thread is trying to read the tracker to check the
timestamps.
Avoid this by ensuring that flushing is locked against read accesses.
Fixes: ea9b847cda ("ice: enable transmit timestamps for E810 devices")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									1f0cbb3e89
								
							
						
					
					
						commit
						4dd0d5c33c
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1267,6 +1267,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
 | 
			
		|||
{
 | 
			
		||||
	u8 idx;
 | 
			
		||||
 | 
			
		||||
	spin_lock(&tx->lock);
 | 
			
		||||
 | 
			
		||||
	for (idx = 0; idx < tx->len; idx++) {
 | 
			
		||||
		u8 phy_idx = idx + tx->quad_offset;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1279,6 +1281,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
 | 
			
		|||
			tx->tstamps[idx].skb = NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spin_unlock(&tx->lock);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue