Article View: linux.kernel.netdev
Article #23758Re: [PATCH net 05/10] net/mlx5e: Drop IPsec tunnel traffic if the neigh cannot be created
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 22:32
Date: Fri, 27 Nov 2026 22:32
177 lines
14816 bytes
14816 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch only covers the case where neighbour creation fails.
- [Medium] Setting attrs->drop = true when the neighbour cannot be
created permanently stops the SA's software lifetime worker.
- [Medium] The new 'attrs->drop = true' on neighbour-creation failure in
mlx5e_ipsec_init_macs() (ipsec.c:371) is not limited to the TX…
--
net/mlx5e: Drop IPsec tunnel traffic if the neigh cannot be created
This patch moves the attrs->drop assignment in mlx5e_ipsec_init_macs() so
it happens before the IS_ERR() check on the result of ipv4_neigh_create().
When the peer neighbour cannot be created, the tunnel packet offload SA
is now installed as a drop rule. Before, it forwarded traffic with an
all-zero destination MAC.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> index ea7a1ae2056fa..4daad648460fe 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> @@ -368,10 +368,10 @@ static void mlx5e_ipsec_init_macs(struct mlx5e_ipsec_sa_entry *sa_entry,
> n = ipv4_neigh_lookup(netdev, pkey);
> if (!n) {
> n = ipv4_neigh_create(netdev, pkey);
> + attrs->drop = true;
> if (IS_ERR(n))
> return;
[Severity: Medium]
Should this drop be limited to XFRM_DEV_OFFLOAD_OUT?
For an inbound SA, mlx5e_ipsec_init_macs() sets src = attrs->dmac (the
netdev's own MAC) and dst = attrs->smac (the peer MAC). The unresolved
peer MAC only becomes the source MAC of the L2 header that
setup_pkt_reformat() adds to the decrypted inner frame:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:setup_pkt_reformat() {
...
ether_addr_copy(eth_hdr->h_dest, attrs->dmac);
ether_addr_copy(eth_hdr->h_source, attrs->smac);
...
}
Before this patch, an RX SA in this state still delivered decrypted
traffic to the host, with h_source set to 00:00:00:00:00:00. With drop
set, rx_add_rule() now installs CRYPTO_DECRYPT|DROP:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:rx_add_rule() {
...
if (attrs->drop) {
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
rule = mlx5_add_flow_rules(rx->ft.sa, spec, &flow_act, NULL, 0);
...
}
n is an ERR_PTR here, so neigh_event_send() is never called and no
resolution starts.
Could inbound traffic for this SA stay blackholed until some unrelated
event creates and validates the neighbour? That can't happen while the
table is still full.
The commit message only describes the TX case ("add the TX SA ...").
[Severity: Medium]
Does setting drop here permanently stop the software lifetime worker for
this SA?
mlx5e_xfrm_add_state() queues sa_entry->dwork once, MLX5_IPSEC_RESCHED
after install. mlx5e_ipsec_handle_sw_limits() returns early when drop is
set and only re-queues itself at the end:
mlx5e_ipsec_handle_sw_limits() {
...
if (sa_entry->attrs.drop)
return;
...
xfrm_state_check_expire(x);
spin_unlock_bh(&x->lock);
queue_delayed_work(sa_entry->ipsec->wq, &dwork->dwork,
MLX5_IPSEC_RESCHED);
}
This IS_ERR() branch sends no probe. Drop is therefore almost certainly
still set when the worker first runs, and the worker is never queued
again.
If the neighbour resolves later, mlx5e_ipsec_handle_netdev_event()
clears the flag and reprograms the rules to forward:
attrs->drop = false;
mlx5e_accel_ipsec_fs_modify(sa_entry);
It does not re-arm the dwork. Would the SA then forward traffic without
any xfrm_state_check_expire() calls, so the soft and hard byte limits
are never enforced?
Before this patch, the IS_ERR() branch left drop false and the worker
kept running. The root cause seems to be that attrs->drop means both
"expired" and "neighbour unresolved".
A later commit in the series, "net/mlx5e: Copy back only replay_esn
after an IPsec ESN update", fixes the ESN rebuild variant of this
problem. At the end of the series, the early return in
mlx5e_ipsec_handle_sw_limits() and the missing re-arm in
mlx5e_ipsec_handle_netdev_event() are both still there.
> neigh_event_send(n, NULL);
> - attrs->drop = true;
> } else {
> neigh_ha_snapshot(addr, n, netdev);
> ether_addr_copy(dst, addr);
[Severity: Medium]
The commit message says this makes creation failure behave "as for a
created but still unresolved neigh". Does that hold outside the create
branch of the fallback path?
In this else branch, ipv4_neigh_lookup() can return an existing
neighbour that is INCOMPLETE or FAILED. Its zero ha is copied into dmac,
drop stays false, and no probe is sent.
The route path earlier in mlx5e_ipsec_init_macs() shows the same
symptom. dst_neigh_lookup() goes through
ipv4_dst_neigh_lookup()->ip_neigh_gw4(), which calls __neigh_create()
on a miss. It returns a new unresolved neighbour instead of NULL, so the
fallback is never reached:
n = dst_neigh_lookup(rt_dst_entry, pkey);
...
neigh_ha_snapshot(addr, n, netdev);
ether_addr_copy(dst, addr);
if (attrs->dir == XFRM_DEV_OFFLOAD_OUT &&
is_zero_ether_addr(addr))
neigh_event_send(n, NULL);
attrs->drop is never set on that path, and tx_add_rule() chooses the
action from attrs->drop alone:
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:tx_add_rule() {
...
if (attrs->drop)
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
else
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
...
}
Suppose a route to the peer exists but the next hop is not resolved yet,
for example the first SA toward a new peer. Won't the TX SA still be
installed with dmac 00:00:00:00:00:00 and forwarding enabled? That is
the symptom this commit describes.
Commit 9ab89bde13e5 describes this route path case ("the hardware rule
is programmed with an all-zero destination MAC address") but only adds a
probe, not a drop. The route path still has no drop at the end of the
series.
A later commit in the series, "net/mlx5e: Validate neighbour events
before updating IPsec SAs", fixes the related problem that gateway
neighbour updates were never matched.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126215614.792598-1-tariqt%40nvidia.com
Technical Details
Message-ID:
<179581873325.3135.13078869091632134545@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372969-linux-kernel-netdev=dewy.ruReferences:
<20261126215614.792598-6-tariqt@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372969-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 05/10] net/mlx5e: Drop IPsec tunnel traffic if the neigh cannot be created Date: Fri, 27 Nov 2026 22:32:13 +0000 Organization: Usenet Network Message-ID: <179581873325.3135.13078869091632134545@kernel.org> References: <20261126215614.792598-6-tariqt@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="834366"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:rxcYBty6ibCT9KtqDERwWe8xMvI= sha256:PAFxAwvW78OYMWO5O41SoEKYCCdhl6ZE6otBieianhE= sha1:u818H+4LdaGbl2vb+A/ii9/tXC0= sha256:eBfF9eVFmwuIPkZKkvE+9sD454jJk/Rw6BVCFK3Yhmk= 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 B70B3125F69; Sat, 28 Nov 2026 01:32:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 R3XzzeiT2QVM; Sat, 28 Nov 2026 01:32:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372969-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id E7CCB125F68; Sat, 28 Nov 2026 01:32:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id D95A22EDF4; Fri, 27 Nov 2026 22:32:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795818736; b=Qfts8/a+JXYPn5bCkeoSPDTAlRDcYUaIynfCnRFF7Mj7GEY1PCPmeiRSMFAyw88TFR4K 7HaeO3XU0VddwjxKNhAUaPtsYmsumGT1vEEWXJXYWcQ+Nl1dqGiTr3NF3yFXoXNxATaQ0 CNkOr59sQw6iSuTgLIMnm5uM20B4XvXSX0/cXoSWV9yJ+EMJvAlYcGa2gv2oZXiMWrRkZ E3uFbVpr1mT6GpmFqQUz71y3EhHrw5rVSy/JUtNDO8YqOSlsPJQmjZd9jG9ArIPdoQkDh AGo9GpMpNHMpcN47JoYWgL2AN6L9bSugvQbH7kNrZoKfFXrvluNreFQe0IlgnoNstnw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795818736; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=u72xTXVvYB/9IUxRBnyZjZslgn01rWlXQAM57XGcgvo=; b=Xz7tGWujKoqfX5JXvojZhjbN2XSB50PJwOcSposJ18LRubv1ch+S2h5ZJab8DsqaIi8x biubdF4AuCxpvc/kAjFEQlz43osQZ70vn/yz45ceMDbDYFauwdMeixBuhKJlam95ykKiE repRf6hcZUs6jWVJ5GTM5n+rFXGwm4KqrAp6coIMeUVDOBZmvyBqbDry0iggU9EZPMyWn PFLwnXLdabLCY3eC/k15G5uTMPILFVMRXwhiBCuRe5Dnsq4pyTYhw9fSmTOIB7cUdlzn1 lHAVW45TWdwsjTMQaesFuWJoTHVDnJIZTQ3P3ZzQNhEFXrer0YSiCHMk+bYJq6krBbg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bA64pSbp; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A58F1606A326; Fri, 27 Nov 2026 22:32:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bA64pSbp X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795818735; b=VKAUi//1f4v0F56vxcs0J5Kh7DC6a01t/4fnWg8W1ryV9RISsc1I4/yA2fzdeFtlU0wo chDEASqJGDEViyCD9yp7Y8fTi/c4Wx7td5GXD+drYkL6rkpU6p0stuhKVKB/xhPSirSIP IFJU2EIieeCO8ERhmUYpayR7YkCKvO9LtwWarhtj02daL18oJ1nmOhkSqTx0bHMIczOo4 AHuxl/j5ptP66YuQkyPWtbexZggDeAavWIDfdo80QgGoj2E/65rcUaXfM0K/BSeqXHJ2x 8fETXL3LkQzHeKjpzcKG8xQLTsB9cvrFbWZfHw7HpDr9Du4AZRlyp6JDMkwY4X3Yr5g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795818735; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=u72xTXVvYB/9IUxRBnyZjZslgn01rWlXQAM57XGcgvo=; b=yXJsOApQHiRuUgB1KncNU5QaeZznfNJ5APKN9GJyS2EcLhlVLjMFTKX+LYafcDD4hsGH nok/a0EdZQjFypBkCoUt83AqJG5TA4V3BH5T3vfYHeOHOinyL3ZAaWXI4+GNOTW4C6kCY /veNfwln19J6hDq3vePX2NBQbL9AcGcHafwz7sXMc8M2nJWEKDiAEVobft3huXsZOd+i2 f+XLS6vb5xVEMmq3zVOU23vMqtWzG3r/GFViAdnH576uo2awkDrUEiMiRflzzZrMk6t7k zmlDrf/KgMS/txtJWRG99M+bkUPPyTdVpP6E0mLzKCj4dDIY3f0oug+Zh4irZba/XHg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bA64pSbp; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7024606A321; Fri, 27 Nov 2026 22:32:15 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF4261F0092A; Fri, 27 Nov 2026 22:32:13 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795818735; bh=u72xTXVvYB/9IUxRBnyZjZslgn01rWlXQAM57XGcgvo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bA64pSbpLy4zZGX5vKWzhtx52dF9QJ9db3RM5wAA15Xpx303abDCRI46yt7ley9xm cgNSBWFhM8QF0Zp2/WsbkfuHwJDt6dKgzhzfKrfSL6RqB113aWbABgucgSfFj2mnQw NLwyDOVRYe9oCColPyl/rlEyzfmgNjObMwzP8cZa65rFOW0BWxykkd3DJZZu4CFYtS K1yfxQImpneKpLRsAzlJv7Mlz+KgRNpIkgdbwXRxORCY6MNhxkpGkjA9lIKAMgIL+v +K2zyW1arQX1U+LxWVPWk7pBlae/UZrxXST45HPDbf7+nGUxybNTdnZ0GFMIQnYqfE MXynmv95WMrVQ== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, willemb@google.com, parri.andrea@gmail.com, borisp@nvidia.com, cratiu@nvidia.com, eedmunds@nvidia.com, gal@nvidia.com, jmassar@nvidia.com, jianbol@nvidia.com, kuniyu@google.com, leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com, phaddad@nvidia.com, raeds@nvidia.com, saeedm@nvidia.com, horms@kernel.org, sridhar.samudrala@intel.com, steffen.klassert@secunet.com X-In-Reply-To: <20261126215614.792598-6-tariqt@nvidia.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list