Skip to contentSkip to conversation

Resend: [PATCH] DCCP: Divide by zero fix

PATCH Ian McDonald 2 participants 3 messages Feb 28, 2006 Networking

lore
Share & tools
lore
#0 lore raw

Arnaldo,

Haven't seen this going in so resending...

Ian

---------- Forwarded message ----------
From: Ian McDonald <[email protected]>
Date: Feb 17, 2006 3:17 PM
Subject: [PATCH] DCCP: Divide by zero fix
To: DCCP Mailing List <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>

In rare circumstances 0 is returned by dccp_li_hist_calc_i_mean which leads to a divide by zero in ccid3_hc_rx_packet_recv. Explicitly check for zero return now. Update copyright notice at same time.

Found by Arnaldo

----

net/dccp/ccids/ccid3.c +5 -4
index 165fc40..fb4db88 100644
@@ -2,7 +2,7 @@
  *  net/dccp/ccids/ccid3.c
  *
  *  Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
- *  Copyright (c) 2005 Ian McDonald <[email protected]>
+ *  Copyright (c) 2005-6 Ian McDonald <[email protected]>
  *
  *  An implementation of the DCCP protocol
  *
@@ -925,7 +925,7 @@ static void ccid3_hc_rx_packet_recv(stru
        struct dccp_rx_hist_entry *packet;
        struct timeval now;
        u8 win_count;
-       u32 p_prev, r_sample, t_elapsed;
+       u32 p_prev, r_sample, t_elapsed, i_mean;
        int ins;
 
        BUG_ON(hcrx = NULL ||
@@ -1025,9 +1025,11 @@ static void ccid3_hc_rx_packet_recv(stru
        p_prev = hcrx->ccid3hcrx_p;
 
        /* Calculate loss event rate */
-       if (!list_empty(&hcrx->ccid3hcrx_li_hist))
+       if (!list_empty(&hcrx->ccid3hcrx_li_hist)) {
+               i_mean = dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist);
+               if (i_mean)
                /* Scaling up by 1000000 as fixed decimal */
-               hcrx->ccid3hcrx_p = 1000000 /

dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist);
+ hcrx->ccid3hcrx_p = 1000000 / i_mean;

        if (hcrx->ccid3hcrx_p > p_prev) {
                ccid3_hc_rx_send_feedback(sk);

--
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand

#1 lore raw
Quoted 3 lines · Ian McDonald

Arnaldo,

Haven't seen this going in so resending...

What a coincidence, I'm testing this patch right now, and I'm afraid it has some bug or makes it more likely that some other bug happens, the machine soft locks with it enabled and when using CCID3 as the default RX CCID in a TTCP test over loopback.

Note that the problem happens more quickly if you test it on a machine with less than 64 MB (where the problem happens, but after more time).

- Arnaldo

#2 lore raw
In reply to Ian McDonald
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines · Ian McDonald

Arnaldo,

Haven't seen this going in so resending...

Quoted 8 lines

What a coincidence, I'm testing this patch right now, and I'm afraid it has some bug or makes it more likely that some other bug happens, the machine soft locks with it enabled and when using CCID3 as the default RX CCID in a TTCP test over loopback.

Note that the problem happens more quickly if you test it on a machine with less than 64 MB (where the problem happens, but after more time).

OK. I am doing some testing on lockups at present from CCID3 which I suspect are introduced recently.... they don't lock up on older code. Having said that I'm running without that patch applied so I will retest soon - but I don't believe it is the problem when I looked at the scope of that code.

I have a suspicion that if I don't find anything with git-bisect for CCID3 lockups that it might be when you use CCID3 and set DCCP_INITIAL_SEND_ACK_VECTOR to 1....

Anyway another 3 or 4 reboots and I should give some more answers.

BTW my problems occur when using a netem box in the middle as per setup described on DCCP testing on ODSL Wiki.

Ian
--
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand