Skip to contentSkip to conversation

net/mlx5e: Fix NULL deref in PTP TX timestamp recovery warn

PATCH Applied Tariq Toukan 8 participants 8 messages Oct 15 – Oct 20

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx5e: Fix NULL deref in PTP TX timestamp recovery warn

From: Carolina Jubran <[email protected]>

PTP SQs are allocated via mlx5e_ptp_alloc_txqsq(), which never sets sq->channel. The excessive port timestamp delta recovery path incorrectly used sq->channel->netdev for netdev_warn(), causing a NULL pointer dereference. Use sq->netdev instead.

Fixes 391dad2e686f ("net/mlx5e: Recover SQ on excessive PTP TX timestamp delta")
---
 drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +1 -1
index 723f66a6bd63..2e1c3bb5a959 100644
@@ -98,7 +98,7 @@ static void mlx5e_skb_cb_hwtstamp_tx(struct sk_buff *skb,
 		ptpsq->cq_stats->abort_abs_diff_ns += diff;
 		if (diff > (NSEC_PER_SEC >> 1) &&
 		    !test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
-			netdev_warn(sq->channel->netdev,
+			netdev_warn(sq->netdev,
 				    "PTP TX timestamp difference between CQE and port exceeds threshold: %lld ns, recovering SQ %u\n",
 				    (s64)diff, sq->sqn);
 			queue_work(sq->priv->wq, &ptpsq->report_unhealthy_work);

base-commit: 513444cc62e231a11c9b15ea88de0890da9b2b4f

Signature · 1 line
2.44.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

#2 lore raw
Quoted 13 lines · On 15/10/2026 11:09, [email protected] wrote:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Quoted 8 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

Hi,

The issue was observed during our internal regression testing.

The kernel reported:

BUG: unable to handle page fault for address: 0000000000002ea8
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 1a9bfc067 P4D 1a9bfc067 PUD 1a9bfd067 PMD 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           OE
RIP: 0010:mlx5e_skb_cb_hwtstamp_handler+0x10c/0x140 [mlx5_core]
RAX: 0000000000000000
CR2: 0000000000002ea8
Call Trace:
  mlx5e_ptp_poll_ts_cq+0x228/0x5b0 [mlx5_core]
  mlx5e_ptp_napi_poll+0xad/0x380 [mlx5_core]
  ? mlx5e_napi_poll+0x750/0x7e0 [mlx5_core]
  __napi_poll+0x30/0x200
  net_rx_action+0x181/0x2e0
  handle_softirqs+0xdb/0x340
  __irq_exit_rcu+0xd9/0x100
  irq_exit_rcu+0xe/0x20
  common_interrupt+0xa4/0xb0

So far, the issue has only been observed during our regression testing, and I am still working on reproducing it reliably.

Thanks,
Carolina

maintainer
#3 lore raw
Quoted 48 lines · Carolina Jubran
Quoted 11 lines · On 15/10/2026 11:09, [email protected] wrote:

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

  - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

  - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Quoted 8 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

Hi,

The issue was observed during our internal regression testing.

The kernel reported:

BUG: unable to handle page fault for address: 0000000000002ea8
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 1a9bfc067 P4D 1a9bfc067 PUD 1a9bfd067 PMD 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           OE
RIP: 0010:mlx5e_skb_cb_hwtstamp_handler+0x10c/0x140 [mlx5_core]
RAX: 0000000000000000
CR2: 0000000000002ea8
Call Trace:
   mlx5e_ptp_poll_ts_cq+0x228/0x5b0 [mlx5_core]
   mlx5e_ptp_napi_poll+0xad/0x380 [mlx5_core]
   ? mlx5e_napi_poll+0x750/0x7e0 [mlx5_core]
   __napi_poll+0x30/0x200
   net_rx_action+0x181/0x2e0
   handle_softirqs+0xdb/0x340
   __irq_exit_rcu+0xd9/0x100
   irq_exit_rcu+0xe/0x20
   common_interrupt+0xa4/0xb0
Quoted 2 lines

So far, the issue has only been observed during our regression testing, and I am still working on reproducing it reliably.

For future patches please include such kind of info (specifically: the backtrace) in the commit message itself.

Thanks,

Paolo

#4 lore raw
In reply to Tariq Toukan
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines

From: Carolina Jubran <[email protected]>

PTP SQs are allocated via mlx5e_ptp_alloc_txqsq(), which never sets sq->channel. The excessive port timestamp delta recovery path incorrectly used sq->channel->netdev for netdev_warn(), causing a NULL pointer dereference. Use sq->netdev instead.

Fixes 391dad2e686f ("net/mlx5e: Recover SQ on excessive PTP TX timestamp delta")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#5 lore raw
In reply to Tariq Toukan
Quoted 7 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

PTP SQs are allocated via mlx5e_ptp_alloc_txqsq(), which never sets sq->channel. The excessive port timestamp delta recovery path incorrectly used sq->channel->netdev for netdev_warn(), causing a NULL pointer dereference. Use sq->netdev instead.

Quoted 7 lines
Fixes 391dad2e686f ("net/mlx5e: Recover SQ on excessive PTP TX timestamp

delta")

LGTM,

Signature · 2 lines
Regards,
Kalesh AP
Reviewed-by on v1 1/1
#6 lore raw
In reply to Tariq Toukan
Quoted 29 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

PTP SQs are allocated via mlx5e_ptp_alloc_txqsq(), which never sets sq->channel. The excessive port timestamp delta recovery path incorrectly used sq->channel->netdev for netdev_warn(), causing a NULL pointer dereference. Use sq->netdev instead.

Fixes 391dad2e686f ("net/mlx5e: Recover SQ on excessive PTP TX timestamp delta")
---
  drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +1 -1
index 723f66a6bd63..2e1c3bb5a959 100644
@@ -98,7 +98,7 @@ static void mlx5e_skb_cb_hwtstamp_tx(struct sk_buff *skb,
  		ptpsq->cq_stats->abort_abs_diff_ns += diff;
  		if (diff > (NSEC_PER_SEC >> 1) &&
  		    !test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
-			netdev_warn(sq->channel->netdev,
+			netdev_warn(sq->netdev,
  				    "PTP TX timestamp difference between CQE and port exceeds threshold: %lld ns, recovering SQ %u\n",
  				    (s64)diff, sq->sqn);
  			queue_work(sq->priv->wq, &ptpsq->report_unhealthy_work);
Quoted 1 line

base-commit: 513444cc62e231a11c9b15ea88de0890da9b2b4f

#7 lore raw
In reply to Tariq Toukan
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Thu, 15 Oct 2026 11:02:18 +0300 you wrote:

From: Carolina Jubran <[email protected]>

PTP SQs are allocated via mlx5e_ptp_alloc_txqsq(), which never sets sq->channel. The excessive port timestamp delta recovery path incorrectly used sq->channel->netdev for netdev_warn(), causing a NULL pointer dereference. Use sq->netdev instead.

[...]

Here is the summary with links:
- [net] net/mlx5e: Fix NULL deref in PTP TX timestamp recovery warn

    https://git.kernel.org/netdev/net/c/0df412012a26

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html