Skip to content

Commit dd91341

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: fix poll after shutdown
The current mptcp_poll() implementation gives unexpected results after shutdown(SEND_SHUTDOWN) and when the msk status is TCP_CLOSE. Set the correct mask. Fixes: 8edf086 ("mptcp: rework poll+nospace handling") Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 15cc104 commit dd91341

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/mptcp/protocol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3321,7 +3321,7 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk)
33213321
struct sock *sk = (struct sock *)msk;
33223322

33233323
if (unlikely(sk->sk_shutdown & SEND_SHUTDOWN))
3324-
return 0;
3324+
return EPOLLOUT | EPOLLWRNORM;
33253325

33263326
if (sk_stream_is_writeable(sk))
33273327
return EPOLLOUT | EPOLLWRNORM;
@@ -3354,6 +3354,8 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
33543354
mask |= mptcp_check_readable(msk);
33553355
mask |= mptcp_check_writeable(msk);
33563356
}
3357+
if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
3358+
mask |= EPOLLHUP;
33573359
if (sk->sk_shutdown & RCV_SHUTDOWN)
33583360
mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
33593361

0 commit comments

Comments
 (0)