diff mbox series

[net-next] net: fix GRO skb truesize update

Message ID 9134e63fd0d42787e4fbd4bd890d330d6fda9f81.1628097645.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit af352460b465d7a8afbeb3be07c0268d1d48a4d7
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: fix GRO skb truesize update | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 7 maintainers not CCed: linmiaohe@huawei.com jonathan.lemon@gmail.com gnault@redhat.com cong.wang@bytedance.com vvs@virtuozzo.com willemb@google.com alobakin@pm.me
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Paolo Abeni Aug. 4, 2021, 7:07 p.m. UTC
commit 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock
reference") introduces a serious regression at the GRO layer setting
the wrong truesize for stolen-head skbs.

Restore the correct truesize: SKB_DATA_ALIGN(...) instead of
SKB_TRUESIZE(...)

Reported-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Fixes: 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock reference")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mat Martineau Aug. 4, 2021, 7:29 p.m. UTC | #1
On Wed, 4 Aug 2021, Paolo Abeni wrote:

> commit 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock
> reference") introduces a serious regression at the GRO layer setting
> the wrong truesize for stolen-head skbs.
>
> Restore the correct truesize: SKB_DATA_ALIGN(...) instead of
> SKB_TRUESIZE(...)
>
> Reported-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
> Fixes: 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock reference")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

With this patch I'm no longer seeing the WARN_ON_ONCE() fire in 
skb_try_coalesce(). Thanks Paolo!

Tested-by: Mat Martineau <mathew.j.martineau@linux.intel.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 97ed77a86bb0..02a603556408 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -4375,7 +4375,7 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
> 		memcpy(frag + 1, skbinfo->frags, sizeof(*frag) * skbinfo->nr_frags);
> 		/* We dont need to clear skbinfo->nr_frags here */
>
> -		new_truesize = SKB_TRUESIZE(sizeof(struct sk_buff));
> +		new_truesize = SKB_DATA_ALIGN(sizeof(struct sk_buff));
> 		delta_truesize = skb->truesize - new_truesize;
> 		skb->truesize = new_truesize;
> 		NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD;
> --

--
Mat Martineau
Intel
patchwork-bot+netdevbpf@kernel.org Aug. 5, 2021, 10:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Wed,  4 Aug 2021 21:07:00 +0200 you wrote:
> commit 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock
> reference") introduces a serious regression at the GRO layer setting
> the wrong truesize for stolen-head skbs.
> 
> Restore the correct truesize: SKB_DATA_ALIGN(...) instead of
> SKB_TRUESIZE(...)
> 
> [...]

Here is the summary with links:
  - [net-next] net: fix GRO skb truesize update
    https://git.kernel.org/netdev/net-next/c/af352460b465

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 97ed77a86bb0..02a603556408 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4375,7 +4375,7 @@  int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
 		memcpy(frag + 1, skbinfo->frags, sizeof(*frag) * skbinfo->nr_frags);
 		/* We dont need to clear skbinfo->nr_frags here */
 
-		new_truesize = SKB_TRUESIZE(sizeof(struct sk_buff));
+		new_truesize = SKB_DATA_ALIGN(sizeof(struct sk_buff));
 		delta_truesize = skb->truesize - new_truesize;
 		skb->truesize = new_truesize;
 		NAPI_GRO_CB(skb)->free = NAPI_GRO_FREE_STOLEN_HEAD;