From: Xufeng Zhang Date: Thu, 12 Jun 2014 02:53:36 +0000 (+0800) Subject: sctp: Fix sk_ack_backlog wrap-around problem X-Git-Tag: TizenStudio_2.0_p2.3~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40ce8043192a5046351320eeba92a55a6698a6e1;p=sdk%2Femulator%2Femulator-kernel.git sctp: Fix sk_ack_backlog wrap-around problem Consider the scenario: For a TCP-style socket, while processing the COOKIE_ECHO chunk in sctp_sf_do_5_1D_ce(), after it has passed a series of sanity check, a new association would be created in sctp_unpack_cookie(), but afterwards, some processing maybe failed, and sctp_association_free() will be called to free the previously allocated association, in sctp_association_free(), sk_ack_backlog value is decremented for this socket, since the initial value for sk_ack_backlog is 0, after the decrement, it will be 65535, a wrap-around problem happens, and if we want to establish new associations afterward in the same socket, ABORT would be triggered since sctp deem the accept queue as full. Fix this issue by only decrementing sk_ack_backlog for associations in the endpoint's list. Change-Id: I99853431b7852609412a3d48c8a6e96cd489e9fc Fix-suggested-by: Neil Horman Signed-off-by: Xufeng Zhang Acked-by: Daniel Borkmann Acked-by: Vlad Yasevich Signed-off-by: David S. Miller --- diff --git a/net/sctp/associola.c b/net/sctp/associola.c index cef509985192..f6d6dcd1f97d 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -375,7 +375,7 @@ void sctp_association_free(struct sctp_association *asoc) /* Only real associations count against the endpoint, so * don't bother for if this is a temporary association. */ - if (!asoc->temp) { + if (!list_empty(&asoc->asocs)) { list_del(&asoc->asocs); /* Decrement the backlog value for a TCP-style listening