Skip to content

Commit

Permalink
net/mlx5e: Set PTP channel pointer explicitly to NULL
Browse files Browse the repository at this point in the history
[ Upstream commit 1c2cdf0 ]

When closing the PTP channel, set its pointer explicitly to NULL. PTP
channel is opened on demand, the code verify the pointer validity before
access. Nullify it when closing the PTP channel to avoid unexpected
behavior.

Fixes: 145e563 ("net/mlx5e: Add TX PTP port object support")
Signed-off-by: Aya Levin <ayal@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>
  • Loading branch information
Aya Levin authored and gregkh committed Mar 30, 2021
1 parent 87b5652 commit 871c0ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2443,8 +2443,10 @@ void mlx5e_close_channels(struct mlx5e_channels *chs)
{
int i;

if (chs->port_ptp)
if (chs->port_ptp) {
mlx5e_port_ptp_close(chs->port_ptp);
chs->port_ptp = NULL;
}

for (i = 0; i < chs->num; i++)
mlx5e_close_channel(chs->c[i]);
Expand Down

0 comments on commit 871c0ab

Please sign in to comment.