lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 14 Oct 2014 17:16:52 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	eric.dumazet@...il.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net] tcp: TCP Small Queues and strange attractors

From: Eric Dumazet <eric.dumazet@...il.com>
Date: Tue, 14 Oct 2014 14:10:18 -0700

> On Tue, 2014-10-14 at 15:33 -0400, David Miller wrote:
>> From: Eric Dumazet <eric.dumazet@...il.com>
>> Date: Mon, 13 Oct 2014 06:27:47 -0700
>> 
>> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
>> > index 8d4eac793700..4a7e97811d71 100644
>> > --- a/net/ipv4/tcp_output.c
>> > +++ b/net/ipv4/tcp_output.c
>> > @@ -839,26 +839,38 @@ void tcp_wfree(struct sk_buff *skb)
>> >  {
>>  ...
>> >  		local_irq_restore(flags);
>> > -	} else {
>> > -		sock_wfree(skb);
>> > +		return;
>> >  	}
>> > +out:
>> > +	sk_free(sk);
>> >  }
>> >  
>> 
>> Why do we need to release the socket here?
> 
> Thats because we had to keep a reference at the very beginning :
> 
> +       /* Keep one reference on sk_wmem_alloc.
> +        * Will be released by sk_free() from here or tcp_tasklet_func()
> +        */
> +       wmem = atomic_sub_return(skb->truesize - 1, &sk->sk_wmem_alloc);
> +
> 
> 
> If we find that we do not arm the tasklet (and keep the reference), we
> then can remove the last ref we kept.
> 
> sk_free() is essentially doing :
> 
> if (atomic_dec_and_test(&sk->sk_wmem_alloc))
>     __sk_free(sk)

Gotcha, now it makes sense.

Patch applied, thanks Eric.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists