🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18060

Re: [PATCH net v2 12/12] net: au1000: reject frames larger than the TX bounce buffer

#18060
From: Florian Fainelli
Date: Tue, 17 Nov 2026 19:19
126 lines
16198 bytes
On 11/16/26 05:50, netdev-bot+sashiko@kernel.org wrote:
> 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.
> 

Agreed. I have expanded the commit message to cover both packet_snd() 
and TX_RING, including packets left non-GSO after virtio-header 
conversion and oversized segments produced by software GSO. The existing 
length check covers these cases.

The other AMD drivers require separate validation and fixes; they are 
outside this au1000 series.

pw-bot: cr
-- 
Florian
Technical Details
Message-ID: <78fc6217-463d-4ad7-9bc5-d737a435ec3e@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365553-linux-kernel-netdev=dewy.ru
References: <20261112045301.3669532-13-f.fainelli@gmail.com> <179483705182.3136.18065066878486336390@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365553-linux-kernel-netdev=dewy.ru
From: f.fainelli@gmail.com (Florian Fainelli)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 12/12] net: au1000: reject frames larger than the
 TX bounce buffer
Date: Tue, 17 Nov 2026 11:19:58 -0800
Organization: Usenet Network
Message-ID: <78fc6217-463d-4ad7-9bc5-d737a435ec3e@gmail.com>
References: <20261112045301.3669532-13-f.fainelli@gmail.com>
 <179483705182.3136.18065066878486336390@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2408448"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:AiG/QXlWntdu6LrgRoLQecvkQhU= sha256:0Ca0PKBUadownq3JrMOR9f3XDr7vSGbr80Ww4OiH+9I=
	sha1:U/lxqf71eHqJRclBX3wI4qdI+Ak= sha256:R81zweVsHjvFWjVWzwLJebULUBbj+tfL7JcFWz+tFac=
Content-Language: en-US, fr-FR
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B5980115053; Tue, 17 Nov 2026 22:20:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id yQmtPZGBZGh7;
	Tue, 17 Nov 2026 22:20:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365553-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id E67CF115051; Tue, 17 Nov 2026 22:20:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7088537851; Tue, 17 Nov 2026 19:20:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794943204;
	b=45UiivkyH11fyEdfAPJ1maW42A8DfLtA2Oj7cX8peTR/5UXxtEHb3A4C3qqN6tfkZljx
	 7BRiFdWDU56vUPpD+uA48p0FVthvILa6yqJAVV6gBfPd+ZCUiZxpM92nq+sGLqkJHKcpT
	 qeyVjNHd2lf4bOYIk4mQroAG2nhQ9Pis1UgJB5TbSsFRd7TBgIAKZ++zFxLjE2aWwctz3
	 7tuiz0pqOe81ijZ1kzx5ByMUL7vN6/6Tr2RXKtMXKjAMTHTkezVVh6Ij0fZ/z0FbKyKXw
	 PXICvz0InTKzOU2/qK+wLDorKc//KFOWtQuiAikW/uktQjAH7Ink66b3+X/1zmmsj8g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794943204;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=5f5C80g30fAPj/I2D0TndVTdrcqmqXcICX0m5JKKxiE=;
	b=N3R+nCnc1KyyfQ80GWr0hWxdpCWl4fZyt2jKjpog0UlHDXzYGxuReYp+VS/9YFSPXUrg
	 y+a8Awc2ZJHZG8phG9VbbesFzEDZ8maaho2XKkrWjyiP54HYG8aCyfhZ7x35a4HUfM61k
	 B3eE4aYuFAUGbOOdSJ837WmXX3JntA7oTM4ZjSWQIosqylciwczlz801U2tz9bq4xmeuP
	 JzT9FAyrN310sgrObG6D/ZWtrdgN51p6JAF+MHMLefN73egSj82j+6l+vzhyCdBeFVNmd
	 PV2TounLKKEZmnqAPRlkZn107vrIB/6L+6MqD+tcadNDyMHbpwNxy7Kf+/GvjevthFg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=U0pAsIZa;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E1096606A336;
	Tue, 17 Nov 2026 19:20:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=U0pAsIZa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794943203;
	b=JNQisXdTm6Be6yEC8xYhK4UXCSz23jMohq/KkmxDXudlpdtz0l+9pit4QbbLHBNgtas+
	 lYOzzbxeX9kGGdbyW4P48FxkCDc0IP9wsFAG6cN2RG4oxo4uWkmmEu3mnhgkxSi3718rs
	 S9jik8PTglmJj8YK6aHs/tpL7yWDwR0b5XW5ZOQYsKngQ2QD9ctNEZH3pmxM4PF4akMO+
	 3LepWq1eYccUekJI3jYnl5bACSJiRYbLp/gPXeh2bN9BGlPXmY/EWS8sGsaPGtDZ1eUAz
	 Ei3ICDrtOOB7wuYASGNVI987kXBsqfQyEscLWWB9gQiuliIEpinJSISpTzDaIoMf8KA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794943203;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date:
	 MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language:
	 From:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=5f5C80g30fAPj/I2D0TndVTdrcqmqXcICX0m5JKKxiE=;
	b=2dUJXhM6XnOcF74TAiOWCbq/1c3PwhAjy1Uhjf8cQUIWa5PpTYmWxJ/d/1rSasCgShZD
	 KT0Hn6pFdWTFLCwhSg9honuA6ggRhMwweNQEw+pXnlOZ1mYHzmXFJIKVjhvLI/MxMFJoN
	 UtJgREIagHJADFrrzTY7gkwpNnep2B6OLGSUmdVjwFn6Q3sBmWk05+kJRsJZG2G0WBBtn
	 FFVjM4+G9mKbWiTtlDLUGaxJFi9KPTKtHHbNNLs9/cQzi9VDr/8q9bdfggv9xzJ1X9lG+
	 9RpmOsg4Y8r+K87YtjCNDe2FXHGZN5+Tnre0Bjc43VZKjUsdhnl9kPnLW5wRFMtwGrw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=U0pAsIZa;
	arc=none smtp.remote-ip=209.85.214.178
