Skip to contentSkip to conversation

net: calxedaxgmac: throw away overrun frames

PATCH Applied Rob Herring 2 participants 2 messages Jan 16, 2013 – Jan 18, 2013

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

PATCH 1/1 net: calxedaxgmac: throw away overrun frames

From: Rob Herring <[email protected]>

The xgmac driver assumes 1 frame per descriptor. If a frame larger than the descriptor's buffer size is received, the frame will spill over into the next descriptor. So check for received frames that span more than one descriptor and discard them. This prevents a crash if we receive erroneous large packets.

---
 drivers/net/ethernet/calxeda/xgmac.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/calxeda/xgmac.c +4 -0
index b407043..f7f0290 100644
@@ -548,6 +548,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p)
 		return -1;
 	}
 
+	/* All frames should fit into a single buffer */
+	if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG))
+		return -1;
+
 	/* Check if packet has checksum already */
 	if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) &&
 		!(ext_status & RXDESC_IP_PAYLOAD_MASK))
Signature · 1 line
1.7.10.4
maintainer Applied
#1 lore raw

From: Rob Herring <[email protected]>
Date: Wed, 16 Jan 2013 17:36:37 -0600

Quoted 9 lines

From: Rob Herring <[email protected]>

The xgmac driver assumes 1 frame per descriptor. If a frame larger than the descriptor's buffer size is received, the frame will spill over into the next descriptor. So check for received frames that span more than one descriptor and discard them. This prevents a crash if we receive erroneous large packets.

Applied.