diff options
author | Ian McDonald <imcdnzl@gmail.com> | 2006-03-03 20:54:46 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-05 00:06:29 -0500 |
commit | c09966608da7e8cad3468e925ac9062e44fee831 (patch) | |
tree | 4e3b04e3aabe5bf5106fe04913ad7b75525d7de4 /net | |
parent | c027f5f995d8b6efc934be384085e3e8425638e4 (diff) |
[DCCP] ccid3: Divide by zero fix
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.
Signed-off-by: Ian McDonald <imcdnzl@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index aa68e0ab274d..35d1d347541c 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/dccp/ccids/ccid3.c | 2 | * net/dccp/ccids/ccid3.c |
3 | * | 3 | * |
4 | * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand. | 4 | * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand. |
5 | * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz> | 5 | * Copyright (c) 2005-6 Ian McDonald <imcdnzl@gmail.com> |
6 | * | 6 | * |
7 | * An implementation of the DCCP protocol | 7 | * An implementation of the DCCP protocol |
8 | * | 8 | * |
@@ -1033,9 +1033,13 @@ static void ccid3_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
1033 | p_prev = hcrx->ccid3hcrx_p; | 1033 | p_prev = hcrx->ccid3hcrx_p; |
1034 | 1034 | ||
1035 | /* Calculate loss event rate */ | 1035 | /* Calculate loss event rate */ |
1036 | if (!list_empty(&hcrx->ccid3hcrx_li_hist)) | 1036 | if (!list_empty(&hcrx->ccid3hcrx_li_hist)) { |
1037 | u32 i_mean = dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist); | ||
1038 | |||
1037 | /* Scaling up by 1000000 as fixed decimal */ | 1039 | /* Scaling up by 1000000 as fixed decimal */ |
1038 | hcrx->ccid3hcrx_p = 1000000 / dccp_li_hist_calc_i_mean(&hcrx->ccid3hcrx_li_hist); | 1040 | if (i_mean != 0) |
1041 | hcrx->ccid3hcrx_p = 1000000 / i_mean; | ||
1042 | } | ||
1039 | 1043 | ||
1040 | if (hcrx->ccid3hcrx_p > p_prev) { | 1044 | if (hcrx->ccid3hcrx_p > p_prev) { |
1041 | ccid3_hc_rx_send_feedback(sk); | 1045 | ccid3_hc_rx_send_feedback(sk); |