]> 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)
commit00aa040cdbf34b9faf249825fd7a87c846ce0a0e
treeb90d784ed77ae10ea21a668c4a6eb0def76e8300
parent2a010bc45e6eb55a782a1cdd05c281bac8d4fbf3
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: edbcbb05d0a0 ("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