Re: [PATCH net v2 12/12] net: au1000: reject frames larger than the TX bounce buffer
From: netdev-bot+sashiko
Date: Mon Nov 16 2026 - 08:51:23 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message understates how the overflow can be reached.
Pre-existing issues:
- [High] Several other drivers in drivers/net/ethernet/amd/ have the same
unchecked copy of skb->len bytes into a fixed-size TX buffer.
--
net: au1000: reject frames larger than the TX bounce buffer
This patch adds a length check to au1000_tx(). Frames larger than
MAX_BUF_SIZE are now dropped and counted in tx_dropped instead of being
copied past the end of the TX bounce buffer.
> au1000_tx() copies skb->len bytes into a MAX_BUF_SIZE coherent buffer
> without checking the length. Oversized non-GSO packets can reach this
> path through AF_PACKET with PACKET_VNET_HDR and PACKET_TX_RING, whose
> MTU checks are skipped when a virtio header is present.
[Severity: Low]
Is this description narrower than the real exposure? It reads as though
PACKET_TX_RING is required. The plain sendmsg path through packet_snd()
seems to get to the same place:
net/packet/af_packet.c:packet_snd() {
...
if (!vnet_hdr.gso_type &&
(len > dev->mtu + reserve + VLAN_HLEN + extra_len))
goto out_unlock;
...
}
After that, __virtio_net_hdr_to_skb() only marks the skb as GSO when the
payload is larger than gso_size:
/* Too small packets are not really GSO ones. */
if (skb->len - nh_off > gso_size) {
Take a 4000-byte frame sent with gso_type=TCPV4 and gso_size=65000. It
would skip the MTU check and reach au1000_tx() as an ordinary non-GSO skb.
Real GSO skbs also get through, because gso_size is never checked against
dev->mtu. au1000 has no TSO, so validate_xmit_skb() segments them in
software into frames that can be larger than 2048 bytes.
The new check in au1000_tx() catches all of these paths, so the code
looks right. Could the commit message also mention the packet_snd() and
GSO routes?
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index d60430a3795ed..d8855ccf87aa1 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
> @@ -1008,6 +1008,12 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
> int i;
> unsigned long flags;
>
> + if (unlikely(skb->len > MAX_BUF_SIZE)) {
> + dev->stats.tx_dropped++;
> + dev_kfree_skb_any(skb);
> + return NETDEV_TX_OK;
> + }
[Severity: High]
This is a pre-existing issue that this patch did not introduce. Do other
drivers in drivers/net/ethernet/amd/ need the same check?
Several lance_start_xmit() implementations copy skb->len bytes into
fixed-size TX slots with no upper bound. Their slots are smaller than
au1000's 2048-byte MAX_BUF_SIZE, so a frame one byte over the limit
already overruns the slot:
7990.c:lance_start_xmit()
skb_copy_from_linear_data(skb, (void *)&ib->tx_buf[entry][0], skblen);
(skblen = skb->len, tx_buf slots are 1544 bytes)
a2065.c:lance_start_xmit()
skb_copy_from_linear_data(skb, (void *)&ib->tx_buf[entry][0], skblen);
(skblen = max(skb->len, ETH_ZLEN), tx_buf slots are 1544 bytes)
sunlance.c:lance_start_xmit()
PIO path: lance_piocopy_from_skb()
DMA path: skb_copy_from_linear_data(skb, &ib->tx_buf [entry][0], skblen);
(TX_BUFF_SIZE is 1544)
sun3lance.c:lance_start_xmit()
skb_copy_from_linear_data(skb, PKTBUF_ADDR(head), skb->len);
(PKT_BUF_SZ is 1544)
atarilance.c:lance_start_xmit()
lp->memcpy_f( PKTBUF_ADDR(head), (void *)skb->data, skb->len );
(PKT_BUF_SZ is 1544)
declance.c:lance_start_xmit()
cp_to_buf(lp->type, lp->tx_buf_ptr_cpu[entry], skb->data, len);
(len = skb->len, TX buffers are 1536 bytes)
Using the AF_PACKET route from the commit message, can an oversized frame
in these drivers overwrite the next TX slot and then the RX buffers?
For frames near 64KB, the copy also looks like it would run past the end
of the lance_init_block or shared memory area.
Triggering this needs CAP_NET_RAW in the device's netns. The hardware is
legacy: Amiga, Sun, Atari, DEC and HP300/MVME.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112045301.3669532-1-f.fainelli%40gmail.com