Skip to content
  • Jon Maloy's avatar
    tipc: enforce valid ratio between skb truesize and contents · d618d09a
    Jon Maloy authored
    
    
    The socket level flow control is based on the assumption that incoming
    buffers meet the condition (skb->truesize / roundup(skb->len) <= 4),
    where the latter value is rounded off upwards to the nearest 1k number.
    This does empirically hold true for the device drivers we know, but we
    cannot trust that it will always be so, e.g., in a system with jumbo
    frames and very small packets.
    
    We now introduce a check for this condition at packet arrival, and if
    we find it to be false, we copy the packet to a new, smaller buffer,
    where the condition will be true. We expect this to affect only a small
    fraction of all incoming packets, if at all.
    
    Acked-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d618d09a