netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Dmytro Linkin <dmitrolin@mellanox.com>,
	Roi Dayan <roid@mellanox.com>, Vlad Buslov <vladbu@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 09/11] net/mlx5e: Additional check for flow destination comparison
Date: Fri, 17 May 2019 20:19:58 +0000	[thread overview]
Message-ID: <20190517201910.32216-10-saeedm@mellanox.com> (raw)
In-Reply-To: <20190517201910.32216-1-saeedm@mellanox.com>

From: Dmytro Linkin <dmitrolin@mellanox.com>

Flow destination comparison has an inaccuracy: code see no
difference between same vf ports, which belong to different pfs.

Example: If start ping from VF0 (PF1) to VF1 (PF1) and mirror
all traffic to VF0 (PF2), icmp reply to VF0 (PF1) and mirrored
flow to VF0 (PF2) would be determined as same destination. It lead
to creating flow handler with rule nodes, which not added to node
tree. When later driver try to delete this flow rules we got
kernel crash.

Add comparison of vhca_id field to avoid this.

Fixes: 1228e912c934 ("net/mlx5: Consider encapsulation properties when comparing destinations")
Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index fb5b61727ee7..d7ca7e82a832 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1380,6 +1380,8 @@ static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
 		if ((d1->type == MLX5_FLOW_DESTINATION_TYPE_VPORT &&
 		     d1->vport.num == d2->vport.num &&
 		     d1->vport.flags == d2->vport.flags &&
+		     ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_VHCA_ID) ?
+		      (d1->vport.vhca_id == d2->vport.vhca_id) : true) &&
 		     ((d1->vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) ?
 		      (d1->vport.reformat_id == d2->vport.reformat_id) : true)) ||
 		    (d1->type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE &&
-- 
2.21.0


  parent reply	other threads:[~2019-05-17 20:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 20:19 [pull request][net 00/11] Mellanox, mlx5 fixes 2019-05-17 Saeed Mahameed
2019-05-17 20:19 ` [net 01/11] net/mlx5: Imply MLXFW in mlx5_core Saeed Mahameed
2019-05-17 20:19 ` [net 02/11] net/mlx5: Add meaningful return codes to status_to_err function Saeed Mahameed
2019-05-17 20:19 ` [net 03/11] net/mlx5: E-Switch, Correct type to u16 for vport_num and int for vport_index Saeed Mahameed
2019-05-17 20:19 ` [net 04/11] net/mlx5: Fix peer pf disable hca command Saeed Mahameed
2019-05-17 20:19 ` [net 05/11] net/mlx5e: Fix wrong xmit_more application Saeed Mahameed
2019-05-17 20:19 ` [net 06/11] net/mlx5e: Fix ethtool rxfh commands when CONFIG_MLX5_EN_RXNFC is disabled Saeed Mahameed
2019-05-17 20:19 ` [net 07/11] net/mlx5e: Fix number of vports for ingress ACL configuration Saeed Mahameed
2019-05-17 20:19 ` [net 08/11] net/mlx5e: Add missing ethtool driver info for representors Saeed Mahameed
2019-05-17 20:19 ` Saeed Mahameed [this message]
2019-05-17 20:20 ` [net 10/11] net/mlx5e: Fix no rewrite fields with the same match Saeed Mahameed
2019-05-17 20:20 ` [net 11/11] net/mlx5e: Fix possible modify header actions memory leak Saeed Mahameed
2019-05-17 22:19 ` [pull request][net 00/11] Mellanox, mlx5 fixes 2019-05-17 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190517201910.32216-10-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dmitrolin@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@mellanox.com \
    --cc=vladbu@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).