]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sctp: handle association restarts when the socket is closed.
authorVlad Yasevich <vyasevich@gmail.com>
Fri, 3 Oct 2014 22:16:20 +0000 (18:16 -0400)
committerJiri Slaby <jslaby@suse.cz>
Fri, 17 Oct 2014 07:43:19 +0000 (09:43 +0200)
commite6fd6243cdc7434e7001589099394321a1670b47
tree90511682bde7bc72e6a10bd6cd8a9dbff8220b73
parent0df5b80cd4590d4fee99341a0c8af0a7997dd490
sctp: handle association restarts when the socket is closed.

[ Upstream commit bdf6fa52f01b941d4a80372d56de465bdbbd1d23 ]

Currently association restarts do not take into consideration the
state of the socket.  When a restart happens, the current assocation
simply transitions into established state.  This creates a condition
where a remote system, through a the restart procedure, may create a
local association that is no way reachable by user.  The conditions
to trigger this are as follows:
  1) Remote does not acknoledge some data causing data to remain
     outstanding.
  2) Local application calls close() on the socket.  Since data
     is still outstanding, the association is placed in SHUTDOWN_PENDING
     state.  However, the socket is closed.
  3) The remote tries to create a new association, triggering a restart
     on the local system.  The association moves from SHUTDOWN_PENDING
     to ESTABLISHED.  At this point, it is no longer reachable by
     any socket on the local system.

This patch addresses the above situation by moving the newly ESTABLISHED
association into SHUTDOWN-SENT state and bundling a SHUTDOWN after
the COOKIE-ACK chunk.  This way, the restarted associate immidiately
enters the shutdown procedure and forces the termination of the
unreachable association.

Reported-by: David Laight <David.Laight@aculab.com>
Signed-off-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
include/net/sctp/command.h
net/sctp/sm_statefuns.c