netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Wei Yongjun <yjwei@cn.fujitsu.com>,
	netdev@vger.kernel.org, lksctp-developers@lists.sourceforge.net
Subject: Re: [Lksctp-developers] [PATCH] SCTP: Fix kernel panic while	received AUTH chunk with BAD shared key identifier
Date: Fri, 25 Jan 2008 11:46:39 -0500	[thread overview]
Message-ID: <479A126F.4010505@hp.com> (raw)
In-Reply-To: <20080124121608.GA20633@hmsreliant.think-freely.org>

Neil Horman wrote:
> On Tue, Jan 22, 2008 at 05:29:20PM +0900, Wei Yongjun wrote:
>>
>> This patch fix this problem.
>>
>> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
>>
>> --- a/net/sctp/auth.c	2008-01-21 00:03:25.000000000 -0500
>> +++ b/net/sctp/auth.c	2008-01-21 21:31:47.000000000 -0500
>> @@ -420,15 +420,15 @@ struct sctp_shared_key *sctp_auth_get_sh
>>  				const struct sctp_association *asoc,
>>  				__u16 key_id)
>>  {
>> -	struct sctp_shared_key *key = NULL;
>> +	struct sctp_shared_key *key;
>>  
>>  	/* First search associations set of endpoint pair shared keys */
>>  	key_for_each(key, &asoc->endpoint_shared_keys) {
>>  		if (key->key_id == key_id)
>> -			break;
>> +			return key;
>>  	}
>>  
>> -	return key;
>> +	return NULL;
>>  }
>>  
>>  /*
>>
> 
> FWIW, Ack from me.  The assignment of NULL to key can safely be removed, since
> key_for_each (which is just list_for_each_entry under the covers does an initial
> assignment to key anyway). 
> 
> If the endpoint_shared_keys list is empty, or if the key_id being requested does
> not exist, the function as it currently stands returns the actuall list_head (in
> this case endpoint_shared_keys.  Since that list_head isn't surrounded by an
> actuall data structure, the last iteration through list_for_each_entry will do a
> container_of on key, and we wind up returning a bogus pointer, instead of NULL,
> as we should.  Wei's patch corrects that.
> 
> Regards
> Neil
> 
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 

Yep, the patch is correct.

Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>

-vlad

  reply	other threads:[~2008-01-25 16:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22  8:29 [PATCH] SCTP: Fix kernel panic while received AUTH chunk with BAD shared key identifier Wei Yongjun
2008-01-22 14:17 ` David Miller
2008-01-24 12:16 ` [Lksctp-developers] " Neil Horman
2008-01-25 16:46   ` Vlad Yasevich [this message]
2008-02-05  8:26     ` Wei Yongjun
2008-02-05 11:03       ` David Miller

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=479A126F.4010505@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=lksctp-developers@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=yjwei@cn.fujitsu.com \
    /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).