Skip to contentSkip to conversation

net: ethernet: lantiq_etop: fix memory disclosure

PATCH Applied Aleksander Jan Bajkowski 5 participants 6 messages Sep 23, 2024 – Oct 1, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover net: ethernet: lantiq_etop: fix memory disclosure

Changes in v3:
- back to the use of the temporary 'len' variable

Changes in v2:
- clarified questions about statistics in the commit description
- rebased on current master

Aleksander Jan Bajkowski (1):
net: ethernet: lantiq_etop: fix memory disclosure

 drivers/net/ethernet/lantiq_etop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH v3 1/1 net: ethernet: lantiq_etop: fix memory disclosure

When applying padding, the buffer is not zeroed, which results in memory disclosure. The mentioned data is observed on the wire. This patch uses skb_put_padto() to pad Ethernet frames properly. The mentioned function zeroes the expanded buffer.

In case the packet cannot be padded it is silently dropped. Statistics are also not incremented. This driver does not support statistics in the old 32-bit format or the new 64-bit format. These will be added in the future. In its current form, the patch should be easily backported to stable versions.

Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets in hardware, so software padding must be applied.

Fixes 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")
---
 drivers/net/ethernet/lantiq_etop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/lantiq_etop.c +3 -1
index 3c289bfe0a09..7179271f63b6 100644
@@ -481,7 +481,9 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
 	unsigned long flags;
 	u32 byte_offset;
 
-	len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
+	if (skb_put_padto(skb, ETH_ZLEN))
+		return NETDEV_TX_OK;
+	len = skb->len;
 
 	if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
 		netdev_err(dev, "tx ring full\n");
Signature · 1 line
2.39.5
Reviewed-by on v3 1/1
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: Aleksander Jan Bajkowski <[email protected]>
Sent: Monday, September 23, 2024 2:50 PM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Keller, Jacob E <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH net v3 1/1] net: ethernet: lantiq_etop: fix memory disclosure

When applying padding, the buffer is not zeroed, which results in memory disclosure. The mentioned data is observed on the wire. This patch uses skb_put_padto() to pad Ethernet frames properly. The mentioned function zeroes the expanded buffer.

In case the packet cannot be padded it is silently dropped. Statistics are also not incremented. This driver does not support statistics in the old 32-bit format or the new 64-bit format. These will be added in the future. In its current form, the patch should be easily backported to stable versions.

Quoted 6 lines

Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets in hardware, so software padding must be applied.

Fixes 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")

---

Reviewed-by on v3 1/1
#3 lore raw
In reply to Aleksander Jan Bajkowski
Quoted 11 lines · Aleksander Jan Bajkowski

When applying padding, the buffer is not zeroed, which results in memory disclosure. The mentioned data is observed on the wire. This patch uses skb_put_padto() to pad Ethernet frames properly. The mentioned function zeroes the expanded buffer.

In case the packet cannot be padded it is silently dropped. Statistics are also not incremented. This driver does not support statistics in the old 32-bit format or the new 64-bit format. These will be added in the future. In its current form, the patch should be easily backported to stable versions.

Quoted 5 lines

Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets in hardware, so software padding must be applied.

Fixes 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")

Thanks for taking in the suggsetion!

Signature · 1 line
Florian
maintainer
#4 lore raw
In reply to Aleksander Jan Bajkowski
Quoted 11 lines · Aleksander Jan Bajkowski

When applying padding, the buffer is not zeroed, which results in memory disclosure. The mentioned data is observed on the wire. This patch uses skb_put_padto() to pad Ethernet frames properly. The mentioned function zeroes the expanded buffer.

In case the packet cannot be padded it is silently dropped. Statistics are also not incremented. This driver does not support statistics in the old 32-bit format or the new 64-bit format. These will be added in the future. In its current form, the patch should be easily backported to stable versions.

Quoted 5 lines

Ethernet MACs on Amazon-SE and Danube cannot do padding of the packets in hardware, so software padding must be applied.

Fixes 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")

For future submissions, please avoid adding the cover letter in case of a single patch.

Thanks,

Paolo

#5 lore raw
In reply to Aleksander Jan Bajkowski
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Mon, 23 Sep 2024 23:49:48 +0200 you wrote:

Changes in v3:
- back to the use of the temporary 'len' variable

Changes in v2:
- clarified questions about statistics in the commit description
- rebased on current master

[...]

Here is the summary with links:
- [net,v3,1/1] net: ethernet: lantiq_etop: fix memory disclosure

    https://git.kernel.org/netdev/net/c/45c0de18ff2d

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html