Skip to content

Commit 3359abd

Browse files
abajkSasha Levin
authored and
Sasha Levin
committed
net: ethernet: lantiq_etop: fix memory disclosure
[ Upstream commit 45c0de1 ] 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: 504d472 ("MIPS: Lantiq: Add ethernet driver") Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 64e13a7 commit 3359abd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/ethernet/lantiq_etop.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,9 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
464464
unsigned long flags;
465465
u32 byte_offset;
466466

467-
len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
467+
if (skb_put_padto(skb, ETH_ZLEN))
468+
return NETDEV_TX_OK;
469+
len = skb->len;
468470

469471
if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
470472
netdev_err(dev, "tx ring full\n");

0 commit comments

Comments
 (0)