net/mlx5e: Always clear dest encap in neigh-update-del
authorChris Mi <cmi@nvidia.com>
Mon, 5 Dec 2022 01:22:50 +0000 (09:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:13 +0000 (12:02 +0100)
commitc6e6fb4240319b804cdd03fdb7d8787271330b35
tree04b6522c455c5101d6ed5e9845650b2544bf578a
parent7d88b67d6bec4ea4f79de4f4e8928eea7c52bfe9
net/mlx5e: Always clear dest encap in neigh-update-del

[ Upstream commit 2951b2e142ecf6e0115df785ba91e91b6da74602 ]

The cited commit introduced a bug for multiple encapsulations flow.
If one dest encap becomes invalid, the flow is set slow path flag.
But when other dests encap become invalid, they are not cleared due
to slow path flag of the flow. When neigh-update-add is running, it
will use invalid encap.

Fix it by checking slow path flag after clearing dest encap.

Fixes: 9a5f9cc794e1 ("net/mlx5e: Fix possible use-after-free deleting fdb rule")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Roi Dayan <roid@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/tc_tun_encap.c