Re: [PATCH net v2] net: usb: smsc75xx: reject frames without a full header and FCS

From
Andrew Lunn <andrew@lunn.ch>
Date
2026-11-11 16:48:27
Also in
linux-usb, lkml, stable
Reply to
Joas Antonio dos Santos via B4 Relay, 2026-11-11
quoted hunk ↗ jump to hunk
+			if (unlikely(size < ETH_HLEN + ETH_FCS_LEN)) {
+				netif_dbg(dev, rx_err, dev->net,
+					  "size err rx_cmd_a=0x%08x\n",
+					  rx_cmd_a);
+				return 0;
+			}
This looks good as far as it goes.

However:

static inline int rx_process(struct usbnet *dev, struct sk_buff *skb)
{
	if (dev->driver_info->rx_fixup &&
	    !dev->driver_info->rx_fixup(dev, skb)) {
		/* With RX_ASSEMBLE, rx_fixup() must update counters */
		if (!(dev->driver_info->flags & FLAG_RX_ASSEMBLE))
			dev->net->stats.rx_errors++;

What is the value of FLAG_RX_ASSEMBLE in flags?

		return -EPROTO;
	}
	// else network stack removes extra byte if we forced a short packet

	/* all data was already cloned from skb inside the driver */
	if (dev->driver_info->flags & FLAG_MULTI_PACKET)
		return -EALREADY;

	if (skb->len < ETH_HLEN) {
		dev->net->stats.rx_errors++;
		dev->net->stats.rx_length_errors++;

Should rx_length_errors also be incremented?

       Andrew
Thread (3 messages) 3 messages, 3 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help