Skip to content

Commit 4dd0d5c

Browse files
jacob-kelleranguy11
authored andcommitted
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: ea9b847 ("ice: enable transmit timestamps for E810 devices") Signed-off-by: Jacob Keller <[email protected]> Tested-by: Gurucharan G <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 1f0cbb3 commit 4dd0d5c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
12671267
{
12681268
u8 idx;
12691269

1270+
spin_lock(&tx->lock);
1271+
12701272
for (idx = 0; idx < tx->len; idx++) {
12711273
u8 phy_idx = idx + tx->quad_offset;
12721274

@@ -1279,6 +1281,8 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
12791281
tx->tstamps[idx].skb = NULL;
12801282
}
12811283
}
1284+
1285+
spin_unlock(&tx->lock);
12821286
}
12831287

12841288
/**

0 commit comments

Comments
 (0)