netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: lksctp-developers@lists.sourceforge.net
Cc: Vlad Yasevich <vladislav.yasevich@hp.com>,
	netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: [PATCH] SCTP: Fix sctp_auth_asoc_get_hmac() to avoid kernel panic
Date: Thu, 20 Mar 2008 13:53:36 +0800	[thread overview]
Message-ID: <47E1FBE0.6030209@cn.fujitsu.com> (raw)

If association is setup with HMAC-ALGO parameter in which there is no 
HMAC algorithm supported by the endpoint, send a chunk with AUTH will 
cause kernel panic.

This is because  when send chunk with AUTH, sctp_auth_asoc_get_hmac() 
will be used to get the hmac. In this function, if the HMAC-ALGO is 
empty, it return NULL. If is not empty, it will find a valid hmac for 
using. But if all of the HMAC-ALGOs is not supported by endpoint, it 
will return a bogus pointer, not expected NULL pointer.

This patch fix this problem.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

--- a/net/sctp/auth.c	2008-02-11 17:14:05.000000000 -0500
+++ b/net/sctp/auth.c	2008-02-14 02:01:18.000000000 -0500
@@ -549,13 +549,10 @@ struct sctp_hmac *sctp_auth_asoc_get_hma
 		if (!sctp_hmac_list[id].hmac_name)
 			continue;
 
-		break;
+		return &sctp_hmac_list[id];
 	}
 
-	if (id == 0)
-		return NULL;
-
-	return &sctp_hmac_list[id];
+	return NULL;
 }
 
 static int __sctp_auth_find_hmacid(__be16 *hmacs, int n_elts, __be16 hmac_id)



             reply	other threads:[~2008-03-20  5:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-20  5:53 Wei Yongjun [this message]
2008-03-20 12:20 ` [PATCH] SCTP: Fix sctp_auth_asoc_get_hmac() to avoid kernel panic Vlad Yasevich
2008-03-21  1:51   ` Wei Yongjun

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=47E1FBE0.6030209@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=lksctp-developers@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=vladislav.yasevich@hp.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).