]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
588207bacea88b90764a099df370ef2a355ed457
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Thu Jul 19 08:32:06 CEST 2018
2 From: Or Gerlitz <ogerlitz@mellanox.com>
3 Date: Mon, 4 Jun 2018 19:46:53 +0300
4 Subject: net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager
5
6 From: Or Gerlitz <ogerlitz@mellanox.com>
7
8 [ Upstream commit 8ffd569aaa818f2624ca821d9a246342fa8b8c50 ]
9
10 The check for cpu hit statistics was not returning immediate false for
11 any non vport rep netdev and hence we crashed (say on mlx5 probed VFs) if
12 user-space tool was calling into any possible netdev in the system.
13
14 Fix that by doing a proper check before dereferencing.
15
16 Fixes: 1d447a39142e ('net/mlx5e: Extendable vport representor netdev private data')
17 Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
18 Reported-by: Eli Cohen <eli@melloanox.com>
19 Reviewed-by: Eli Cohen <eli@melloanox.com>
20 Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 ---
23 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++++-
24 1 file changed, 5 insertions(+), 1 deletion(-)
25
26 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
27 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
28 @@ -804,8 +804,12 @@ bool mlx5e_is_uplink_rep(struct mlx5e_pr
29 static bool mlx5e_is_vf_vport_rep(struct mlx5e_priv *priv)
30 {
31 struct mlx5e_rep_priv *rpriv = priv->ppriv;
32 - struct mlx5_eswitch_rep *rep = rpriv->rep;
33 + struct mlx5_eswitch_rep *rep;
34
35 + if (!MLX5_CAP_GEN(priv->mdev, eswitch_flow_table))
36 + return false;
37 +
38 + rep = rpriv->rep;
39 if (rep && rep->vport != FDB_UPLINK_VPORT)
40 return true;
41