From: Tariq Toukan <tariqt@nvidia.com>
To: Josef Bacik <josef@toxicpanda.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Manish Chopra <manishc@marvell.com>,
Rahul Verma <rahulv@marvell.com>,
GR-Linux-NIC-Dev@marvell.com,
Shahed Shaikh <shshaikh@marvell.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rdma@vger.kernel.org, xen-devel@lists.xenproject.org,
intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH net-next v2 03/10] net/mlx5e: check for failure when pulling the Ethernet header after XDP
Date: Tue, 13 Oct 2026 13:02:06 +0300 [thread overview]
Message-ID: <5f025a06-da70-4cd9-96b4-d86f6d3ce9c4@nvidia.com> (raw)
In-Reply-To: <20261008-b4-pskb-pull-tail-drivers-v2-3-8f2bd9bee138@toxicpanda.com>
On 09/10/2026 0:02, 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@toxicpanda.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
Hi,
I posted relevant comments on V1.
https://lore.kernel.org/all/d2d64d12-24a9-4bf1-b505-3008e0e25c40@nvidia.com/
> 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;
> + }
> }
> } else {
> if (xdp_buff_has_frags(&mxbuf->xdp)) {
>
next prev parent reply other threads:[~2026-10-13 10:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 21:02 [PATCH net-next v2 00/10] net: stop calling __pskb_pull_tail() from drivers Josef Bacik
2026-10-08 21:02 ` [PATCH net-next v2 01/10] net: skbuff: add skb_drop_empty_frags() Josef Bacik
2026-10-09 21:03 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 02/10] net: ftmac100: check for failure when pulling in the RX header Josef Bacik
2026-10-09 21:04 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 03/10] net/mlx5e: check for failure when pulling the Ethernet header after XDP Josef Bacik
2026-10-09 21:03 ` sashiko-bot
2026-10-13 10:02 ` Tariq Toukan [this message]
2026-10-08 21:02 ` [PATCH net-next v2 04/10] net: niu: check for failure when pulling in the RX header Josef Bacik
2026-10-09 21:03 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 05/10] xen/netfront: check for failure when pulling in xennet_fill_frags() Josef Bacik
2026-10-09 21:03 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 06/10] e1000: use pskb_may_pull() in the 82544 TSO workaround Josef Bacik
2026-10-09 21:03 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 07/10] e1000e: use pskb_may_pull() in the 82571/2/3 " Josef Bacik
2026-10-09 21:04 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 08/10] netxen: use pskb_may_pull() to pull excess TX frags into the head Josef Bacik
2026-10-09 21:04 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 09/10] qlcnic: " Josef Bacik
2026-10-09 21:04 ` sashiko-bot
2026-10-08 21:02 ` [PATCH net-next v2 10/10] net: skbuff: don't reset truesize in skb_condense() if the pull fails Josef Bacik
2026-10-09 21:04 ` sashiko-bot
2026-10-08 21:11 ` [PATCH net-next v2 00/10] net: stop calling __pskb_pull_tail() from drivers Jakub Kicinski
2026-10-09 13:43 ` Josef Bacik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5f025a06-da70-4cd9-96b4-d86f6d3ce9c4@nvidia.com \
--to=tariqt@nvidia.com \
--cc=GR-Linux-NIC-Dev@marvell.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jgross@suse.com \
--cc=josef@toxicpanda.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=oleksandr_tyshchenko@epam.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rahulv@marvell.com \
--cc=saeedm@nvidia.com \
--cc=shshaikh@marvell.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox