From: David Laight <david.laight.linux@gmail.com>
To: "Pablo Vallespín Aranguren" <pablopva014@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"open list:TULIP NETWORK DRIVERS" <netdev@vger.kernel.org>,
"open list:TULIP NETWORK DRIVERS" <linux-parisc@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] net: tulip: xircom_cb: drop runt frames before skb copy
Date: Fri, 31 Jul 2026 20:26:29 +0100 [thread overview]
Message-ID: <20260731202629.10ff97e6@pumpkin> (raw)
In-Reply-To: <amzqfjeo0Yo1p0Rd@ThinkPad-P15>
On Fri, 31 Jul 2026 20:33:34 +0200
Pablo Vallespín Aranguren <pablopva014@gmail.com> wrote:
> investigate_read_descriptor() takes the 11-bit packet length straight
> from the device-written descriptor and subtracts 4 for the CRC. A
> length below 4 underflows pkt_len to a negative value, which is then
> passed to skb_put_data() as a huge unsigned length and corrupts memory
> past the end of the freshly allocated skb.
Have you checked that that hardware can actually set a short value?
I'd expect that packets shorter than 64 bytes (including the crc) are
dropped as 'runts' and probably don't even use a ring entry.
Of course, if you think the device might lie all bets are off.
(Without an iommu is can write anywhere in host memory...)
David
>
> Drop the frame as a length error if pkt_len is negative after CRC
> removal.
>
> Signed-off-by: Pablo Vallespín Aranguren <pablopva014@gmail.com>
> Assisted-by: gkh_clanker_t1000
> ---
> drivers/net/ethernet/dec/tulip/xircom_cb.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/dec/tulip/xircom_cb.c b/drivers/net/ethernet/dec/tulip/xircom_cb.c
> index e5d2ede13845..62c64da1c8fa 100644
> --- a/drivers/net/ethernet/dec/tulip/xircom_cb.c
> +++ b/drivers/net/ethernet/dec/tulip/xircom_cb.c
> @@ -1110,6 +1110,11 @@ investigate_read_descriptor(struct net_device *dev, struct xircom_private *card,
> /* minus 4, we don't want the CRC */
> struct sk_buff *skb;
>
> + if (pkt_len < 0) {
> + dev->stats.rx_length_errors++;
> + goto out;
> + }
> +
> if (pkt_len > 1518) {
> netdev_err(dev, "Packet length %i is bogus\n", pkt_len);
> pkt_len = 1518;
next prev parent reply other threads:[~2026-07-31 19:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 18:33 [PATCH] net: tulip: xircom_cb: drop runt frames before skb copy Pablo Vallespín Aranguren
2026-07-31 19:26 ` David Laight [this message]
2026-07-31 20:56 ` Pablo Vallespín Aranguren
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=20260731202629.10ff97e6@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablopva014@gmail.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