Skip to content

Commit a432934

Browse files
Paolo Abenikuba-moo
authored andcommitted
sk_buff: avoid potentially clearing 'slow_gro' field
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: 8a886b1 ("sk_buff: track dst status in slow_gro") Signed-off-by: Paolo Abeni <pabeni@redhat.com> Link: https://lore.kernel.org/r/aa42529252dc8bb02bd42e8629427040d1058537.1627662501.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bc83052 commit a432934

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎include/linux/skbuff.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
10091009
static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
10101010
{
10111011
WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
1012-
skb->slow_gro = !!dst;
1012+
skb->slow_gro |= !!dst;
10131013
skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
10141014
}
10151015

‎net/core/dev.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6022,7 +6022,7 @@ static void gro_list_prepare(const struct list_head *head,
60226022
skb_mac_header(skb),
60236023
maclen);
60246024

6025-
/* in most common scenarions _state is 0
6025+
/* in most common scenarions 'slow_gro' is 0
60266026
* otherwise we are already on some slower paths
60276027
* either skip all the infrequent tests altogether or
60286028
* avoid trying too hard to skip each of them individually

0 commit comments

Comments
 (0)