]> git.baikalelectronics.ru Git - kernel.git/commit
mptcp: fix races between shutdown and recvmsg
authorPaolo Abeni <pabeni@redhat.com>
Wed, 10 Jun 2020 08:47:41 +0000 (10:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Jun 2020 20:34:14 +0000 (13:34 -0700)
commita347b9a84e25a2cc31d160fdec07665f769ba493
treeb90d784ed77ae10ea21a668c4a6eb0def76e8300
parentfabbe3a95104b0e6a642811fe77531c0d9babd0f
mptcp: fix races between shutdown and recvmsg

The msk sk_shutdown flag is set by a workqueue, possibly
introducing some delay in user-space notification. If the last
subflow carries some data with the fin packet, the user space
can wake-up before RCV_SHUTDOWN is set. If it executes unblocking
recvmsg(), it may return with an error instead of eof.

Address the issue explicitly checking for eof in recvmsg(), when
no data is found.

Fixes: 56be349a1f7f ("mptcp: subflow: check parent mptcp socket on subflow state change")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/protocol.c