netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SCTP: Fix kernel panic while received ASCONF chunk with bad serial number
@ 2008-02-05 14:35 Wei Yongjun
  2008-02-05 15:00 ` Vlad Yasevich
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2008-02-05 14:35 UTC (permalink / raw)
  To: netdev, lksctp-developers; +Cc: Vlad Yasevich, David Miller

While recevied ASCONF chunk with serial number less then needed, kernel 
will treat this chunk as a retransmitted ASCONF chunk and find cached 
ASCONF-ACK chunk used sctp_assoc_lookup_asconf_ack(). But this function 
will always return NO-NULL. So response with cached ASCONF-ACKs chunk 
will cause kernel panic.
In function sctp_assoc_lookup_asconf_ack(), if the cached ASCONF-ACKs 
list asconf_ack_list is empty, or if the serial being requested does not 
exists, the function as it currectly stands returns the actuall 
list_head asoc->asconf_ack_list, this is not a cache ASCONF-ACK chunk 
but a bogus pointer.

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

--- a/net/sctp/associola.c	2008-01-28 20:31:39.000000000 -0500
+++ b/net/sctp/associola.c	2008-01-28 23:45:20.000000000 -0500
@@ -1525,7 +1525,7 @@ struct sctp_chunk *sctp_assoc_lookup_asc
 					const struct sctp_association *asoc,
 					__be32 serial)
 {
-	struct sctp_chunk *ack = NULL;
+	struct sctp_chunk *ack;
 
 	/* Walk through the list of cached ASCONF-ACKs and find the
 	 * ack chunk whose serial number matches that of the request.
@@ -1533,9 +1533,9 @@ struct sctp_chunk *sctp_assoc_lookup_asc
 	list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) {
 		if (ack->subh.addip_hdr->serial == serial) {
 			sctp_chunk_hold(ack);
-			break;
+			return ack;
 		}
 	}
 
-	return ack;
+	return NULL;
 }



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

* Re: [PATCH] SCTP: Fix kernel panic while received ASCONF chunk with bad serial number
  2008-02-05 14:35 [PATCH] SCTP: Fix kernel panic while received ASCONF chunk with bad serial number Wei Yongjun
@ 2008-02-05 15:00 ` Vlad Yasevich
  0 siblings, 0 replies; 2+ messages in thread
From: Vlad Yasevich @ 2008-02-05 15:00 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: netdev, lksctp-developers, David Miller

Wei Yongjun wrote:
> While recevied ASCONF chunk with serial number less then needed, kernel 
> will treat this chunk as a retransmitted ASCONF chunk and find cached 
> ASCONF-ACK chunk used sctp_assoc_lookup_asconf_ack(). But this function 
> will always return NO-NULL. So response with cached ASCONF-ACKs chunk 
> will cause kernel panic.
> In function sctp_assoc_lookup_asconf_ack(), if the cached ASCONF-ACKs 
> list asconf_ack_list is empty, or if the serial being requested does not 
> exists, the function as it currectly stands returns the actuall 
> list_head asoc->asconf_ack_list, this is not a cache ASCONF-ACK chunk 
> but a bogus pointer.

Thanks, applied.

-vlad

> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> 
> --- a/net/sctp/associola.c    2008-01-28 20:31:39.000000000 -0500
> +++ b/net/sctp/associola.c    2008-01-28 23:45:20.000000000 -0500
> @@ -1525,7 +1525,7 @@ struct sctp_chunk *sctp_assoc_lookup_asc
>                     const struct sctp_association *asoc,
>                     __be32 serial)
> {
> -    struct sctp_chunk *ack = NULL;
> +    struct sctp_chunk *ack;
> 
>     /* Walk through the list of cached ASCONF-ACKs and find the
>      * ack chunk whose serial number matches that of the request.
> @@ -1533,9 +1533,9 @@ struct sctp_chunk *sctp_assoc_lookup_asc
>     list_for_each_entry(ack, &asoc->asconf_ack_list, transmitted_list) {
>         if (ack->subh.addip_hdr->serial == serial) {
>             sctp_chunk_hold(ack);
> -            break;
> +            return ack;
>         }
>     }
> 
> -    return ack;
> +    return NULL;
> }
> 
> 


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

end of thread, other threads:[~2008-02-05 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 14:35 [PATCH] SCTP: Fix kernel panic while received ASCONF chunk with bad serial number Wei Yongjun
2008-02-05 15:00 ` Vlad Yasevich

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).