• Gerrit Renker's avatar
    [DCCP]: Fix bug in the calculation of very low sending rates · b2449fdc
    Gerrit Renker authored
    This fixes an error in the calculation of t_ipi when X converges towards
    very low sending rates (between 1 and 64 bytes per second).
    
    Although this case may not sound likely, it can be reproduced by connecting,
    hitting enter (1 byte sent) and waiting for some time, during which the
    nofeedback timer halves the sending rate until finally it reaches the region
    1..64 bytes/sec. Computing X is handled correctly (tested separately); but by
    dividing X _before_ entering the calculation of t_ipi, X becomes zero as
    a result.  This in turn triggers a BUG condition caught in scaled_div().
    
    Fixed by replacing with equivalent statement and explicit typecast for good
    measure.
    
    Calculation verified and effect of patch tested - reduced never below 1 byte
    per 64 seconds afterwards, i.e. not allowing divide-by-zero.
    Signed-off-by: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
    Acked-by: default avatarIan McDonald <ian.mcdonald@jandi.co.nz>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@ghostprotocols.net>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b2449fdc
ccid3.c 36.3 KB