Subject: Re: [PATCH net-next-2.6] tcp: connect() race with timewait reuse

From: Eric Dumazet <[email-masked]>
Date: Thu, 03 Dec 2009 07:44:53 +0100

Evgeniy Polyakov a écrit :
> Hi.
> 
> Looks very good, thanks Eric, I have one question.
> 
> On Wed, Dec 02, 2009 at 04:08:59PM +0100, Eric Dumazet ([email-masked]) wrote:
>> +
>> +/*
>> + * unhash a timewait socket from established hash
>> + * lock must be hold by caller
>> + */
>> +void inet_twsk_unhash(struct inet_timewait_sock *tw)
>> +{
>> +	if (hlist_nulls_unhashed(&tw->tw_node))
>> +		return;
>> +
>> +	hlist_nulls_del_rcu(&tw->tw_node);
>> +	sk_nulls_node_init(&tw->tw_node);
>> +	inet_twsk_put(tw);
> 
> Is it safe to call in locked context? inet_twsk_put() schedules
> preemption, also I did not check what tw destructor does.
> 

You are probably right, we could defer the inet_twsk_put(tw) out of locked
section, you or I will submit another patch to correct this.

Thanks !