netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Shyam_Iyer@Dell.com
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	jesse.brandeburg@intel.com, netdev@vger.kernel.org,
	olaf.kirch@oracle.com, tgraf@suug.ch, kkeil@suse.de
Subject: Re: [PANIC] lro + iscsi or lro + skb text search causes panic
Date: Wed, 28 Jan 2009 12:22:51 -0600	[thread overview]
Message-ID: <4980A27B.8050908@cs.wisc.edu> (raw)
In-Reply-To: <46A00B48CC54E4468EF6911F877AC4CA01EF2BDB@blrx3m10.blr.amer.dell.com>

Shyam_Iyer@Dell.com wrote:
> 
> Mike Christie wrote:
>> Herbert Xu wrote:
>>> On Sun, Jan 25, 2009 at 09:32:22PM -0800, David Miller wrote:
>>>> From: Mike Christie <michaelc@cs.wisc.edu>
>>>> Date: Thu, 22 Jan 2009 18:04:11 -0600
>>>>
>>>>> With the patch running against linus's git tree, my box locks up. 
>>>>> You cannot ping it. I do not get a oops or anything in the logs,
> and 
>>>>> the keyboard does not respond. I will try to get some oops output 
>>>>> and more info.
>>>> Herbert, any idea offhand?
>>> Yeah, I missed an offset update in there :) Here's a better version.
>>>
>>> net: Fix frag_list handling in skb_seq_read
>>>
>>> The frag_list handling was broken in skb_seq_read:
>>>
>>> 1) We didn't add the stepped offset when looking at the head are of 
>>> fragments other than the first.
>>>
>>> 2) We didn't take the stepped offset away when setting the data 
>>> pointer in the head area.
>>>
>>> 3) The frag index wasn't reset.
>>>
>>> This patch fixes both issues.
>>>
> 
>> It oopsd for me in skb_seq_read. addr2line said it was
> linux-2.6/net/core/skbuff.c:2228, which is this line:
> 
> 
>> while (st->frag_idx < skb_shinfo(st->cur_skb)->nr_frags) {
> 
> 
>> I added some printks in there and it looks like we hit this:
> 
>>         } else if (st->root_skb == st->cur_skb &&
>>                   skb_shinfo(st->root_skb)->frag_list) {
>>                 st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
>>                 st->frag_idx = 0;
>>                 goto next_skb;
>>        }
> 
> 
> 
> Actually I did some testing and added a few printks and found that the
> st->cur_skb->data was 0 and hence the ptr used by iscsi_tcp was null.
> This caused the kernel panic.




Yeah, that is what Jesse saw too. I never got a null ptr though. That is 
probably why he oopsed, but I could login but would get what looked like 
corrupted packets instead of oopsing.




> 
>  	if (abs_offset < block_limit) {
> -		*data = st->cur_skb->data + abs_offset;
> +		*data = st->cur_skb->data + (abs_offset -
> st->stepped_offset);
> 
>  I enabled the debug_tcp and with a few printks found that the code in
> my scenario did not go to the next_skb label as described by Mike and
> could find that the sequence being followed was this -
> 
> It hit this if condition -
>  if (st->cur_skb->next) {
>                 st->cur_skb = st->cur_skb->next;
>                 st->frag_idx = 0;
>                 goto next_skb;



Yeah, I must have been cross eyed that night. I was hitting this too, 
and that caused me to hit the loop again.


> 
> And so, now the st pointer is shifted to the next skb whereas actually
> it should have hit the second else if first since the data is in the
> frag_list.
> 
> else if (st->root_skb == st->cur_skb &&
>                    skb_shinfo(st->root_skb)->frag_list) {
>                 st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
>                 goto next_skb;
>         }
> 
> 
> Reversing the two conditions the attached patch fixes the issue for me
> on top of Herbert's patches.  I have done the testing on the ixgbe
> adapter itself and verified the fix using some amount of data transfer
> as well.
> 
> Signed-off-by: Shyam Iyer <shyam_iyer@dell.com>
> 
> --- skbuff.c.orig	2009-01-29 01:12:03.000000000 +0530
> +++ skbuff.c	2009-01-29 01:34:57.000000000 +0530
> @@ -2039,15 +2039,15 @@
>  		st->frag_data = NULL;
>  	
>  
> -	if (st->cur_skb->next) {
> -		st->cur_skb = st->cur_skb->next;
> -		st->frag_idx = 0;
> -		goto next_skb;
> -	} else if (st->root_skb == st->cur_skb &&
> +	if (st->root_skb == st->cur_skb &&
>  		   skb_shinfo(st->root_skb)->frag_list) {
>  		st->cur_skb = skb_shinfo(st->root_skb)->frag_list;
>  		st->frag_idx=0;


I think you diffed this against the wrong source. In the upstream code 
this is
st->frag_idx = 0;

so the patch does not apply.


>  		goto next_skb;
> +	} else if (st->cur_skb->next) {
> +		st->cur_skb = st->cur_skb->next;
> +		st->frag_idx = 0;
> +		goto next_skb;
>  	}
>  
>  	return 0;
> 

Nice catch. Patch works for me. Thanks!


  reply	other threads:[~2009-01-28 18:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 12:36 [PANIC] lro + iscsi or lro + skb text search causes panic Shyam_Iyer
2009-01-28 18:22 ` Mike Christie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-01-22 20:55 Brandeburg, Jesse
2009-01-22 22:49 ` Mike Christie
2009-01-23  4:22   ` Mike Christie
2009-01-23  4:29     ` Mike Christie
2009-01-26  5:34     ` David Miller
2009-01-22 23:21 ` Herbert Xu
2009-01-22 23:45   ` Brandeburg, Jesse
2009-01-23  0:04   ` Mike Christie
2009-01-26  5:32     ` David Miller
2009-01-26 22:30       ` Herbert Xu
2009-01-27  1:40         ` Brandeburg, Jesse
2009-01-27  3:01           ` Herbert Xu
2009-01-27  5:52         ` David Miller
2009-01-27  6:12         ` Mike Christie
     [not found]           ` <46A00B48CC54E4468EF6911F877AC4CA01EF2BC9@blrx3m10.blr.amer.dell.com>
2009-01-28 21:25             ` Herbert Xu
2009-01-30  0:13               ` David Miller
2009-01-26 20:54     ` Mike Christie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4980A27B.8050908@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=Shyam_Iyer@Dell.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jesse.brandeburg@intel.com \
    --cc=kkeil@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=olaf.kirch@oracle.com \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).