• Willem de Bruijn's avatar
    macvtap: always pass ethernet header in linear · df96fa6f
    Willem de Bruijn authored
    [ Upstream commit 8e2ad411 ]
    
    The stack expects link layer headers in the skb linear section.
    Macvtap can create skbs with llheader in frags in edge cases:
    when (IFF_VNET_HDR is off or vnet_hdr.hdr_len < ETH_HLEN) and
    prepad + len > PAGE_SIZE and vnet_hdr.flags has no or bad csum.
    
    Add checks to ensure linear is always at least ETH_HLEN.
    At this point, len is already ensured to be >= ETH_HLEN.
    
    For backwards compatiblity, rounds up short vnet_hdr.hdr_len.
    This differs from tap and packet, which return an error.
    
    Fixes b9fb9ee0 ("macvtap: add GSO/csum offload support")
    Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.16: don't use macvtap16_to_cpu()]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    df96fa6f
macvtap.c 29.7 KB