public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* skb_split in tcp_retransmit_skb question
@ 2011-01-27 15:20 Sergey Senozhatsky
  2011-01-27 18:33 ` Sergey Senozhatsky
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Senozhatsky @ 2011-01-27 15:20 UTC (permalink / raw)
  To: David S. Miller
  Cc: Alexey Kuznetsov, Eric Dumazet, Pekka Savola (ipv6), netdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

Hello,

Suppose we have the following scenario:

tcp_write_timer ->
 tcp_retransmit_skb

in tcp_retransmit_skb we have `if (skb->len > cur_mss)' evaluted to true, which leads
to tcp_fragment(sk, skb, cur_mss, cur_mss) call. tcp_fragment calls skb_split(skb, buff, len)
which, in turn, calls skb_split_no_header(skb, skb1, len, pos), where we have
`skb_shinfo(skb)->nr_frags++' while in `for (i = 0; i < nfrags; i++)' loop.

Now we fall back to: 
  tcp_retransmit_skb ->
   tcp_transmit_skb ->
    pskb_copy(skb, gfp_mask)

In pskb_copy we perform iteration on nr_frags: 

 729     if (skb_shinfo(skb)->nr_frags) {
 730         int i;
 731         for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 732             skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i];
 733             get_page(skb_shinfo(n)->frags[i].page);
 734         }
 735         skb_shinfo(n)->nr_frags = i;
 736     }

The problem here is that nr_frags was increased in skb_split, yet new page was not allocated.
So, get_page(skb_shinfo(n)->frags[i].page) is actually get_page(NULL):

	mov (%rdx), %eax
	where %rdx is 0x00

Please correct me if I'm missing something.


	Sergey

[-- Attachment #2: Type: application/pgp-signature, Size: 316 bytes --]

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

* Re: skb_split in tcp_retransmit_skb question
  2011-01-27 15:20 skb_split in tcp_retransmit_skb question Sergey Senozhatsky
@ 2011-01-27 18:33 ` Sergey Senozhatsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sergey Senozhatsky @ 2011-01-27 18:33 UTC (permalink / raw)
  To: David S. Miller
  Cc: Alexey Kuznetsov, Eric Dumazet, Pekka Savola (ipv6), netdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

On (01/27/11 17:20), Sergey Senozhatsky wrote:
> Hello,
> 
> Suppose we have the following scenario:
> 
> tcp_write_timer ->
>  tcp_retransmit_skb
> 
> in tcp_retransmit_skb we have `if (skb->len > cur_mss)' evaluted to true, which leads
> to tcp_fragment(sk, skb, cur_mss, cur_mss) call. tcp_fragment calls skb_split(skb, buff, len)
> which, in turn, calls skb_split_no_header(skb, skb1, len, pos), where we have
> `skb_shinfo(skb)->nr_frags++' while in `for (i = 0; i < nfrags; i++)' loop.

Sorry for the noise. Alexey has pointed out that we have 
skb_shinfo(skb)->nr_frags = 0 in skb_split_no_header. Have no idea how did I miss it. 

Thanks,

	Sergey

[-- Attachment #2: Type: application/pgp-signature, Size: 316 bytes --]

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

end of thread, other threads:[~2011-01-27 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 15:20 skb_split in tcp_retransmit_skb question Sergey Senozhatsky
2011-01-27 18:33 ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox