From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Aamir Ahmed <elb12345@hotmail.co.uk>
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>,
Lucas Stach <dev@lynxeye.de>,
Peter Korsgaard <peter@korsgaard.com>,
Deepanshu Kartikey <kartikey406@gmail.com>,
Ethan Nelson-Moore <enelsonmoore@gmail.com>,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] net: usb: asix: reject a truncated Data header in rx_fixup
Date: Wed, 16 Sep 2026 10:50:21 +0300 [thread overview]
Message-ID: <aqpKPXiVESngnVhp@ashevche-desk.local> (raw)
In-Reply-To: <AS8P251MB0001D5442318B9E58797D230C8BA2@AS8P251MB0001.EURP251.PROD.OUTLOOK.COM>
On Tue, Sep 15, 2026 at 11:57:24PM +0100, Aamir Ahmed wrote:
> asix_rx_fixup_internal() runs its parsing loop while two bytes remain,
> but the branch that starts a new frame reads a four-byte Data header.
> Only a two-byte tail is special-cased, via split_head, so a three-byte
> tail reaches that read and leaves offset at skb->len + 1. The clamp
> below it then takes the unsigned difference skb->len - offset, which
> wraps, so copy_length becomes the full length the device asked for:
> skb_put_data() copies from one byte past the received data and
> usbnet_skb_return() passes the frame to the stack, before the trailing
> skb->len != offset check can report it.
>
> Reject a Data header that does not fit and reset the parser state, as
> the other malformed-header paths do.
>
> Only a device emitting an odd skb->len can get there, since offset
> always advances by an even number of bytes.
...
> int asix_rx_fixup_internal(struct usbnet *dev, struct sk_buff *skb,
> + if (offset + sizeof(u32) > skb->len) {
> + netdev_err(dev->net, "asix_rx_fixup() Short Data header, offset %d, len %d\n",
> + offset, skb->len);
> + reset_asix_rx_fixup_info(rx);
> + return 0;
> + }
I don't know the rules about __func__ in the error messages in net, but above
may be simplified as
netdev_err(dev->net, "%s(): Short Data header, offset %d, len %d\n",
__func__, offset, skb->len);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-09-16 7:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 22:57 Aamir Ahmed
2026-09-16 7:50 ` Andy Shevchenko [this message]
2026-09-16 8:19 ` Aamir Ahmed
2026-09-16 9:48 ` Andy Shevchenko
2026-09-17 22:57 netdev-bot+sashiko
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=aqpKPXiVESngnVhp@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dev@lynxeye.de \
--cc=edumazet@google.com \
--cc=elb12345@hotmail.co.uk \
--cc=enelsonmoore@gmail.com \
--cc=kartikey406@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter@korsgaard.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
all inboxes | Powered by JetHome®