From 0b746e08cd7fb35d80c184f8e3f4656aa1f1ae11 Mon Sep 17 00:00:00 2001 From: Shannon Nelson Date: Tue, 18 May 2010 16:00:03 +0000 Subject: [PATCH] ixgbe: fix header len when unsplit packet overflows to data buffer When in packet split mode, packet type is not recognized, and the packet is larger than the header size, the 82599 overflows the packet into the data area, but doesn't set the HDR_LEN field. We can safely assume the length is the current header size. This fixes an obscure corner case that can be triggered by non-ip packet headers or (more likely) by disabling the L2 packet recognition. Signed-off-by: Shannon Nelson Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller --- drivers/net/ixgbe/ixgbe_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 926ad8c2f2c7..a9e091cb5499 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -1201,9 +1201,10 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> IXGBE_RXDADV_HDRBUFLEN_SHIFT; - if (len > IXGBE_RX_HDR_SIZE) - len = IXGBE_RX_HDR_SIZE; upper_len = le16_to_cpu(rx_desc->wb.upper.length); + if ((len > IXGBE_RX_HDR_SIZE) || + (upper_len && !(hdr_info & IXGBE_RXDADV_SPH))) + len = IXGBE_RX_HDR_SIZE; } else { len = le16_to_cpu(rx_desc->wb.upper.length); } -- GitLab