aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid2.c
diff options
context:
space:
mode:
authorAndrea Bittau <a.bittau@cs.ucl.ac.uk>2006-03-20 20:57:52 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-20 20:57:52 -0500
commit77ff72d528d5b9d30a47f42f364ba34d931f9da3 (patch)
treea222cdf545a9156da307d075f4645a235c030596 /net/dccp/ccids/ccid2.c
parentba66c6e8b292997467128506f39fa6607e959050 (diff)
[DCCP] CCID2: Drop sock reference count on timer expiration and reset.
There was a hybrid use of standard timers and sk_timers. This caused the reference count of the sock to be incorrect when resetting the RTO timer. The sock reference count should now be correct, enabling its destruction, and allowing the DCCP module to be unloaded. Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r--net/dccp/ccids/ccid2.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 4a7b87512560..3328d23c4be7 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -234,7 +234,7 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
234 ccid2_hc_tx_check_sanity(hctx); 234 ccid2_hc_tx_check_sanity(hctx);
235out: 235out:
236 bh_unlock_sock(sk); 236 bh_unlock_sock(sk);
237/* sock_put(sk); */ 237 sock_put(sk);
238} 238}
239 239
240static void ccid2_start_rto_timer(struct sock *sk) 240static void ccid2_start_rto_timer(struct sock *sk)
@@ -399,10 +399,12 @@ out_invalid_option:
399 return -1; 399 return -1;
400} 400}
401 401
402static void ccid2_hc_tx_kill_rto_timer(struct ccid2_hc_tx_sock *hctx) 402static void ccid2_hc_tx_kill_rto_timer(struct sock *sk)
403{ 403{
404 if (del_timer(&hctx->ccid2hctx_rtotimer)) 404 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
405 ccid2_pr_debug("deleted RTO timer\n"); 405
406 sk_stop_timer(sk, &hctx->ccid2hctx_rtotimer);
407 ccid2_pr_debug("deleted RTO timer\n");
406} 408}
407 409
408static inline void ccid2_new_ack(struct sock *sk, 410static inline void ccid2_new_ack(struct sock *sk,
@@ -496,17 +498,19 @@ static inline void ccid2_new_ack(struct sock *sk,
496 } 498 }
497 499
498 /* we got a new ack, so re-start RTO timer */ 500 /* we got a new ack, so re-start RTO timer */
499 ccid2_hc_tx_kill_rto_timer(hctx); 501 ccid2_hc_tx_kill_rto_timer(sk);
500 ccid2_start_rto_timer(sk); 502 ccid2_start_rto_timer(sk);
501} 503}
502 504
503static void ccid2_hc_tx_dec_pipe(struct ccid2_hc_tx_sock *hctx) 505static void ccid2_hc_tx_dec_pipe(struct sock *sk)
504{ 506{
507 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
508
505 hctx->ccid2hctx_pipe--; 509 hctx->ccid2hctx_pipe--;
506 BUG_ON(hctx->ccid2hctx_pipe < 0); 510 BUG_ON(hctx->ccid2hctx_pipe < 0);
507 511
508 if (hctx->ccid2hctx_pipe == 0) 512 if (hctx->ccid2hctx_pipe == 0)
509 ccid2_hc_tx_kill_rto_timer(hctx); 513 ccid2_hc_tx_kill_rto_timer(sk);
510} 514}
511 515
512static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) 516static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
@@ -627,7 +631,7 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
627 seqp->ccid2s_acked = 1; 631 seqp->ccid2s_acked = 1;
628 ccid2_pr_debug("Got ack for %llu\n", 632 ccid2_pr_debug("Got ack for %llu\n",
629 seqp->ccid2s_seq); 633 seqp->ccid2s_seq);
630 ccid2_hc_tx_dec_pipe(hctx); 634 ccid2_hc_tx_dec_pipe(sk);
631 } 635 }
632 if (seqp == hctx->ccid2hctx_seqt) { 636 if (seqp == hctx->ccid2hctx_seqt) {
633 done = 1; 637 done = 1;
@@ -674,7 +678,7 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
674 while (1) { 678 while (1) {
675 if (!seqp->ccid2s_acked) { 679 if (!seqp->ccid2s_acked) {
676 loss = 1; 680 loss = 1;
677 ccid2_hc_tx_dec_pipe(hctx); 681 ccid2_hc_tx_dec_pipe(sk);
678 } 682 }
679 if (seqp == hctx->ccid2hctx_seqt) 683 if (seqp == hctx->ccid2hctx_seqt)
680 break; 684 break;
@@ -760,9 +764,9 @@ static int ccid2_hc_tx_init(struct sock *sk)
760static void ccid2_hc_tx_exit(struct sock *sk) 764static void ccid2_hc_tx_exit(struct sock *sk)
761{ 765{
762 struct dccp_sock *dp = dccp_sk(sk); 766 struct dccp_sock *dp = dccp_sk(sk);
763 struct ccid2_hc_tx_sock *hctx = dp->dccps_hc_tx_ccid_private; 767 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
764 768
765 ccid2_hc_tx_kill_rto_timer(hctx); 769 ccid2_hc_tx_kill_rto_timer(sk);
766 770
767 kfree(hctx->ccid2hctx_seqbuf); 771 kfree(hctx->ccid2hctx_seqbuf);
768 772