net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager
authorOr Gerlitz <ogerlitz@mellanox.com>
Mon, 4 Jun 2018 16:46:53 +0000 (19:46 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jul 2018 12:28:44 +0000 (14:28 +0200)
commitb216867c02ac1146f3b66768845814150732f1e2
tree1e1e7ef13390ba5dc3e661e0f5511ee435d78436
parent1d8dda4444fa0e8799a40d74e3502aac841ea002
net/mlx5e: Don't attempt to dereference the ppriv struct if not being eswitch manager

[ Upstream commit 8ffd569aaa818f2624ca821d9a246342fa8b8c50 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c