Article View: linux.kernel.netdev
Article #2252[PATCH net v2 1/2] net/mlx5: HWS, fix modify header pattern compare on big-endian
From: Alexandre Cassen
Date: Mon, 12 Oct 2026 10:19
Date: Mon, 12 Oct 2026 10:19
37 lines
7459 bytes
7459 bytes
mlx5hws_pat_compare_pattern() casts each __be64 action to __be32 to
compare only its control dword. On big-endian this keeps the data dword
instead, which HWS clears from the pattern of set and add actions. Two
such actions writing the same value into different fields then share a
pattern and the second rule modifies the wrong field.
Read the first dword of each action from memory instead. Little-endian
behavior is unchanged.
Discovered by an AI code review agent [1] and confirmed by code
inspection. Not reproduced for lack of big-endian hardware running HWS.
Fixes: aefc15a0fa1c ("net/mlx5: HWS, added modify header pattern and args handling")
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261010120147.135825-1-acassen%40corp.free.fr [1]
Signed-off-by: Alexandre Cassen <acassen@corp.free.fr>
---
.../net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
index 9af449c2b4d5..512299b59fd0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
@@ -116,8 +116,8 @@ static bool mlx5hws_pat_compare_pattern(int cur_num_of_actions,
return false;
} else {
/* Compare just the control, not the values */
- if ((__force __be32)actions[i] !=
- (__force __be32)cur_actions[i])
+ if (*(__be32 *)&actions[i] !=
+ *(__be32 *)&cur_actions[i])
return false;
}
}
--
2.43.0
Technical Details
Message-ID:
<20261012101937.1335231-2-acassen@corp.free.fr>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344892-linux-kernel-netdev=dewy.ruReferences:
<20261012101937.1335231-1-acassen@corp.free.fr>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-344892-linux-kernel-netdev=dewy.ru From: acassen@corp.free.fr (Alexandre Cassen) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 1/2] net/mlx5: HWS, fix modify header pattern compare on big-endian Date: Mon, 12 Oct 2026 12:19:34 +0200 Organization: Usenet Network Message-ID: <20261012101937.1335231-2-acassen@corp.free.fr> References: <20261012101937.1335231-1-acassen@corp.free.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1742991"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:IrCuWddZYFTluU+B4/SFwkDbxXI= sha256:kbitAohHcHITUignFz9148TCSvHDhC2Bg00eJ5qy0aE= sha1:m2IJFBZsu8J9zWTpxCymhFRpuqw= sha256:lC1QauTB7SVA/aPAJT0AKs2hf0k6d2OaCNzibe+2lDM= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 431BB10FB8B; Mon, 12 Oct 2026 13:20:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -0.75 X-Spam-Status: No, score=-0.75 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=corp.free.fr X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cQuzyd5sCwqu; Mon, 12 Oct 2026 13:20:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-344892-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=corp.free.fr X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id CFBF810FB72; Mon, 12 Oct 2026 13:20:21 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id C807824A72; Mon, 12 Oct 2026 10:20:13 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B36D3F12CE; Mon, 12 Oct 2026 10:20:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=corp.free.fr header.i=@corp.free.fr header.b="tTc0hWep" X-Received: from rcs.proxad.net (rcs.proxad.net [212.27.60.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 496763EF66B; Mon, 12 Oct 2026 10:19:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.27.60.169 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791800407; cv=none; b=fxrS4qVwGD+wFuNtD+8QXzKPjK+ILWAQrr7DismQLrknnEor+czY1e0x/VOjGS1kZuGoirnwAfns6hwfciz7+fwL+vtI7+vMWiZOnbnMf0kA37zlLcdWGxzfGQL8+vJZMBqUZ4nF9N79lb0JxBtOe9faStUw/slMPdcWWihmSaE= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791800407; c=relaxed/simple; bh=yBGMhd2W137o3Fy8V3ZHpeoCKfvOMcuKL3olnYwv1Gs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dGEDXkIninbxIKM1OY2GULDPD2KupGWmejzxOz3lV3WHNLhydr10dIb3Jt3ZVCkeVxY1mePCB6Qnt/KxG5IcCD0TnidzKEQ02x+df1YPUntthZ1rFZOOlijcedctIDw4LLFR19KAEljIgj3mrBSf4HUhBbsqXGaTRtlvzQkj9LQ= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corp.free.fr; spf=pass smtp.mailfrom=corp.free.fr; dkim=pass (2048-bit key) header.d=corp.free.fr header.i=@corp.free.fr header.b=tTc0hWep; arc=none smtp.client-ip=212.27.60.169 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=corp.free.fr X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=corp.free.fr X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=corp.free.fr; s=rcs; t=1791800384; bh=yBGMhd2W137o3Fy8V3ZHpeoCKfvOMcuKL3olnYwv1Gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tTc0hWepvGvqwNTTr7SJNHVd4ZTrM9qUQBoqJN/Wv6zmhdkkIgGmn/TRlZKf2tvl1 ols8mz72q8l5BrSdDX40bE54Iyy6valMvJXOBzP8ESgKqQWm9SaAhB/AJ02w2gd5bR 1zsOV9Oq0IH6iTzOallAyZzUnI9jqGIi9halUysplMY1zu9J3qUh9M4jI/jG32iJV1 E94IZ134BnEd8cgUOSHui0grwMGmP9TyHToC/O796Gb2nfHaJM2pH8jv/tq9jzVHLm VoOJHUyYl6FIrQ5mNNDGmcxRTgsXW5wJhxrD653Xi29pqZ1OT0gPArkRrrGwClvhNN E7yBQ2keNLuTA== X-Received: from lnxos-dev.home (82-66-150-212.subs.proxad.net [82.66.150.212]) by rcs.proxad.net (Postfix) with ESMTPSA id 5708C44C12CC; Mon, 12 Oct 2026 12:19:44 +0200 (CEST) X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Moshe Shemesh <moshe@nvidia.com>, Yevgeny Kliteynik <kliteyn@nvidia.com>, Hamdan Agbariya <hamdani@nvidia.com>, netdev@vger.kernel.org, linux-rdma@vger.kernel.org X-Mailer: git-send-email 2.43.0 X-In-Reply-To: <20261012101937.1335231-1-acassen@corp.free.fr> X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>