Subject: Re: [PATCH net-next 3/3] ipv4: Create probe timer for tcp PMTU as per RFC4821

From: Fan Du <[email-masked]>
Date: Mon, 16 Feb 2015 13:28:47 +0800

于 2015年02月13日 17:59, Ying Xue 写道:
>> +static void icsk_mtup_probe_timer(unsigned long arg)
>> >+{
>> >+	struct sock *sk = (struct sock *)arg;
>> >+	struct net *net = sock_net(sk);
>> >+	struct inet_connection_sock *icsk = inet_csk(sk);
>> >+
>> >+	/* Restore orignal search range */
>> >+	icsk->icsk_mtup.search_high = icsk->icsk_mtup.search_high_sav;
>> >+	icsk->icsk_mtup.search_low = icsk->icsk_mtup.search_low_sav;
>> >+	icsk->icsk_mtup.probe_size = 0;
>> >+}
>> >+
> As icsk_mtup_probe_timer() is run asynchronously, we may touch an invalid socket
> instance if we don't hold socket's refcount before launching the timer.
>
> Therefore, in general we use the standard interfaces like sk_reset_timer() and
> sk_stop_timer() to operate timers associated with socket. So, the usage about
> timer in the patch seems unsafe for us. For instance, you can study how
> icsk_retransmit_timer, icsk_delack_timer and sk_timer, are implemented.

right, socket layer has stander API wrapper to manipulate timers like you point out.
Thanks for the notice :)

> Regards,
> Ying