git: 17cf7760a98a - main - mlx5en: guard against empty eth_proto_oper mask
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Jun 2026 18:23:56 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=17cf7760a98a87c33d0415e2d2e1d4b24dd69e4d
commit 17cf7760a98a87c33d0415e2d2e1d4b24dd69e4d
Author: Slava Shwartsman <slavash@nvidia.com>
AuthorDate: 2026-06-10 16:43:08 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-17 18:23:15 +0000
mlx5en: guard against empty eth_proto_oper mask
eth_proto_oper is used to derive the active media mode, but an empty
mask leaves no valid bit for ilog2() to consume. Treat this as an
invalid carrier update, reset the active media state, and report the
unexpected PTYS value.
Reviewed by: kib
Tested by: Wafa Hamzah <wafah@nvidia.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking
---
sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
index 35450776e54e..6d8e1ba41709 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
@@ -445,9 +445,16 @@ mlx5e_update_carrier(struct mlx5e_priv *priv)
ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet);
eth_proto_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext,
eth_proto_oper);
+ if (eth_proto_oper == 0) {
+ priv->media_active_last = IFM_ETHER;
+ if_setbaudrate(priv->ifp, 1);
+ mlx5_en_err(priv->ifp, "eth_proto_oper is 0\n");
+ return;
+ }
connector_type = MLX5_GET(ptys_reg, out, connector_type);
if (connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER)
connector_type = MLX5E_PORT_UNKNOWN;
+
i = ilog2(eth_proto_oper);
if (ext) {