netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* bug and question in tcp stack
@ 2010-02-12 23:22 Joe Cao
  2010-02-12 23:39 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Cao @ 2010-02-12 23:22 UTC (permalink / raw)
  To: netdev, linux-kernel

Hi,

I think it is an obvious bug both in the old and latest kernel:

In function net/ipv4/tcp_output.c, tcp_retransmit_skb() returns a NEGTIVE value on failures.  But in net/ipv4/tcp_timer.c, in function tcp_retransmit_timer(), the line

if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk)) > 0) {

checks the return value as a positive number, which will never be true.  On failures from tcp_retransmit_skb(), the code will follow the wrong path.

My second question is regarding the function tcp_retransmit_skb().  The first check in the function is copied here:

 	/* Do not sent more than we queued. 1/4 is reserved for possible
	 * copying overhead: fragmentation, tunneling, mangling etc.
	 */
	if (atomic_read(&sk->sk_wmem_alloc) >
	    min(sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), sk->sk_sndbuf))
		return -EAGAIN;


My question is if that turns out to be true, which I saw happend, how could the stack get out of the state?  Because all TCP retransmission may fail, no buffer will be released.  The connection is virtually dead.  Is that true?

Thanks,
Joe


      

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bug and question in tcp stack
  2010-02-12 23:22 bug and question in tcp stack Joe Cao
@ 2010-02-12 23:39 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-02-12 23:39 UTC (permalink / raw)
  To: caoco2002; +Cc: netdev, linux-kernel

From: Joe Cao <caoco2002@yahoo.com>
Date: Fri, 12 Feb 2010 15:22:16 -0800 (PST)

> if (tcp_retransmit_skb(sk, tcp_write_queue_head(sk)) > 0) {
> 
> checks the return value as a positive number, which will never be true.

It can, recheck the code paths.

The upcall to send an SKB out through the packet schedular and onwards
to the actual device can return congestion notification values, which
are positive.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-12 23:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-12 23:22 bug and question in tcp stack Joe Cao
2010-02-12 23:39 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).