Skip to contentSkip to conversation

net-gro: Fix GRO flush when receiving a GSO packet.

PATCH In review Steffen Klassert 3 participants 3 messages Apr 2, 2019 – Apr 4, 2019

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

PATCH 1/1 net-gro: Fix GRO flush when receiving a GSO packet.

Currently we may merge incorrectly a received GSO packet or a packet with frag_list into a packet sitting in the gro_hash list. skb_segment() may crash in this case because the assumptions on the skb layout are not met in this case. The correct behaviour would be to flush the packet in the gro_hash list and send the received GSO packet directly afterwards. Commit d61d072e87c8e ("net-gro: avoid reorders") sets NAPI_GRO_CB(skb)->flush in this case, but this is not checked before merging. This patch makes sure to check this flag and to not merge in that case.

Fixes d61d072e87c8e ("net-gro: avoid reorders")
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -1
index 2415d9cb9b89..ef2cd5712098 100644
@@ -3801,7 +3801,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
 	unsigned int delta_truesize;
 	struct sk_buff *lp;
 
-	if (unlikely(p->len + len >= 65536))
+	if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush))
 		return -E2BIG;
 
 	lp = NAPI_GRO_CB(p)->last;
Signature · 1 line
2.17.1
#1 lore raw

Hello!

Quoted 4 lines · Steffen Klassert

Currently we may merge incorrectly a received GSO packet or a packet with frag_list into a packet sitting in the gro_hash list. skb_segment() may crash in this case because the assumptions on the skb layout are not met in this case.

"In this case" repeated twice in the same sentence sounds
somewhat tautological. :-)

Quoted 9 lines

The correct behaviour would be to flush the packet in the gro_hash list and send the received GSO packet directly afterwards. Commit d61d072e87c8e ("net-gro: avoid reorders") sets NAPI_GRO_CB(skb)->flush in this case, but this is not checked before merging. This patch makes sure to check this flag and to not merge in that case.

Fixes d61d072e87c8e ("net-gro: avoid reorders")

[...]

MBR, Sergei

maintainer
#2 lore raw
In reply to Steffen Klassert

From: Steffen Klassert <[email protected]>
Date: Tue, 2 Apr 2019 08:16:03 +0200

Quoted 11 lines

Currently we may merge incorrectly a received GSO packet or a packet with frag_list into a packet sitting in the gro_hash list. skb_segment() may crash in this case because the assumptions on the skb layout are not met in this case. The correct behaviour would be to flush the packet in the gro_hash list and send the received GSO packet directly afterwards. Commit d61d072e87c8e ("net-gro: avoid reorders") sets NAPI_GRO_CB(skb)->flush in this case, but this is not checked before merging. This patch makes sure to check this flag and to not merge in that case.

Quoted 2 lines
Fixes d61d072e87c8e ("net-gro: avoid reorders")

Applied and queued up for -stable, thanks.