: [CCID2]: Fix the use of the RTO timer
PATCH 1/1 : [CCID2]: Fix the use of the RTO timer
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.
---
net/dccp/ccids/ccid2.c +15 -11
@@ -234,7 +234,7 @@ static void ccid2_hc_tx_rto_expire(unsigccid2_hc_tx_check_sanity (hctx); out:bh_unlock_sock (sk); -/* sock_put(sk); */ +sock_put (sk); }static void ccid2_start_rto_timer (struct sock *sk)
@@ -399,10 +399,12 @@ out_invalid_option:return -1 ; } -static void ccid2_hc_tx_kill_rto_timer (struct ccid2_hc_tx_sock *hctx) +static void ccid2_hc_tx_kill_rto_timer (struct sock *sk) { -if (del_timer (&hctx->ccid2hctx_rtotimer)) -ccid2_pr_debug ("deleted RTO timer\n" ); +struct ccid2_hc_tx_sock *hctx =ccid2_hc_tx_sk (sk); + +sk_stop_timer (sk, &hctx->ccid2hctx_rtotimer); +ccid2_pr_debug ("deleted RTO timer\n" ); } static inline void ccid2_new_ack(struct sock *sk,
@@ -496,17 +498,19 @@ static inline void ccid2_new_ack(struct }/* we got a new ack, so re-start RTO timer */ -ccid2_hc_tx_kill_rto_timer (hctx); +ccid2_hc_tx_kill_rto_timer (sk);ccid2_start_rto_timer (sk); } -static void ccid2_hc_tx_dec_pipe (struct ccid2_hc_tx_sock *hctx) +static void ccid2_hc_tx_dec_pipe (struct sock *sk) { +struct ccid2_hc_tx_sock *hctx =ccid2_hc_tx_sk (sk); + hctx->ccid2hctx_pipe--;BUG_ON (hctx->ccid2hctx_pipe <0 );if (hctx->ccid2hctx_pipe =0 ) -ccid2_hc_tx_kill_rto_timer (hctx); +ccid2_hc_tx_kill_rto_timer (sk); }static void ccid2_hc_tx_packet_recv (struct sock *sk,struct sk_buff *skb)
@@ -627,7 +631,7 @@ static void ccid2_hc_tx_packet_recv(stru seqp->ccid2s_acked =1 ;ccid2_pr_debug ("Got ack for %llu\n" , seqp->ccid2s_seq); -ccid2_hc_tx_dec_pipe (hctx); +ccid2_hc_tx_dec_pipe (sk); }if (seqp = hctx->ccid2hctx_seqt) { done =1 ;
@@ -674,7 +678,7 @@ static void ccid2_hc_tx_packet_recv(struwhile (1 ) {if (!seqp->ccid2s_acked) { loss =1 ; -ccid2_hc_tx_dec_pipe (hctx); +ccid2_hc_tx_dec_pipe (sk); }if (seqp = hctx->ccid2hctx_seqt)break ;
@@ -760,9 +764,9 @@ static int ccid2_hc_tx_init(struct sockstatic void ccid2_hc_tx_exit (struct sock *sk) {struct dccp_sock *dp =dccp_sk (sk); -struct ccid2_hc_tx_sock *hctx = dp->dccps_hc_tx_ccid_private; +struct ccid2_hc_tx_sock *hctx =ccid2_hc_tx_sk (sk); -ccid2_hc_tx_kill_rto_timer (hctx); +ccid2_hc_tx_kill_rto_timer (sk);kfree (hctx->ccid2hctx_seqbuf);
net/dccp/ccids/ccid2.c
Quoted 12 lines · Andrea Bittau
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 <[email protected]>---
net/dccp/ccids/ccid2.c +0
-0
This patch looks good in itself but there are further problems unloading than this as it occurs also with the code base prior to CCID2 merging....
Ian
--
Ian McDonald
http://wand.net.nz/~iam4
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand
Quoted 3 lines · Ian McDonald
This patch looks good in itself but there are further problems unloading than this as it occurs also with the code base prior to CCID2 merging....
Do you have specific examples? I've been fighting quite a lot in trying to get the module to unload itself cleanly =D
You probably are already aware that there is a reference count kept for timewait sockets and for the control sock. But that is not an issue.
The only outstanding bug I can think of, which will not cause the module to unload, is that connect race condition thing I've been bragging about. Basically, if I recall correctly, the connection occurs and terminates before sys_connect() returns, and the socket is never freed.
Arnaldo Carvalho de Melo
AppliedQuoted 6 lines · Andrea Bittau
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.
Thanks, applied and pushed to Dave, I wonder why I didn't catched this...
- Arnaldo