From: sashiko-bot@kernel.org
To: "Joas Antonio dos Santos" <joasantonio108@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net] net: usb: smsc75xx: reject frames shorter than the FCS
Date: Wed, 11 Nov 2026 09:03:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-208652@kernel.org> (raw)
In-Reply-To: <20261110-smsc75xx-rx-fcs-v1-1-4e048bfc28f3@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: usb: smsc75xx: short non-final frames in
smsc75xx_rx_fixup() read uninit memory
--
commit c9531c5cff866a425adb994e4854a216487a72e0
Author: Joas Antonio dos Santos <joasantonio108@gmail.com>
net: usb: smsc75xx: reject frames shorter than the FCS
This commit adds a minimum frame size check in smsc75xx_rx_fixup() to
reject frames shorter than ETH_FCS_LEN before subtracting 4 for the FCS.
> diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
> index 6f72a3f159079..e923fa6c17857 100644
> --- a/drivers/net/usb/smsc75xx.c
> +++ b/drivers/net/usb/smsc75xx.c
> @@ -2217,6 +2217,13 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
> return 0;
> }
>
> + if (unlikely(size < ETH_FCS_LEN)) {
> + netif_dbg(dev, rx_err, dev->net,
> + "size err rx_cmd_a=0x%08x\n",
> + rx_cmd_a);
> + return 0;
> + }
> +
> /* last frame in this batch */
> if (skb->len == size) {
> smsc75xx_rx_csum_offload(dev, skb, rx_cmd_a,
[Severity: Medium]
Should this check for size < ETH_HLEN + ETH_FCS_LEN instead of
size < ETH_FCS_LEN?
For a non-final frame in a batch (skb->len != size) with size in 4..17,
smsc75xx_rx_fixup() copies only 0..13 bytes (size - 4) into ax_skb->data
and passes ax_skb directly to usbnet_skb_return(). Unlike rx_process(),
which checks skb->len < ETH_HLEN for the final frame, usbnet_skb_return()
calls eth_type_trans() unconditionally, where eth_skb_pkt_type() and
eth_type_trans() read eth->h_dest and eth->h_proto from uninitialized
memory past the copied bytes in ax_skb->data.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-smsc75xx-rx-fcs-v1-1-4e048bfc28f3@gmail.com?part=1
prev parent reply other threads:[~2026-11-11 9:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 9:03 [PATCH net] net: usb: smsc75xx: reject frames shorter than the FCS Joas Antonio dos Santos via B4 Relay
2026-11-10 22:41 ` Andrew Lunn
2026-11-11 2:00 ` Joas Antonio
2026-11-11 9:03 ` sashiko-bot [this message]
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=sashiko-outbox-208652@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=joasantonio108@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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).