From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [net 1/9] net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager
Date: Tue, 26 Jun 2018 17:21:10 -0700 [thread overview]
Message-ID: <20180627002118.9856-2-saeedm@mellanox.com> (raw)
In-Reply-To: <20180627002118.9856-1-saeedm@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
The check for cpu hit statistics was not returning immediate false for
any non vport rep netdev and hence we crashed (say on mlx5 probed VFs) if
user-space tool was calling into any possible netdev in the system.
Fix that by doing a proper check before dereferencing.
Fixes: 1d447a39142e ('net/mlx5e: Extendable vport representor netdev private data')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Eli Cohen <eli@melloanox.com>
Reviewed-by: Eli Cohen <eli@melloanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 57987f6546e8..378ad74518ec 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -837,8 +837,12 @@ bool mlx5e_is_uplink_rep(struct mlx5e_priv *priv)
static bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv)
{
struct mlx5e_rep_priv *rpriv = priv->ppriv;
- struct mlx5_eswitch_rep *rep = rpriv->rep;
+ struct mlx5_eswitch_rep *rep;
+ if (!MLX5_CAP_GEN(priv->mdev, eswitch_flow_table))
+ return false;
+
+ rep = rpriv->rep;
if (rep && rep->vport != FDB_UPLINK_VPORT)
return true;
--
2.17.0
next prev parent reply other threads:[~2018-06-27 0:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 0:21 [pull request][net 0/9] Mellanox, mlx5 fixes 2018-06-26 Saeed Mahameed
2018-06-27 0:21 ` Saeed Mahameed [this message]
2018-06-27 0:21 ` [net 2/9] net/mlx5: E-Switch, Avoid setup attempt if not being e-switch manager Saeed Mahameed
2018-06-27 0:21 ` [net 3/9] net/mlx5e: Avoid dealing with vport representors " Saeed Mahameed
2018-06-27 0:21 ` [net 4/9] IB/mlx5: " Saeed Mahameed
2018-06-27 0:21 ` [net 5/9] net/mlx5: E-Switch, Disallow vlan/spoofcheck setup if not being esw manager Saeed Mahameed
2018-06-27 0:21 ` [net 6/9] net/mlx5: Fix required capability for manipulating MPFS Saeed Mahameed
2018-06-27 0:21 ` [net 7/9] net/mlx5: Fix wrong size allocation for QoS ETC TC regitster Saeed Mahameed
2018-06-27 0:21 ` [net 8/9] net/mlx5: Fix incorrect raw command length parsing Saeed Mahameed
2018-06-27 0:21 ` [net 9/9] net/mlx5: Fix command interface race in polling mode Saeed Mahameed
2018-06-28 7:57 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2018-06-26 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=20180627002118.9856-2-saeedm@mellanox.com \
--to=saeedm@mellanox.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@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