[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH net-next 2/9] net/mlx5e: check for failure when pulling the Ethernet header after XDP
- To: Josef Bacik <josef@xxxxxxxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Andrew Lunn <andrew+netdev@xxxxxxx>
- From: Tariq Toukan <tariqt@xxxxxxxxxx>
- Date: Tue, 13 Oct 2026 00:12:11 +0300
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ja9ntG+tzMYb+Vs+gsr7sUW+0KSJ9yCDv0HIuAXjetM=; b=yp1tcLPQbuSyQixDhmfUNx/rCN3NjeGYY2/bNg9Y8z/1wmwTU6r2L0Wi30VDJMJ+r4QoBJPN6RKy6yvGV73J0EYynDykp2xv36SU/a6Y5PWcH1oQynxCp8sdOWuxegUAKNXHUrZ0rxvO/IAuNGVd0B1m2XFEOPLjVhH6rRvvVeEv/Fy7B8xmg0JIXCvRlO7mHxFRu4HuzQT8c+ehAd+iAjXQniDlRjdufHYuZBp869D4FwX+5EU5Nsp/lgGefkwzP2RhmVg8x3UwDKO/uDnPaWW9OCVwoG9VuhvL3GRIGhqz7a/K8sydmvb7CRuZrNCoEWqG/W64bFSZboJ8/LYKYQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HpNm3VC2BrYH141VoNprDWQ2WCaE/S1qCSO7eHebrUhiXAM7S/OzGtn5fgaCgGPh/X1HJt5NEbXVX08gkLAg9oq3M3r8eHXEpGFnDmSLv5CPJzfp27ryAFUl4ap5+VoF4w3AsJ4iFB4mNKqFXW6OvuLeOgBKXseluZTU7JRxwZdzxUNGA+TyDIoRBucqgOZqkx4H/CxoxqGSdT+cuwnScQjrA+iYwtGPVty2d9oH97H65j7amSBUqXZRirb/Xzu0iag7ZC5AjbE7deV3UX2RVFYm5iAvBaTW3Tjp5lxC4t01lnSTFNJdEJ7ryo+jRIqzlJ30mEBAgS7x8R8HSn+tkg==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=temperror header.s=selector2 header.d=Nvidia.com header.i="@Nvidia.com"
- Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com;
- Cc: Saeed Mahameed <saeedm@xxxxxxxxxx>, Tariq Toukan <tariqt@xxxxxxxxxx>, Mark Bloch <mbloch@xxxxxxxxxx>, Leon Romanovsky <leon@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>, Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>, Manish Chopra <manishc@xxxxxxxxxxx>, Rahul Verma <rahulv@xxxxxxxxxxx>, GR-Linux-NIC-Dev@xxxxxxxxxxx, Shahed Shaikh <shshaikh@xxxxxxxxxxx>, Simon Horman <horms@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-rdma@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, intel-wired-lan@xxxxxxxxxxxxxxxx
- Delivery-date: Thu, 15 Oct 2026 12:07:12 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07/10/2026 21:16, Josef Bacik wrote:
When an XDP program leaves less than ETH_HLEN in the linear part of a
multi-buffer packet, mlx5e_skb_from_cqe_mpwrq_nonlinear() pulls the rest
of the Ethernet header in from the frags with __pskb_pull_tail() and
ignores the return value. If that pull fails, eth_type_trans() later
finds less than ETH_HLEN in the head and BUG()s in __skb_pull().
Use pskb_may_pull() instead and drop the packet if it fails. Pulling
min(ETH_HLEN, skb->len) keeps today's behaviour for a frame shorter
than an Ethernet header.
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index e3f915beebe1..b1e1e30a77e2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -2060,9 +2060,12 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq,
struct mlx5e_mpw_info *w
pagep->frags++;
while (++pagep < frag_page);
- if (len < ETH_HLEN)
- __pskb_pull_tail(skb, min(ETH_HLEN - len,
- skb->data_len));
+ if (len < ETH_HLEN &&
+ !pskb_may_pull(skb, min(ETH_HLEN, skb->len))) {
+ rq->stats->buff_alloc_err++;
+ dev_kfree_skb_any(skb);
+ return NULL;
I understand that the real goal is the API change, not this branch.
As of today, this is dead code.
I'd at least mention this in the commit message. You already do so in
the cover letter, but it vanishes...
Something like:
This can't fail today, since the head always has at least
MLX5E_RX_MAX_HEAD bytes of tailroom and the skb is not cloned.
+ }
}
} else {
if (xdp_buff_has_frags(&mxbuf->xdp)) {
|