Skip to content

Commit 2170a1f

Browse files
edumazetPaolo Abeni
authored andcommitted
net: no longer reset transport_header in __netif_receive_skb_core()
In commit 66e4c8d ("net: warn if transport header was not set") I added a debug check in skb_transport_header() to detect if a caller expects the transport_header to be set to a meaningful value by a prior code path. Unfortunately, __netif_receive_skb_core() resets the transport header to the same value than the network header, defeating this check in receive paths. Pretending the transport and network headers are the same is usually wrong. This patch removes this reset for CONFIG_DEBUG_NET=y builds to let fuzzers and CI find bugs. Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 9d8c354 commit 2170a1f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/core/dev.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5493,8 +5493,14 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
54935493
orig_dev = skb->dev;
54945494

54955495
skb_reset_network_header(skb);
5496+
#if !defined(CONFIG_DEBUG_NET)
5497+
/* We plan to no longer reset the transport header here.
5498+
* Give some time to fuzzers and dev build to catch bugs
5499+
* in network stacks.
5500+
*/
54965501
if (!skb_transport_header_was_set(skb))
54975502
skb_reset_transport_header(skb);
5503+
#endif
54985504
skb_reset_mac_len(skb);
54995505

55005506
pt_prev = NULL;

0 commit comments

Comments
 (0)