]> git.baikalelectronics.ru Git - kernel.git/commit
bpf/cpumap: make sure frame_size for build_skb is aligned if headroom isn't
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 19 Dec 2018 16:00:23 +0000 (17:00 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 20 Dec 2018 22:19:12 +0000 (23:19 +0100)
commit19fe43fff205ee9f76b1451da2cc7c144549f846
treed9f8339df3ccd3a320f231c9ce662bc5a1db5ecf
parent754d941a33bc13d5bda1ffb806f5b27ca7c83f03
bpf/cpumap: make sure frame_size for build_skb is aligned if headroom isn't

The frame_size passed to build_skb must be aligned, else it is
possible that the embedded struct skb_shared_info gets unaligned.

For correctness make sure that xdpf->headroom in included in the
alignment. No upstream drivers can hit this, as all XDP drivers provide
an aligned headroom.  This was discovered when playing with implementing
XDP support for mvneta, which have a 2 bytes DSA header, and this
Marvell ARM64 platform didn't like doing atomic operations on an
unaligned skb_shinfo(skb)->dataref addresses.

Fixes: 84e7fa463336 ("bpf: cpumap xdp_buff to skb conversion and allocation")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/cpumap.c