Skip to content

Commit f00c9fd

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-10/-/merge_requests/1476 JIRA: https://issues.redhat.com/browse/RHEL-113042 ice: fix NULL access of tx->in_use Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@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 119c9d4 + 0d0fb57 commit f00c9fd

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
@@ -3216,12 +3216,14 @@ static irqreturn_t ice_ll_ts_intr(int __always_unused irq, void *data)
32163216
hw = &pf->hw;
32173217
tx = &pf->ptp.port.tx;
32183218
spin_lock_irqsave(&tx->lock, flags);
3219-
ice_ptp_complete_tx_single_tstamp(tx);
3219+
if (tx->init) {
3220+
ice_ptp_complete_tx_single_tstamp(tx);
32203221

3221-
idx = find_next_bit_wrap(tx->in_use, tx->len,
3222-
tx->last_ll_ts_idx_read + 1);
3223-
if (idx != tx->len)
3224-
ice_ptp_req_tx_single_tstamp(tx, idx);
3222+
idx = find_next_bit_wrap(tx->in_use, tx->len,
3223+
tx->last_ll_ts_idx_read + 1);
3224+
if (idx != tx->len)
3225+
ice_ptp_req_tx_single_tstamp(tx, idx);
3226+
}
32253227
spin_unlock_irqrestore(&tx->lock, flags);
32263228

32273229
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
@@ -2876,16 +2876,19 @@ irqreturn_t ice_ptp_ts_irq(struct ice_pf *pf)
28762876
*/
28772877
if (hw->dev_caps.ts_dev_info.ts_ll_int_read) {
28782878
struct ice_ptp_tx *tx = &pf->ptp.port.tx;
2879-
u8 idx;
2879+
u8 idx, last;
28802880

28812881
if (!ice_pf_state_is_nominal(pf))
28822882
return IRQ_HANDLED;
28832883

28842884
spin_lock(&tx->lock);
2885-
idx = find_next_bit_wrap(tx->in_use, tx->len,
2886-
tx->last_ll_ts_idx_read + 1);
2887-
if (idx != tx->len)
2888-
ice_ptp_req_tx_single_tstamp(tx, idx);
2885+
if (tx->init) {
2886+
last = tx->last_ll_ts_idx_read + 1;
2887+
idx = find_next_bit_wrap(tx->in_use, tx->len,
2888+
last);
2889+
if (idx != tx->len)
2890+
ice_ptp_req_tx_single_tstamp(tx, idx);
2891+
}
28892892
spin_unlock(&tx->lock);
28902893

28912894
return IRQ_HANDLED;

0 commit comments

Comments
 (0)