]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.0.19/net-mlx5e-additional-check-for-flow-destination-comparison.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 5.0.19 / net-mlx5e-additional-check-for-flow-destination-comparison.patch
CommitLineData
b12f0636
GKH
1From foo@baz Wed 22 May 2019 08:35:12 AM CEST
2From: Dmytro Linkin <dmitrolin@mellanox.com>
3Date: Thu, 2 May 2019 15:21:38 +0000
4Subject: net/mlx5e: Additional check for flow destination comparison
5
6From: Dmytro Linkin <dmitrolin@mellanox.com>
7
8[ Upstream commit c979c445a88e1c9dd7d8f90838c10456ae4ecd09 ]
9
10Flow destination comparison has an inaccuracy: code see no
11difference between same vf ports, which belong to different pfs.
12
13Example: If start ping from VF0 (PF1) to VF1 (PF1) and mirror
14all traffic to VF0 (PF2), icmp reply to VF0 (PF1) and mirrored
15flow to VF0 (PF2) would be determined as same destination. It lead
16to creating flow handler with rule nodes, which not added to node
17tree. When later driver try to delete this flow rules we got
18kernel crash.
19
20Add comparison of vhca_id field to avoid this.
21
22Fixes: 1228e912c934 ("net/mlx5: Consider encapsulation properties when comparing destinations")
23Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
24Reviewed-by: Roi Dayan <roid@mellanox.com>
25Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
26Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
27Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28---
29 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 ++
30 1 file changed, 2 insertions(+)
31
32--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
33+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
34@@ -1375,6 +1375,8 @@ static bool mlx5_flow_dests_cmp(struct m
35 if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
36 d1->vport.num == d2->vport.num &&
37 d1->vport.flags == d2->vport.flags &&
38+ ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
39+ (d1->vport.vhca_id == d2->vport.vhca_id) : true) &&
40 ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ?
41 (d1->vport.reformat_id == d2->vport.reformat_id) : true)) ||
42 (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&