X-Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB2B3606A32C
	for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 19:20:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB2B3606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2eff722a480so741915ad.0
        for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 11:20:02 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794943202; x=1795548002; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=5f5C80g30fAPj/I2D0TndVTdrcqmqXcICX0m5JKKxiE=;
        b=U0pAsIZaKRAVwB/CUQOe98pN6l9ng4fVxpQsCNRj407Up/Y4v0ww4I2hcNpO3fi/3m
         yQLtdbkmRAuZOqeeU9+Y1zrBeTdB6KnODUVepEB0/RV3QB+80FsAC5tXjWnCt3JURD/b
         hVMvuuAnNVFdV/0zWIY5HtQGvXyybQqNBalZTkkDLyBLeaAxAalG7W0IjBVsRFn6e9Ru
         /kZRmjZXQ3hedfAxPWxC8Zl9zpLogOWnUHf7+6ETsZOyQOUZHXxapqNpMw4Vk4frTNKL
         j71EZumfZgXABGz48FHpY2/SHsX7TzhOmPO60DNgt0gM8asyMiON+0kP+DspNU7bufEg
         r2dw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794943202; x=1795548002;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=5f5C80g30fAPj/I2D0TndVTdrcqmqXcICX0m5JKKxiE=;
        b=kWLMLgOheguaod9TW0K2boHbkTScm3KuYZa8HASyDlSom8aENOnMjRkjAaBJbRWzUw
         1mmya9geQTcKH+DfZeTw96GVFsbWO84M1QQx7l295912dxRX6iwm3ty079vl0Q9ujaFE
         hN5WPI7swWUJF+4FBw+wup9OcqXBgFXrY/dlS0NpaW+V3sj1a659kwxe1etj6xOqoGEj
         YblgmMr/TfgN/MATBJQN5knLbqnEm7vF0U27CSZM4KWzhG6g36CYSfKv/+S7FTccHnuc
         H+XT5jJkL3laui05utLOj0+Vk/ExevwYSIRafK9YpOy815MQ61bUn4xVHphYyBkWOSb3
         elAA==
X-Gm-Message-State: APuU4Z/K63152POtgW3Oq1/B3vDUCkvDMFD91kB2YMbW1hfwULm44BWp
	0/w/2Y29LE+pAQ4jsP6iTgjnY+TMiTgtyok6vmj542ny4t6fpZOm4eTg
X-Gm-Gg: AZFdTZeg4jz+y8LoV4hZR/DVriF+LcIDki6xgRg8xHYMJwn1nwhgY4CjN1hXLnBrR5z
	bde6AFnRZiwpeYu/zalLICBotbSMgohGq1O/eiJZi7c3kNJqoKTVESZYQl+3oGV5sTfGWXKsy9e
	KelGGtxWig9D09aHFV1Akh6t58fyTWFn+6ART2iwhiScZQbzCEMHg9yuYi10BPQ8TkV/DajnQW+
	ZfbAs6jtd1D2gKxmS4fM2L1SmNzxs6jI9Ta2UnkfTfR1ybUHerP36Q44gE1Kmg+db+kAv82Z92k
	OyvcNYyMDDO+VcJRpz8Duc8b12vtBfvPAnFF7JKj2NtAGMKkjc4xlkQoVTU79GzsOcCMNU/sDnY
	/0lDLOpnrhIiHtViU95XNwVxtU4uGn5e4vp0IsBwpWmneMA6JSImh6tZ4NhcVI1pWFiqRRC5vPP
	kRAvQ6W65hF6qVuQhHAZ+bkMCVV5/3ST1YLTnTQqIVeGRGHvOh0jzjv5appFix67GGH5zv9uX/2
	6+4MVAH1ZM7B8NRDndqvXicImKqx9+xyxXwZ85fSKBbLSpfZYxj+1I+0+LtlLiAaqcLN8H8XyEP
	td8/wMlm4kvEYrp6cLXDCt0Ake9wnvghD1Ek8QbDFkQC0gXGE0rqWMYN
X-Received: by 2002:a17:90a:d2c7:b0:3ac:9ad9:6afe with SMTP id 98e67ed59e1d1-3b3d0856d06mr202762a91.39.1794943201850;
        Tue, 17 Nov 2026 11:20:01 -0800 (PST)
X-Received: from [10.67.48.245] ([192.19.223.252])
        by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b3d1acde45sm318890a91.11.2026.11.17.11.19.59
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Tue, 17 Nov 2026 11:20:00 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 hkallweit1@gmail.com, linux@armlinux.org.uk, shaojijie@huawei.com,
 horms@kernel.org, runyu.xiao@seu.edu.cn, mmyangfl@gmail.com, hvr@gnu.org,
 jeff@garzik.org, danny.kukawka@bisect.de, mugunthanvnm@ti.com,
 sebastian.hesselbarth@gmail.com, linux-kernel@vger.kernel.org,
 manuel.lauss@gmail.com
X-In-Reply-To: <179483705182.3136.18065066878486336390@kernel.org>