netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net-gro: Fix GRO flush when receiving a GSO packet.
@ 2019-04-02  6:16 Steffen Klassert
  2019-04-02  9:32 ` Sergei Shtylyov
  2019-04-04  4:41 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Steffen Klassert @ 2019-04-02  6:16 UTC (permalink / raw)
  To: David Miller, Eric Dumazet; +Cc: netdev

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")
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2415d9cb9b89..ef2cd5712098 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net-gro: Fix GRO flush when receiving a GSO packet.
  2019-04-02  6:16 [PATCH] net-gro: Fix GRO flush when receiving a GSO packet Steffen Klassert
@ 2019-04-02  9:32 ` Sergei Shtylyov
  2019-04-04  4:41 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2019-04-02  9:32 UTC (permalink / raw)
  To: Steffen Klassert, David Miller, Eric Dumazet; +Cc: netdev

Hello!

On 02.04.2019 9:16, Steffen Klassert wrote:

> 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. :-)

> 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")
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net-gro: Fix GRO flush when receiving a GSO packet.
  2019-04-02  6:16 [PATCH] net-gro: Fix GRO flush when receiving a GSO packet Steffen Klassert
  2019-04-02  9:32 ` Sergei Shtylyov
@ 2019-04-04  4:41 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-04  4:41 UTC (permalink / raw)
  To: steffen.klassert; +Cc: edumazet, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Tue, 2 Apr 2019 08:16:03 +0200

> 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")
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-04  4:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-02  6:16 [PATCH] net-gro: Fix GRO flush when receiving a GSO packet Steffen Klassert
2019-04-02  9:32 ` Sergei Shtylyov
2019-04-04  4:41 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).