Commit 2170a1f0 authored by Eric Dumazet's avatar Eric Dumazet Committed by Paolo Abeni
Browse files

net: no longer reset transport_header in __netif_receive_skb_core()



In commit 66e4c8d9 ("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: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250107144342.499759-1-edumazet@google.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 9d8c354a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5493,8 +5493,14 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
	orig_dev = skb->dev;

	skb_reset_network_header(skb);
#if !defined(CONFIG_DEBUG_NET)
	/* We plan to no longer reset the transport header here.
	 * Give some time to fuzzers and dev build to catch bugs
	 * in network stacks.
	 */
	if (!skb_transport_header_was_set(skb))
		skb_reset_transport_header(skb);
#endif
	skb_reset_mac_len(skb);

	pt_prev = NULL;