net/mlx5e: Fix operation precedence bug in port timestamping napi_poll context
authorRahul Rameshbabu <rrameshbabu@nvidia.com>
Thu, 23 Nov 2023 02:32:11 +0000 (18:32 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Feb 2024 00:19:02 +0000 (16:19 -0800)
commit40e0d0746390c5b0c31144f4f1688d72f3f8d790
tree37f91b89529a4ae5cfbb642244b519e9a2dc3422
parent9ed46144cff3598a5cf79955630e795ff9af5b97
net/mlx5e: Fix operation precedence bug in port timestamping napi_poll context

[ Upstream commit 3876638b2c7ebb2c9d181de1191db0de8cac143a ]

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: 92214be5979c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c