Skip to content

Commit 9772360

Browse files
author
CKI KWF Bot
committed
Merge: ice: fix NULL access of tx->in_use
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7313 JIRA: https://issues.redhat.com/browse/RHEL-84608 ice: fix NULL access of tx->in_use Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents a3dc36c + 4782f64 commit 9772360

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,12 +3230,14 @@ static irqreturn_t ice_ll_ts_intr(int __always_unused irq, void *data)
32303230
hw = &pf->hw;
32313231
tx = &pf->ptp.port.tx;
32323232
spin_lock_irqsave(&tx->lock, flags);
3233-
ice_ptp_complete_tx_single_tstamp(tx);
3233+
if (tx->init) {
3234+
ice_ptp_complete_tx_single_tstamp(tx);
32343235

3235-
idx = find_next_bit_wrap(tx->in_use, tx->len,
3236-
tx->last_ll_ts_idx_read + 1);
3237-
if (idx != tx->len)
3238-
ice_ptp_req_tx_single_tstamp(tx, idx);
3236+
idx = find_next_bit_wrap(tx->in_use, tx->len,
3237+
tx->last_ll_ts_idx_read + 1);
3238+
if (idx != tx->len)
3239+
ice_ptp_req_tx_single_tstamp(tx, idx);
3240+
}
32393241
spin_unlock_irqrestore(&tx->lock, flags);
32403242

32413243
val = GLINT_DYN_CTL_INTENA_M | GLINT_DYN_CTL_CLEARPBA_M |

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,16 +2882,19 @@ irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
28822882
*/
28832883
if (hw->dev_caps.ts_dev_info.ts_ll_int_read) {
28842884
struct ice_ptp_tx *tx = &pf->ptp.port.tx;
2885-
u8 idx;
2885+
u8 idx, last;
28862886

28872887
if (!ice_pf_state_is_nominal(pf))
28882888
return IRQ_HANDLED;
28892889

28902890
spin_lock(&tx->lock);
2891-
idx = find_next_bit_wrap(tx->in_use, tx->len,
2892-
tx->last_ll_ts_idx_read + 1);
2893-
if (idx != tx->len)
2894-
ice_ptp_req_tx_single_tstamp(tx, idx);
2891+
if (tx->init) {
2892+
last = tx->last_ll_ts_idx_read + 1;
2893+
idx = find_next_bit_wrap(tx->in_use, tx->len,
2894+
last);
2895+
if (idx != tx->len)
2896+
ice_ptp_req_tx_single_tstamp(tx, idx);
2897+
}
28952898
spin_unlock(&tx->lock);
28962899

28972900
return IRQ_HANDLED;

0 commit comments

Comments
 (0)