Thread (2 messages) 2 messages, 2 authors, 2026-01-28

Re: [PATCH] bpf: lwtunnel: Check skb->_skb_refdst in bpf_lwt_push_ip_encap

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-01-28 00:00:53
Also in: lkml

On Tue, 27 Jan 2026 16:45:20 +0800 Yun Lu wrote:
The bpf_lwt_xmit_push_encap helper needs to access skb_dst(skb)->dev to
calculate the needed headroom:

	err = skb_cow_head(skb,
			   len + LL_RESERVED_SPACE(skb_dst(skb)->dev));

But skb->_skb_refdst may not be initialized when the skb is set up by
bpf_prog_test_run_skb function. Executing bpf_lwt_push_ip_encap function
in this scenario will trigger null pointer dereference, causing a kernel
crash as Yinhao reported:
Seems a bit backwards to be adding datapath checks to make
bpf_prog_test_run_skb() happy. Also - please run checkpatch.
-- 
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help