sctp: recvmsg should be able to run even if sock is in closing state
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Fri, 15 Jul 2016 19:38:19 +0000 (16:38 -0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Jul 2016 05:02:09 +0000 (22:02 -0700)
commite5b13f3444dfe4f014343e83aa7948b83ef58168
tree66fdbac1414cd9a04e5472b37bde439027509267
parentb3f2cf8feecfa89b3e94a61c0ca29ea59e36d146
sctp: recvmsg should be able to run even if sock is in closing state

Commit d46e416c11c8 missed to update some other places which checked for
the socket being TCP-style AND Established state, as Closing state has
some overlapping with the previous understanding of Established.

Without this fix, one of the effects is that some already queued rx
messages may not be readable anymore depending on how the association
teared down, and sending may also not be possible if peer initiated the
shutdown.

Also merge two if() blocks into one condition on sctp_sendmsg().

Cc: Xin Long <lucien.xin@gmail.com>
Fixes: d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c