From f5344e8333c4e649254a9dcded5184874ea71c76 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 16 Sep 2016 11:53:53 +0000 Subject: [PATCH] mlx5en: Verify port type is ethernet before creating network device Else the mlx5en driver might attach to infiniband ports. Sponsored by: Mellanox Technologies MFC after: 1 week --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 70a1af89a59b..340c038fce87 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2654,6 +2654,9 @@ mlx5e_check_required_hca_cap(struct mlx5_core_dev *mdev) /* TODO: add more must-to-have features */ + if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH) + return (-ENODEV); + return (0); }