Skip to content

Commit aaa6452

Browse files
tehnerdborkmann
authored andcommitted
bpf: fix virtio-net's length calc for XDP_PASS
In commit 6870de4 ("bpf: make virtio compatible w/ bpf_xdp_adjust_tail") i didn't account for vi->hdr_len during new packet's length calculation after bpf_prog_run in receive_mergeable. because of this all packets, if they were passed to the kernel, were truncated by 12 bytes. Fixes:6870de435b90 ("bpf: make virtio compatible w/ bpf_xdp_adjust_tail") Reported-by: David Ahern <dsahern@gmail.com> Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 48d7a07 commit aaa6452

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/net/virtio_net.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
765765
/* recalculate len if xdp.data or xdp.data_end were
766766
* adjusted
767767
*/
768-
len = xdp.data_end - xdp.data;
768+
len = xdp.data_end - xdp.data + vi->hdr_len;
769769
/* We can only create skb based on xdp_page. */
770770
if (unlikely(xdp_page != page)) {
771771
rcu_read_unlock();

0 commit comments

Comments
 (0)