diff mbox

[net] net-gro: reset skb->truesize in napi_reuse_skb()

Message ID 1396542490.12330.17.camel@edumazet-glaptop2.roam.corp.google.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet April 3, 2014, 4:28 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

Recycling skb always had been very tough...

This time it appears GRO layer can accumulate skb->truesize
adjustments made by drivers when they attach a fragment to skb.

skb_gro_receive() can only subtract from skb->truesize the used part
of a fragment.

I spotted this problem seeing TcpExtPruneCalled and
TcpExtTCPRcvCollapsed that were unexpected with a recent kernel, where
TCP receive window should be sized properly to accept traffic coming
from a driver not overshooting skb->truesize.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/dev.c |    1 +
 1 file changed, 1 insertion(+)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller April 3, 2014, 8:18 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 03 Apr 2014 09:28:10 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> Recycling skb always had been very tough...
> 
> This time it appears GRO layer can accumulate skb->truesize
> adjustments made by drivers when they attach a fragment to skb.
> 
> skb_gro_receive() can only subtract from skb->truesize the used part
> of a fragment.
> 
> I spotted this problem seeing TcpExtPruneCalled and
> TcpExtTCPRcvCollapsed that were unexpected with a recent kernel, where
> TCP receive window should be sized properly to accept traffic coming
> from a driver not overshooting skb->truesize.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Nasty...

Applied, thanks Eric.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cong Wang May 16, 2014, 9:27 p.m. UTC | #2
On Thu, Apr 3, 2014 at 1:18 PM, David Miller <davem@davemloft.net> wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 03 Apr 2014 09:28:10 -0700
>
>> From: Eric Dumazet <edumazet@google.com>
>>
>> Recycling skb always had been very tough...
>>
>> This time it appears GRO layer can accumulate skb->truesize
>> adjustments made by drivers when they attach a fragment to skb.
>>
>> skb_gro_receive() can only subtract from skb->truesize the used part
>> of a fragment.
>>
>> I spotted this problem seeing TcpExtPruneCalled and
>> TcpExtTCPRcvCollapsed that were unexpected with a recent kernel, where
>> TCP receive window should be sized properly to accept traffic coming
>> from a driver not overshooting skb->truesize.
>>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Nasty...
>
> Applied, thanks Eric.

I think this patch should be queued for -stable as well?
Looking at your stable queue [1], it's not there. :)

Thanks!

1. http://patchwork.ozlabs.org/bundle/davem/stable/?state=*
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 757063420ce0..8770984e1ddc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4043,6 +4043,7 @@  static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
 	skb->vlan_tci = 0;
 	skb->dev = napi->dev;
 	skb->skb_iif = 0;
+	skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
 
 	napi->skb = skb;
 }