Skip to content

Commit aa7a8bf

Browse files
committed
ice: fix NULL access of tx->in_use in ice_ll_ts_intr
jira LE-4694 Rebuild_History Non-Buildable kernel-6.12.0-55.43.1.el10_0 commit-author Jacob Keller <jacob.e.keller@intel.com> commit f648633 Recent versions of the E810 firmware have support for an extra interrupt to handle report of the "low latency" Tx timestamps coming from the specialized low latency firmware interface. Instead of polling the registers, software can wait until the low latency interrupt is fired. This logic makes use of the Tx timestamp tracking structure, ice_ptp_tx, as it uses the same "ready" bitmap to track which Tx timestamps complete. Unfortunately, the ice_ll_ts_intr() function does not check if the tracker is initialized before its first access. This results in NULL dereference or use-after-free bugs similar to the issues fixed in the ice_ptp_ts_irq() function. Fix this by only checking the in_use bitmap (and other fields) if the tracker is marked as initialized. The reset flow will clear the init field under lock before it tears the tracker down, thus preventing any use-after-free or NULL access. Fixes: 82e71b2 ("ice: Enable SW interrupt from FW for LL TS") Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit f648633) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent a66f202 commit aa7a8bf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,12 +3204,14 @@ static irqreturn_t ice_ll_ts_intr(int __always_unused irq, void *data)
32043204
hw = &pf->hw;
32053205
tx = &pf->ptp.port.tx;
32063206
spin_lock_irqsave(&tx->lock, flags);
3207-
ice_ptp_complete_tx_single_tstamp(tx);
3207+
if (tx->init) {
3208+
ice_ptp_complete_tx_single_tstamp(tx);
32083209

3209-
idx = find_next_bit_wrap(tx->in_use, tx->len,
3210-
tx->last_ll_ts_idx_read + 1);
3211-
if (idx != tx->len)
3212-
ice_ptp_req_tx_single_tstamp(tx, idx);
3210+
idx = find_next_bit_wrap(tx->in_use, tx->len,
3211+
tx->last_ll_ts_idx_read + 1);
3212+
if (idx != tx->len)
3213+
ice_ptp_req_tx_single_tstamp(tx, idx);
3214+
}
32133215
spin_unlock_irqrestore(&tx->lock, flags);
32143216

32153217
val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |

0 commit comments

Comments
 (0)