Skip to content

Commit 3876638

Browse files
Binary-EaterSaeed Mahameed
authored andcommitted
net/mlx5e: Fix operation precedence bug in port timestamping napi_poll context
Indirection (*) is of lower precedence than postfix increment (++). Logic in napi_poll context would cause an out-of-bound read by first increment the pointer address by byte address space and then dereference the value. Rather, the intended logic was to dereference first and then increment the underlying value. Fixes: 92214be ("net/mlx5e: Update doorbell for port timestamping CQ before the software counter") Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent cfbc360 commit 3876638

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static void mlx5e_ptp_handle_ts_cqe(struct mlx5e_ptpsq *ptpsq,
213213
mlx5e_ptpsq_mark_ts_cqes_undelivered(ptpsq, hwtstamp);
214214
out:
215215
napi_consume_skb(skb, budget);
216-
md_buff[*md_buff_sz++] = metadata_id;
216+
md_buff[(*md_buff_sz)++] = metadata_id;
217217
if (unlikely(mlx5e_ptp_metadata_map_unhealthy(&ptpsq->metadata_map)) &&
218218
!test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state))
219219
queue_work(ptpsq->txqsq.priv->wq, &ptpsq->report_unhealthy_work);

0 commit comments

Comments
 (0)