From: Xin Long Date: Sat, 30 Jul 2016 06:14:41 +0000 (+0800) Subject: sctp: allow receiving msg when TCP-style sk is in CLOSED state X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e08786942e0ea3a3cb268e6c62523d40f1c5eeb8;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git sctp: allow receiving msg when TCP-style sk is in CLOSED state Commit 141ddefce7c8 ("sctp: change sk state to CLOSED instead of CLOSING in sctp_sock_migrate") changed sk state to CLOSED if the assoc is closed when sctp_accept clones a new sk. If there is still data in sk receive queue, users will not be able to read it any more, as sctp_recvmsg returns directly if sk state is CLOSED. This patch is to add CLOSED state check in sctp_recvmsg to allow reading data from TCP-style sk with CLOSED state as what TCP does. Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller --- diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 8812e1bf6c1c..9fc417a8b476 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -2079,7 +2079,7 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, lock_sock(sk); if (sctp_style(sk, TCP) && !sctp_sstate(sk, ESTABLISHED) && - !sctp_sstate(sk, CLOSING)) { + !sctp_sstate(sk, CLOSING) && !sctp_sstate(sk, CLOSED)) { err = -ENOTCONN; goto out; }