• Maxim Mikityanskiy's avatar
    net: Don't set transport offset to invalid value · d2aa125d
    Maxim Mikityanskiy authored
    If the socket was created with socket(AF_PACKET, SOCK_RAW, 0),
    skb->protocol will be unset, __skb_flow_dissect() will fail, and
    skb_probe_transport_header() will fall back to the offset_hint, making
    the resulting skb_transport_offset incorrect.
    
    If, however, there is no transport header in the packet,
    transport_header shouldn't be set to an arbitrary value.
    
    Fix it by leaving the transport offset unset if it couldn't be found, to
    be explicit rather than to fill it with some wrong value. It changes the
    behavior, but if some code relied on the old behavior, it would be
    broken anyway, as the old one is incorrect.
    Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d2aa125d
netback.c 44.3 KB