]>
Commit | Line | Data |
---|---|---|
b12f0636 GKH |
1 | From foo@baz Wed 22 May 2019 08:35:12 AM CEST |
2 | From: Dmytro Linkin <dmitrolin@mellanox.com> | |
3 | Date: Thu, 2 May 2019 15:21:38 +0000 | |
4 | Subject: net/mlx5e: Additional check for flow destination comparison | |
5 | ||
6 | From: Dmytro Linkin <dmitrolin@mellanox.com> | |
7 | ||
8 | [ Upstream commit c979c445a88e1c9dd7d8f90838c10456ae4ecd09 ] | |
9 | ||
10 | Flow destination comparison has an inaccuracy: code see no | |
11 | difference between same vf ports, which belong to different pfs. | |
12 | ||
13 | Example: If start ping from VF0 (PF1) to VF1 (PF1) and mirror | |
14 | all traffic to VF0 (PF2), icmp reply to VF0 (PF1) and mirrored | |
15 | flow to VF0 (PF2) would be determined as same destination. It lead | |
16 | to creating flow handler with rule nodes, which not added to node | |
17 | tree. When later driver try to delete this flow rules we got | |
18 | kernel crash. | |
19 | ||
20 | Add comparison of vhca_id field to avoid this. | |
21 | ||
22 | Fixes: 1228e912c934 ("net/mlx5: Consider encapsulation properties when comparing destinations") | |
23 | Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com> | |
24 | Reviewed-by: Roi Dayan <roid@mellanox.com> | |
25 | Reviewed-by: Vlad Buslov <vladbu@mellanox.com> | |
26 | Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> | |
27 | Signed-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 && |