]> err.no Git - linux-2.6/commit
[DCCP]: Fix bug in the calculation of very low sending rates
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Fri, 20 Apr 2007 20:02:55 +0000 (13:02 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:28:54 +0000 (22:28 -0700)
commitb2449fdc30ccac550344df5e60d38bb8427b109c
treee0371a1474a6d28cbb2826c2401abf2a1a7fcbcf
parentcb8c181f288a1157bc717cc7a02412d4d1dc19bc
[DCCP]: Fix bug in the calculation of very low sending rates

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: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/ccids/ccid3.c