• Herbert Xu's avatar
    [TCP]: Fix truesize underflow · ef5cb973
    Herbert Xu authored
    There is a problem with the TSO packet trimming code.  The cause of
    this lies in the tcp_fragment() function.
    
    When we allocate a fragment for a completely non-linear packet the
    truesize is calculated for a payload length of zero.  This means that
    truesize could in fact be less than the real payload length.
    
    When that happens the TSO packet trimming can cause truesize to become
    negative.  This in turn can cause sk_forward_alloc to be -n * PAGE_SIZE
    which would trigger the warning.
    
    I've copied the code DaveM used in tso_fragment which should work here.
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ef5cb973
tcp_output.c 68.7 KB