[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <47E20DA8.1080805@cn.fujitsu.com>
Date: Thu, 20 Mar 2008 15:09:28 +0800
From: Wei Yongjun <yjwei@...fujitsu.com>
To: lksctp-developers@...ts.sourceforge.net,
Vlad Yasevich <vladislav.yasevich@...com>,
netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: [PATCH] SCTP: Fix possible memory leak while process INIT chunk with
AUTH paramters
While endpoint received INIT/INIT-ACK chunk with AUTH parameters, such
as RANDOM, HMAC_ALGO, CHUNKS parameter, if those parameters appear more
then once, memory for store those parameters will be malloc more then
once and not free.
This patch change to used the first parameter and ignore the others.
Signed-off-by: Wei Yongjun <yjwei@...fujitsu.com>
--- a/net/sctp/sm_make_chunk.c 2008-02-11 17:14:05.000000000 -0500
+++ b/net/sctp/sm_make_chunk.c 2008-02-14 03:57:58.000000000 -0500
@@ -2458,6 +2458,9 @@ static int sctp_process_param(struct sct
if (!sctp_auth_enable)
goto fall_through;
+ if (asoc->peer.peer_random)
+ break;
+
/* Save peer's random parameter */
asoc->peer.peer_random = kmemdup(param.p,
ntohs(param.p->length), gfp);
@@ -2471,6 +2474,9 @@ static int sctp_process_param(struct sct
if (!sctp_auth_enable)
goto fall_through;
+ if (asoc->peer.peer_hmacs)
+ break;
+
/* Save peer's HMAC list */
asoc->peer.peer_hmacs = kmemdup(param.p,
ntohs(param.p->length), gfp);
@@ -2487,6 +2493,9 @@ static int sctp_process_param(struct sct
if (!sctp_auth_enable)
goto fall_through;
+ if (asoc->peer.peer_chunks)
+ break;
+
asoc->peer.peer_chunks = kmemdup(param.p,
ntohs(param.p->length), gfp);
if (!asoc->peer.peer_chunks)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists