]> git.baikalelectronics.ru Git - kernel.git/commit
gro: ensure frag0 meets IP header alignment
authorEric Dumazet <edumazet@google.com>
Tue, 13 Apr 2021 12:41:35 +0000 (05:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Apr 2021 22:09:31 +0000 (15:09 -0700)
commita4784bae98bffc817a310b5da1aece55353cd214
treeada126e3929b87d7b29b858478f5b8f5bf70475c
parent602a5a10de8dff411eaf1c560e7459159df8c4ef
gro: ensure frag0 meets IP header alignment

After commit cd0ebef8c563 ("virtio_net: Do not pull payload in skb->head")
Guenter Roeck reported one failure in his tests using sh architecture.

After much debugging, we have been able to spot silent unaligned accesses
in inet_gro_receive()

The issue at hand is that upper networking stacks assume their header
is word-aligned. Low level drivers are supposed to reserve NET_IP_ALIGN
bytes before the Ethernet header to make that happen.

This patch hardens skb_gro_reset_offset() to not allow frag0 fast-path
if the fragment is not properly aligned.

Some arches like x86, arm64 and powerpc do not care and define NET_IP_ALIGN
as 0, this extra check will be a NOP for them.

Note that if frag0 is not used, GRO will call pskb_may_pull()
as many times as needed to pull network and transport headers.

Fixes: cd0ebef8c563 ("virtio_net: Do not pull payload in skb->head")
Fixes: 20fef5c8c69c ("gro: Inline skb_gro_header and cache frag0 virtual address")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c