netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiefeng <jiefeng.z.zhang@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, pabeni@redhat.com,
	andrew+netdev@lunn.ch, edumazet@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: atlantic: fix fragment overflow handling in RX path
Date: Mon, 17 Nov 2025 16:42:01 -0800	[thread overview]
Message-ID: <20251117164201.4eab5834@kernel.org> (raw)
In-Reply-To: <CADEc0q5uRhf164cur2SL3YG+fqzbiderZrSqnH2nY0CkhGHKTw@mail.gmail.com>

On Mon, 17 Nov 2025 19:38:54 +0800 Jiefeng wrote:
> From f78a25e62b4a0155beee0449536ba419feeddb75 Mon Sep 17 00:00:00 2001
> From: Jiefeng Zhang <jiefeng.z.zhang@gmail.com>
> Date: Mon, 17 Nov 2025 16:17:37 +0800
> Subject: [PATCH] net: atlantic: fix fragment overflow handling in RX path
> 
> The atlantic driver can receive packets with more than MAX_SKB_FRAGS (17)
> fragments when handling large multi-descriptor packets. This causes an
> out-of-bounds write in skb_add_rx_frag_netmem() leading to kernel panic.
> 
> The issue occurs because the driver doesn't check the total number of
> fragments before calling skb_add_rx_frag(). When a packet requires more
> than MAX_SKB_FRAGS fragments, the fragment index exceeds the array bounds.
> 
> Add a check in __aq_ring_rx_clean() to ensure the total number of fragments
> (including the initial header fragment and subsequent descriptor fragments)
> does not exceed MAX_SKB_FRAGS. If it does, drop the packet gracefully
> and increment the error counter.

This submissions is not formatted correctly. Use git or b4 to send your
code. Please also make sure you read:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html

As for the patch -- what's the frag size the driver uses? If it's 
larger than max_mtu / 16 the overflow is impossible.

  reply	other threads:[~2025-11-18  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 11:38 [PATCH] net: atlantic: fix fragment overflow handling in RX path Jiefeng
2025-11-18  0:42 ` Jakub Kicinski [this message]
2025-11-18 12:57   ` Jiefeng
  -- strict thread matches above, loose matches on Subject: below --
2025-11-17  9:16 Jiefeng

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=20251117164201.4eab5834@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiefeng.z.zhang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).