Cong Wang wrote: > From: Cong Wang <cong.wang@xxxxxxxxxxxxx> > > skb_network_offset() and skb_transport_offset() can be negative when > they are called after we pull the transport header, for example, when > we use eBPF sockmap at the point of ->sk_data_ready(). > > __bpf_skb_min_len() uses an unsigned int to get these offsets, this > leads to a very large number which then causes bpf_skb_change_tail() > failed unexpectedly. > > Fix this by using a signed int to get these offsets and ensure the > minimum is at least zero. > > Fixes: 5293efe62df8 ("bpf: add bpf_skb_change_tail helper") > Cc: John Fastabend <john.fastabend@xxxxxxxxx> > Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx> > Signed-off-by: Cong Wang <cong.wang@xxxxxxxxxxxxx> > --- Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>