diff mbox series

[net-next] sk_buff: avoid potentially clearing 'slow_gro' field

Message ID aa42529252dc8bb02bd42e8629427040d1058537.1627662501.git.pabeni@redhat.com (mailing list archive)
State Accepted
Commit a432934a30679c0e3c47b87f13e4901bc1a3fc03
Delegated to: Netdev Maintainers
Headers show
Series [net-next] sk_buff: avoid potentially clearing 'slow_gro' field | 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 17 maintainers not CCed: atenart@kernel.org jonathan.lemon@gmail.com daniel@iogearbox.net weiwan@google.com wenxu@ucloud.cn cong.wang@bytedance.com ast@kernel.org ilias.apalodimas@linaro.org ap420073@gmail.com willemb@google.com edumazet@google.com elver@google.com bjorn@kernel.org memxor@gmail.com alobakin@pm.me nogikh@google.com haokexin@gmail.com
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: 6054 this patch: 6054
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, 16 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 6114 this patch: 6114
netdev/header_inline success Link

Commit Message

Paolo Abeni July 30, 2021, 4:30 p.m. UTC
If skb_dst_set_noref() is invoked with a NULL dst, the 'slow_gro'
field is cleared, too. That could lead to wrong behavior if
the skb later enters the GRO stage.

Fix the potential issue replacing preserving a non-zero value of
the 'slow_gro' field.

Additionally, fix a comment typo.

Reported-by: Sabrina Dubroca <sd@queasysnail.net>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Fixes: 8a886b142bd0 ("sk_buff: track dst status in slow_gro")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 include/linux/skbuff.h | 2 +-
 net/core/dev.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 30, 2021, 8 p.m. UTC | #1
Hello:

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

On Fri, 30 Jul 2021 18:30:53 +0200 you wrote:
> If skb_dst_set_noref() is invoked with a NULL dst, the 'slow_gro'
> field is cleared, too. That could lead to wrong behavior if
> the skb later enters the GRO stage.
> 
> Fix the potential issue replacing preserving a non-zero value of
> the 'slow_gro' field.
> 
> [...]

Here is the summary with links:
  - [net-next] sk_buff: avoid potentially clearing 'slow_gro' field
    https://git.kernel.org/netdev/net-next/c/a432934a3067

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/include/linux/skbuff.h b/include/linux/skbuff.h
index b1e5bbfcc926..2bcdc8cd38be 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1009,7 +1009,7 @@  static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
 static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
 {
 	WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
-	skb->slow_gro = !!dst;
+	skb->slow_gro |= !!dst;
 	skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
 }
 
diff --git a/net/core/dev.c b/net/core/dev.c
index b51e41d0a7fe..64e1a5f63f93 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6022,7 +6022,7 @@  static void gro_list_prepare(const struct list_head *head,
 				       skb_mac_header(skb),
 				       maclen);
 
-		/* in most common scenarions _state is 0
+		/* in most common scenarions 'slow_gro' is 0
 		 * otherwise we are already on some slower paths
 		 * either skip all the infrequent tests altogether or
 		 * avoid trying too hard to skip each of them individually